Help With Repair Command Doesnt Work - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Help With Repair Command Doesnt Work (
/showthread.php?tid=114410)
Help With Repair Command Doesnt Work -
hector_williams - 19.12.2009
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
Re: Help With Repair Command Doesnt Work -
Lynn09© - 19.12.2009
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;
}
Re: Help With Repair Command Doesnt Work -
[WF]Demon - 19.12.2009
I think the function is RepairVehicle(vehicleid)
Re: Help With Repair Command Doesnt Work -
Lynn09© - 19.12.2009
Either method can be used.
Re: Help With Repair Command Doesnt Work -
hector_williams - 19.12.2009
Thanks, i got it to work.