timers - 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: timers (
/showthread.php?tid=398005)
timers -
Markus1337 - 07.12.2012
Error:
(207) : error 028: invalid subscript (not an array or too many subscripts): "onfoottime"
(207) : warning 215: expression has no effect
(207) : error 001: expected token: ";", but found "]"
(207) : error 029: invalid expression, assumed zero
(207) : fatal error 107: too many error messages on one line
pawn Code:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
new vehicle = GetPlayerVehicleID(playerid);
if(newstate == PLAYER_STATE_ONFOOT && isRepairing[playerid] == 1)
{
new playerveh = GetPlayerVehicleID(playerid);
SendClientMessage(playerid, COLOR_NEWS, "You left your service vehicle, you have 30 seconds to return to your vehicle");
onfoottime[playerid] = SetTimerEx("FootLocks",1000,1,"i",playerid);
onfoottime = 30; // 3 mins to repair locks.
//KillTimer(locktimer[playerid]);
TextDrawShowForPlayer(playerid,Textdraw4[playerid]);
PutPlayerInVehicle(playerid, playerveh, 0);
SetVehicleToRespawn(GetVehicleModel(playerveh));
}
Re: timers -
park4bmx - 07.12.2012
pawn Code:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
new vehicle = GetPlayerVehicleID(playerid);
if(newstate == PLAYER_STATE_ONFOOT && isRepairing[playerid] == 1)
{
new playerveh = GetPlayerVehicleID(playerid);
SendClientMessage(playerid, COLOR_NEWS, "You left your service vehicle, you have 30 seconds to return to your vehicle");
onfoottime[playerid] = SetTimerEx("FootLocks",18000,true,"i",playerid);//18000 ms is 3mins
//you can set the time by using "=" as that will reasign the timersid!
//KillTimer(locktimer[playerid]);
TextDrawShowForPlayer(playerid,Textdraw4[playerid]);
PutPlayerInVehicle(playerid, playerveh, 0);
SetVehicleToRespawn(GetVehicleModel(playerveh));
}