SA-MP Forums Archive
Car health 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Car health help (/showthread.php?tid=71895)



Car health help - Klutty - 04.04.2009

Whats the "commands" for when your car reaches under 300 of health it automaticlly repairs?

Please, someone give me the code and where to put =)


Re: Car health help - _TeRmiNaToR_ - 04.04.2009

pawn Код:
SetTimerEx("AutoR", 100, true, "i"); // In OnGameModeInıt

forward AutoR(playerid);
public AutoR(playerid)
{
new Float:health;
new cid = GetPlayerVehicleID(playerid);
if (!IsPlayerInAnyVehicle(playerid))return GameTextForPlayer(playerid,"You Must In A Vehicle",1000,3);
GetVehicleHealth(cid, health);
if (health < 300)return SetVehicleHealth(cid,1000);
}
}



Re: Car health help - SpiderPork - 04.04.2009

It's not SetTimer, it's SetTimerEx under OnPlayerSpawn.


Re: Car health help - Klutty - 04.04.2009

Quote:
Originally Posted by _TeRmiNaToR_
pawn Код:
SetTimerEx("AutoR", 100, true, "i"); // In OnGameModeInıt

forward AutoR();
public AutoR();
{
if(GetVehicleHealth(GetPlayerVehicleModel(playerid) <= 300 ))
{
new cid;
cid = GetVehicleID(vehicleid);
SetVehicleHealth(cid, 1000);
}
return 1;
}
Gave me this:
Код:
C:\Program\SAMP Server\gamemodes\sldm.pwn(796) : error 055: start of function body without function header
C:\Program\SAMP Server\gamemodes\sldm.pwn(797) : error 010: invalid function or declaration
C:\Program\SAMP Server\gamemodes\sldm.pwn(800) : error 010: invalid function or declaration



Re: Car health help - _TeRmiNaToR_ - 04.04.2009

I have edited and fixed the errors. :

Quote:
Originally Posted by _TeRmiNaToR_
pawn Код:
SetTimerEx("AutoR", 100, true, "i"); // In OnGameModeInıt

forward AutoR(playerid);
public AutoR(playerid)
{
new Float:health;
new cid = GetPlayerVehicleID(playerid);
GetVehicleHealth(cid, health);
if (!IsPlayerInAnyVehicle(playerid))return GameTextForPlayer(playerid,"You Must In A Vehicle",1000,3);
if (health < 300)return SetVehicleHealth(cid,1000);
}
}



Re: Car health help - Klutty - 04.04.2009

Quote:
Originally Posted by _TeRmiNaToR_
I have edited and fixed the errors. :

Quote:
Originally Posted by _TeRmiNaToR_
pawn Код:
SetTimerEx("AutoR", 100, true, "i"); // In OnGameModeInıt

forward AutoR(playerid);
public AutoR(playerid)
{
new Float:health;
new cid = GetPlayerVehicleID(playerid);
GetVehicleHealth(cid, health);
if (!IsPlayerInAnyVehicle(playerid))return GameTextForPlayer(playerid,"You Must In A Vehicle",1000,3);
if (health < 300)return SetVehicleHealth(cid,1000);
}
}
Still not working, only errors...


Re: Car health help - _TeRmiNaToR_ - 04.04.2009

pawn Код:
forward AutoR(playerid);
public AutoR(playerid)
{
new Float:health;
new cid = GetPlayerVehicleID(playerid);
GetVehicleHealth(cid, health);
if (!IsPlayerInAnyVehicle(playerid))return GameTextForPlayer(playerid,"You Must In A Vehicle",1000,3);
if (health < 300)return SetVehicleHealth(cid,1000);
return 1;
}
Now?

Edit: By me give not errors.


Re: Car health help - Klutty - 04.04.2009

Quote:
Originally Posted by _TeRmiNaToR_
pawn Код:
forward AutoR(playerid);
public AutoR(playerid)
{
new Float:health;
new cid = GetPlayerVehicleID(playerid);
GetVehicleHealth(cid, health);
if (!IsPlayerInAnyVehicle(playerid))return GameTextForPlayer(playerid,"You Must In A Vehicle",1000,3);
if (health < 300)return SetVehicleHealth(cid,1000);
return 1;
}
Now?
Yeah, why did you set a timer before lol?


Re: Car health help - _TeRmiNaToR_ - 04.04.2009


Because it is a specific time interval to check with, or does not process.

Not: sorry for my bad english, I use ****** translator.


Re: Car health help - Klutty - 04.04.2009

It doesnt work IG...