Help With Repair Command Doesnt Work
#1

I have the following command, it doesnt give me any errors but when i use the command it doesnt repair the vehicle but it still sends the message that the vehicle has been repaired, the visible damage does not go away.

Код:
// Police Comissioner Repair//
	if(strcmp(cmdtext, "/pdrepair", true) == 0)
	{
	  if(GetPlayerState(playerid) == 2)
      if(PlayerInfo[playerid][pLeader] == 1)
	  {
	    SetVehicleHealth(GetPlayerVehicleID(playerid),1000.0);
	    SendClientMessage(playerid, GREEN, "Your Car has been Repaired");
	  }
	  else SendClientMessage(playerid, RED, "You're not driving a vehicle!");
	}
I want it to only be available to the pLeader 1 (police faction leader) ie. the if(PlayerInfo[playerid][pLeader] == 1)
Now will th else SendClientMessage(playerid, RED, "You're not driving a vehicle!"); be sent if the player is not in a vehicle or if he is not the pLeader of faction 1 or is it both?

Thanks for the help.
Ps i have searched and cant seem to find out why it wont get rid of the damage, it may repair the car but the damage is till visible
Reply
#2

Try this.
Код:
  if(strcmp(cmdtext, "/pdrepair", true) == 0)
  {
	if(IsPlayerConnected(playerid))
	{
      if(PlayerInfo[playerid][pLeader] == 1)
      {
        if(GetPlayerState(playerid) == 2)
        {
          SetVehicleHealth(GetPlayerVehicleID(playerid),1000.0);
  	      SendClientMessage(playerid, GREEN, "Your Car has been Repaired");
    	}
  	    else
        {
          SendClientMessage(playerid, RED, "You're not driving a vehicle!");
     	}
      }
      else
      {
        SendClientMessage(playerid, RED, "You're not the Police Chief !");
      }
    }
    return 1;
  }
Reply
#3

I think the function is RepairVehicle(vehicleid)
Reply
#4

Either method can be used.
Reply
#5

Thanks, i got it to work.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)