SetTimerEx - 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: SetTimerEx (
/showthread.php?tid=145419)
SetTimerEx -
Torran - 02.05.2010
SetTimerEx("Question", 1000, 0, "i",
playerid);
What is the playerid for? Is that who it sets the timer for?
If i replaced playerid with a objectname or a vehicle name, Will it do it for that vehicle only?
So if i was to put
pawn Код:
CMD:RMC(playerid, params[])
{
if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, COLOR_RED, "You need to be in a vehicle to use this command");
SetTimerEx("VehRespawn", 1000, 0, "i", pVeh[0]);
SendClientMessage(playerid, COLOR_GREY, "Car respawning in 1 second.");
return 1;
}
forward VehRespawn(vehicleid);
public VehRespawn(vehicleid)
{
SetVehicleToRespawn(vehicleid);
return 1;
}
Would that respawn pVeh[0] when the timer has finished?
Re: SetTimerEx -
dice7 - 02.05.2010
The fourth argument in SetTimerEx means what kind of data is passed to the calling function (d or i for integers, s for strings, etc). The fifth argument stands as the data you're trying to pass to the function the timer is calling.
pawn Код:
SetTimerEx("PrintString", 1000, 0, "s", "This will be printed");
forward PrintString(str[]);
public PrintString[str[]]
{
printf("%s", str);
}
///////////
public OnPlayerDisconnect(playerid, reason)
{
SetTimerEx("DisReason", 1000, false, "dd", playerid, reason);
return 1;
}
forward DisReason(playerid, disreason);
public DisReason(playerid, disreason) // <-- in other words, the values of these variables will be the same as the ones you put in the timer
{
printf("Playerid %d got disconnected. Reason: %d.", playerid, disreason);
}
Re: SetTimerEx -
Torran - 02.05.2010
Ohh right. Ty