Auto Car Repair Help - 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: Auto Car Repair Help (
/showthread.php?tid=352580)
Auto Car Repair Help -
Neo Karls - 20.06.2012
pawn Code:
#include <a_samp>
#define COLOR_YELLOW 0xFFFF00AA
forward FixAllCar();
new FixTimer;
public OnFilterScriptInit()
{
print("\n--------------------------------------");
print(" Auto Car Repair By : Brian Gutierrez ");
print("--------------------------------------\n");
FixTimer = SetTimer("FixAllCar",1000,true);//every 1000 milisecond we call the function "FixAllCar"
return 1;
}
public OnFilterScriptExit()
{
KillTimer(FixTimer); // we kill our timer on script unload.
return 1;
}
public FixAllCar()
{
for(new playerid = 0; playerid < MAX_PLAYERS; playerid++)
// loop all possible player
{
if(IsPlayerConnected(playerid) && GetVehicleModel(vehicleid) == 502)
//if the player is connected AND in a car
{
RepairVehicle(GetPlayerVehicleID(playerid));// set the vehicle healt
}
}
}
I want to make the auto repair system for car 502 (Hotrina)
Is there any error or something in above script. My Pawno is getting shut down when i compile it
Respuesta: Auto Car Repair Help -
b.rock - 20.06.2012
change
if(IsPlayerConnected(playerid) && GetVehicleModel(vehicleid) == 502)
to
if(IsPlayerConnected(playerid) && GetVehicleModel(GetPlayerVehicleID(playerid)) == 502)
Re: Auto Car Repair Help -
[MM]RoXoR[FS] - 20.06.2012
veicleid needs to be defined.
pawn Code:
public FixAllCar()
{
for(new playerid = 0; playerid < MAX_PLAYERS; playerid++)
// loop all possible player
{
if(IsPlayerConnected(playerid) && IsPlayerInAnyVehicle(playerid))
//if the player is connected AND in a car
{
if(GetVehicleModel(GetPlayerVehicleID(playerid))==502) RepairVehicle(GetPlayerVehicleID(playerid));// set the vehicle healt
}
}
}
Re: Auto Car Repair Help -
Neo Karls - 20.06.2012
Ah I already fixed the Error just a while ago ,anyway Thanks