Auto CarFix - 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 CarFix (
/showthread.php?tid=627989)
Auto CarFix -
nahum2003 - 04.02.2017
Hello everyone, i am making a new gamemode, but i want add a Auto Car Fix, when admin enter on duty.
Код:
if(PlayerInfo[playerid][OnDuty] == 1)
Can you guys help me? Thanks
Re: Auto CarFix -
BiosMarcel - 04.02.2017
PHP код:
if(PlayerInfo[playerid][OnDuty] == 1)
{
ReapairVehicle(GetPlayerVehicleID(playerid));
}
Pretty easy ... use the wiki next time, ****** or try thinking for yourself.
If you meant automatically repair it, as soon as it gets damage, you might just want to use OnPlayerUpdate or a player timer
Re: Auto CarFix -
princejeet1510 - 04.02.2017
FFS.....Why making trillions of thread an not using the search forums option on topics which are already there....
I personally suggest open ****** it's a search engine and will provide you every info with example and everything......
Please next time do some research...
Respuesta: Re: Auto CarFix -
nahum2003 - 04.02.2017
Quote:
Originally Posted by princejeet1510
FFS.....Why making trillions of thread an not using the search forums option on topics which are already there....
I personally suggest open ****** it's a search engine and will provide you every info with example and everything......
Please next time do some research...
|
Yes, buttt.... I just found useles topics. And i want Auto CarFix when it get damage, i found one with OnPlayerUpdate but that topic is down XD anyway, Thanks.
Re: Auto CarFix -
haikalbintang - 04.02.2017
Intresting, maybe you can try this :
PHP код:
new repairtimer[MAX_PLAYERS];
forward AutoRepair(playerid);
public AutoRepair(playerid);
{
RepairVehicle(GetPlayerVehicleID(playerid));
return 1;
}
public OnPlayerStateChange(playerid, newstate, oldstate)
{
if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
if(PlayerInfo[playerid][OnDuty] == 1)
{
repairtimer[playerid] = SetTimerEx("AutoRepair", 1000, 1, "u", playerid);
}
}
if(GetPlayerState(playerid) == PLAYER_STATE_ONFOOT)
{
if(PlayerInfo[playerid][OnDuty] == 1)
{
KillTimer(repairtimer[playerid]);
}
}
return 1;
}
I hope this will help you
Respuesta: Re: Auto CarFix -
nahum2003 - 04.02.2017
Quote:
Originally Posted by haikalbintang
Intresting, maybe you can try this :
PHP код:
new repairtimer[MAX_PLAYERS];
forward AutoRepair(playerid);
public AutoRepair(playerid);
{
RepairVehicle(GetPlayerVehicleID(playerid));
return 1;
}
public OnPlayerStateChange(playerid, newstate, oldstate)
{
if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
if(PlayerInfo[playerid][OnDuty] == 1)
{
repairtimer[playerid] = SetTimerEx("AutoRepair", 1000, 1, "u", playerid);
}
}
if(GetPlayerState(playerid) == PLAYER_STATE_ONFOOT)
{
if(PlayerInfo[playerid][OnDuty] == 1)
{
KillTimer(repairtimer[playerid]);
}
}
return 1;
}
I hope this will help you
|
Thanks mate!! You really helped me. Take your +REP