Vice City: Multiplayer

Server Development => Scripting and Server Management => Topic started by: Yankee on Jun 10, 2017, 09:26 AM

Title: Problem With Fix Command
Post by: Yankee on Jun 10, 2017, 09:26 AM
Hi guys,my fix code is working very good.But players can use fix although they don't have any money.They can use it without money.Can someone add a command for this ?I want players can't use this command without money.Command must stop the player with a message like this"You can't use this command without cost".

else if ( cmd == "fix" )
 {
 if ( !player.Vehicle ) MessagePlayer( "There is no car for fix.", player );
 else if ( ( player.Vehicle.Health == 1000 )  && ( player.Vehicle.GetTyre(0) == 0 || player.Vehicle.GetTyre(1) == 0 || player.Vehicle.GetTyre(2) == 0 || player.Vehicle.GetTyre(3) == 0 ) ) MessagePlayer( "Error.", player );
 else
  {
  player.Cash -=250
  player.Vehicle.Fix();
  MessagePlayer( "Fixed.", player );
  }
 }
Title: Re: Problem With Fix Command
Post by: Derwaish. on Jun 10, 2017, 10:28 AM
you forgot to add.
if( player.Cash < 250 ) return MessagePlayer( ">> [#FF00FF]You don't have enough Cash to fix vehicle. Fix-Cost: $250", player );

Full Command
else if ( cmd == "fix" )
 {
  if( player.Cash < 250 ) return MessagePlayer( ">> [#FF00FF]You don't have enough Cash to fix vehicle. Fix-Cost: $250", player );

 else if ( !player.Vehicle ) MessagePlayer( "There is no car for fix.", player );
 else if ( ( player.Vehicle.Health == 1000 )  && ( player.Vehicle.GetTyre(0) == 0 || player.Vehicle.GetTyre(1) == 0 || player.Vehicle.GetTyre(2) == 0 || player.Vehicle.GetTyre(3) == 0 ) ) MessagePlayer( "Error.", player );
 else
  {
  player.Cash -=250
  player.Vehicle.Fix();
  MessagePlayer( "Fixed.", player );
  }
 }
Title: Re: Problem With Fix Command
Post by: shakib000 on May 21, 2024, 06:16 PM
very good ty