Fix Command. - 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)
+--- Thread: Fix Command. (
/showthread.php?tid=388470)
Fix Command. -
guitarmandanny - 28.10.2012
Hey, Im making a Fix command for Mechanic class, But it doesn't repair the vehicle..
And I have to be in the vehicle, I want it so it repairs the vehicle outside of the car
Any help would be appreciated.
Here is my code
Код:
CMD:fix(playerid, params[])
{
new
aName[MAX_PLAYER_NAME],
taName[MAX_PLAYER_NAME],
vehicleid,
targetid
;
vehicleid = GetClosestVehicle(playerid);
GetPlayerName(playerid, aName, sizeof(aName));
GetPlayerName(targetid, taName, sizeof(taName));
if(gTeam[playerid] == ASSISTANCE)
{
if (IsPlayerInVehicle(targetid, vehicleid))
{
RepairVehicle(GetPlayerVehicleID(vehicleid));
SendClientMessage(playerid, COLOR_WHITE, "You have Succesfully repaired the Vehicle.");
return 1;
}
else return SendClientMessage(playerid, RED, "ERROR: You are not near a vehicle!");
}
return 1;
}
Re: Fix Command. -
SwisherSweet - 28.10.2012
Код:
CMD:fix(playerid, params[])
{
new vehicleid = GetPlayerVehicleID(playerid);
new
aName[MAX_PLAYER_NAME],
taName[MAX_PLAYER_NAME],
vehicleid,
targetid
;
vehicleid = GetClosestVehicle(playerid);
GetPlayerName(playerid, aName, sizeof(aName));
GetPlayerName(targetid, taName, sizeof(taName));
if(gTeam[playerid] == ASSISTANCE)
{
if (IsPlayerInVehicle(targetid, vehicleid))
{
SetVehicleHealth(vehicleid, 1000.0);
SendClientMessage(playerid, COLOR_WHITE, "You have Succesfully repaired the Vehicle.");
return 1;
}
else return SendClientMessage(playerid, RED, "ERROR: You are not near a vehicle!");
}
return 1;
}
++REP!!!
Re: Fix Command. -
Eric - 28.10.2012
pawn Код:
CMD:fix(playerid, params[]) {
new
vehicleid = GetPlayerVehicleID(playerid);
if(gTeam[playerid] == ASSISTANCE) {
if(IsPlayerInVehicle(playerid, vehicleid)) {
RepairVehicle(vehicleid);
SendClientMessage(playerid, COLOR_WHITE, "You have successfully repaired the vehicle.");
}
else SendClientMessage(playerid, RED, "ERROR: You are not in a vehicle!");
}
return 1;
}
Try that.
Re: Fix Command. -
guitarmandanny - 28.10.2012
We got it fixed cheers guys, I'll rep you both.