Timer problem - 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: Timer problem (
/showthread.php?tid=132161)
Timer problem -
gangstajoe - 06.03.2010
I want to make a time-out script.
That teleports someone (on command) to a place, and i want that after like 30 seconds, it teleport auto. to a place, but it don't work.
I tried this with the timer, that don't work.
Someone know what to do?
The code:
Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
new cmd[256];
new idx;
cmd = strtok(cmdtext, idx);
if(!IsPlayerAdmin(playerid)) return 0;
if (strcmp(cmd, "/timeout", true) == 0)
{
new tmp[256];
tmp = strtok( cmdtext, idx );
if ( !strlen( tmp ) ) { return 1; }
if ( GetPlayerid( strval(tmp) ) )
{
SetPlayerInterior(strval(tmp), 6);
SetPlayerPos(strval(tmp), 264.6288,77.5742,1001.0391);
SendClientMessage(strval(tmp), COLOR_BRIGHTRED,"You got a time out");
SetTimer("timer", 30000, false);
}
}
public timer()
{
SetPlayerInterior(strval(tmp), 0);
SetPlayerPos(strval(tmp), 1546,-1676,14);
}
Re: Timer problem -
Pawel2k9 - 06.03.2010
try this
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
new cmd[256];
new idx;
cmd = strtok(cmdtext, idx);
if(!IsPlayerAdmin(playerid))
{
if (strcmp("/timeout", cmdtext, true, 10) == 0)
{
SetPlayerInterior(playerid, 6);
SetPlayerPos(playerid, 264.6288,77.5742,1001.0391);
SendClientMessage(playerid, COLOR_BRIGHTRED,"You got a time out");
SetTimerEx("timer", 30000, 0, "i", playerid);
}
}
return 0;
}
pawn Код:
public timer(playerid)
{
SetPlayerInterior(playerid, 0);
SetPlayerPos(playerid, 1546,-1676,14);
}
And remember the way you made it its only for a recon admin so remember to /rcon login [pass] before you use it.
Re: Timer problem -
gangstajoe - 06.03.2010
Quote:
Originally Posted by Pawel2k9
try this
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[]) { new cmd[256]; new idx; cmd = strtok(cmdtext, idx); if(!IsPlayerAdmin(playerid)) { if (strcmp("/timeout", cmdtext, true, 10) == 0) { SetPlayerInterior(playerid, 6); SetPlayerPos(playerid, 264.6288,77.5742,1001.0391); SendClientMessage(playerid, COLOR_BRIGHTRED,"You got a time out"); SetTimerEx("timer", 30000, 0, "i", playerid); } } return 0; }
pawn Код:
public timer(playerid) { SetPlayerInterior(playerid, 0); SetPlayerPos(playerid, 1546,-1676,14); }
And remember the way you made it its only for a recon admin so remember to /rcon login [pass] before you use it.
|
Thank you, it works now