Timer only works on me -
nikolat007 - 26.08.2012
I made a command with timer but only works on me.....when my friend type this command nothing happens
here si my code
COMMAND
Код:
CMD:kill(playerid, params[])
{
SetTimer("kill",10000,false);
}
TIMER
Код:
forward(playerid);
public(playerid)
{
SetPlayerHealth(playerid, 0);
}
Re: Timer only works on me -
JaKe Elite - 26.08.2012
You have to use SetTimerEx if you will create a timer with parameters. so it must be like this
pawn Код:
SetTimerEx("killit", 10000, false, "d", playerid); //put this on the command, 10000 = 10 seconds, false = don't repeat, d = represent as integer, playerid = will be the integer.
forward killit(playerid);
public killit(playerid)
{
//code here
}
Re: Timer only works on me -
[MM]RoXoR[FS] - 26.08.2012
why are you using timer to kill him?
Re: Timer only works on me -
CrystalFire - 26.08.2012
I agree with [MM]RoXoR[FS]
U can simply use
pawn Код:
SetPlayerHealth(playerid, 0)
if you want to kill yourself
Re: Timer only works on me -
Sniper Kitty - 26.08.2012
Use SetTimerEx and set it to call the function SetPlayerHealth.
Creating a custom public function is not needed.
pawn Код:
CMD:kill(playerid, params[])
{
SetTimerEx("SetPlayerHealth", 10000, false, "df", playerid, 0.0);
}
Quote:
Originally Posted by [MM]RoXoR[FS]
why are you using timer to kill him?
|
Why not?
Meybe he did it for a reason, you never know.
Re: Timer only works on me -
nikolat007 - 26.08.2012
This is just example...i use timers on checkpoints of some jobs
But i made this command for testing timers

and it's usually
Re: Timer only works on me -
Sniper Kitty - 26.08.2012
Quote:
Originally Posted by nikolat007
This is just example...i use timers on checkpoints of some jobs
But i made this command for testing timers  and it's usually
|
Well then the same thing just...
pawn Код:
CMD:TestCommand(playerid, params[]) {
SetTimerEx("TestFunction", 1000, false, "d", playerid);
return true;
}
forward TestFunction(playerid);
public TestFunction(playerid) {
SendClientMessage(playerid, -1, "You just tested a timer that got sent to a external function in 1second.");
return true;
}