Is it possible to do this? If yes, how? -
101 - 05.01.2013
Hey guys, is it possible to pass on a ID of a player towards a timer?
Example, I do /find [ID]
That command will forward the ID to a timer and it will open a textdraw, and the textdraw will automatically update with the location of the player.
Re: Is it possible to do this? If yes, how? -
park4bmx - 05.01.2013
Yes,
how ?
pawn Код:
Command:test(playerid)
{
SetTimerEx("OnTestExec",2000,false,"i", playerid)
}
//then later on after the timers time has passed the callback
//gets called with the playerid
forward OnTestExec(playerid);
Public OnTestExec(playerid)
{
//do what ever
}
Re: Is it possible to do this? If yes, how? -
101 - 05.01.2013
Hey thanks for replying. Is it also possible to pass on the ID of the selected player? Like
/find [PLAYERID]
Then in the timer I would be able to do
GetPlayerMoney(otherplayer) and SendClientMessage(playerid)
Re: Is it possible to do this? If yes, how? -
Sasino97 - 05.01.2013
I didn't fully understand your question, but I think you need SetTimerEx.
For example:
pawn Код:
forward x(playerid);
public x(playerid)
{
//
}
// Somewhere
SetTimerEx("x", 5000, false, "i", playerid);
SetTimerEx sets a timer for callbacks with params. (funcname, interval, loop, format, param1, param2, ...)
I don't know why the sa-mp team made 2 different functions.
Re: Is it possible to do this? If yes, how? -
101 - 05.01.2013
Quote:
Originally Posted by [GF]Sasino97
I didn't fully understand your question, but I think you need SetTimerEx.
For example:
pawn Код:
forward x(playerid); public x(playerid) { // }
// Somewhere SetTimerEx("x", 5000, false, "i", playerid);
SetTimerEx sets a timer for callbacks with params. (funcname, interval, loop, format, param1, param2, ...)
I don't know why the sa-mp team made 2 different functions.
|
What I want to do here is a /locate system for police. They will be able to ./locate [ID/NAME] and it will show a textdraw on their screen that will refresh itself each 5-10 seconds which is why I need a timer. BUT in that timer, I need to be able to use both my own playerid and the ID of the player that I selected.
Re: Is it possible to do this? If yes, how? -
park4bmx - 05.01.2013
Then you need to pass two variables
pawn Код:
Command:test(playerid,params[]);
{
SetTimerEx("OnTestExec",2000,false,"ii", playerid,selectedid);
//u never gave your variable of how u retrieve the selected player but u will manage.
}
forward OnTestExec(playerid,selectedid);
public OnTestExec(playerid,selectedid)
{
//do what ever
}
Re: Is it possible to do this? If yes, how? -
101 - 05.01.2013
Quote:
Originally Posted by park4bmx
Then you need to pass to variables
pawn Код:
Command:test(playerid,params[]); { SetTimerEx("OnTestExec",2000,false,"ii", playerid,selectedid); //u never gave your variable of how u retrieve the selected player but u will manage. }
forward OnTestExec(playerid,selectedid); Public OnTestExec(playerid,selectedid) { //do what ever }
|
Thanks buddy.