Problem With Fix Command

Started by Yankee, Jun 10, 2017, 09:26 AM

Previous topic - Next topic

Yankee

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 );
  }
 }

Derwaish.

#1
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 );
  }
 }

shakib000