Car health help
#1

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 =)
Reply
#2

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);
}
}
Reply
#3

It's not SetTimer, it's SetTimerEx under OnPlayerSpawn.
Reply
#4

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
Reply
#5

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);
}
}
Reply
#6

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...
Reply
#7

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.
Reply
#8

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?
Reply
#9


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

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

It doesnt work IG...
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)