SetTimerEx
#1

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

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

Ohh right. Ty
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)