Timer help - 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)
+--- Thread: Timer help (
/showthread.php?tid=594673)
Timer help -
N0FeaR - 21.11.2015
Error i get
Код:
E:\Documents and Settings\Nate\Desktop\Rebound-Roleplay\gamemodes\P-RP.pwn(3145) : error 028: invalid subscript (not an array or too many subscripts): "Pausetimer"
E:\Documents and Settings\Nate\Desktop\Rebound-Roleplay\gamemodes\P-RP.pwn(3145) : warning 215: expression has no effect
E:\Documents and Settings\Nate\Desktop\Rebound-Roleplay\gamemodes\P-RP.pwn(3145) : error 001: expected token: ";", but found "]"
E:\Documents and Settings\Nate\Desktop\Rebound-Roleplay\gamemodes\P-RP.pwn(3145) : error 029: invalid expression, assumed zero
E:\Documents and Settings\Nate\Desktop\Rebound-Roleplay\gamemodes\P-RP.pwn(3145) : fatal error 107: too many error messages on one line
pawn Код:
}
public OnPlayerPause(playerid)
{
SetTimer("Pausetimer", 600000, false); // Set a timer of 1000 miliseconds (1 second)
return 1;
}
public OnPlayerResume(playerid, time)
{
KillTimer(Pausetimer[playerid]); line 3145
SendClientMessage(playerid, COLOR_WHITE, "Welcome back!");
return 1;
}
forward Pausetimer();
public Pausetimer()
{
Kick(playerid);
return 1;
}
Re: Timer help -
Sew_Sumi - 21.11.2015
You need to read some more about Timers...
pawn Код:
new connect_timer[MAX_PLAYERS];
public OnPlayerConnect(playerid)
{
print("Starting timer...");
connect_timer[playerid] = SetTimerEx("WelcomeTimer", 5000, true, "i", playerid);
return 1;
}
public OnPlayerDisconnect(playerid)
{
KillTimer(connect_timer[playerid]);
return 1;
}
forward WelcomeTimer(playerid);
public WelcomeTimer(playerid)
{
SendClientMessage(playerid, -1, "Welcome!");
}
From the SAMP Wiki, showing that your KillTimer line, isn't how you are supposed to use it.
Re: Timer help -
N0FeaR - 21.11.2015
Quote:
Originally Posted by Sew_Sumi
You need to read some more about Timers...
pawn Код:
new connect_timer[MAX_PLAYERS]; public OnPlayerConnect(playerid) { print("Starting timer..."); connect_timer[playerid] = SetTimerEx("WelcomeTimer", 5000, true, "i", playerid); return 1; } public OnPlayerDisconnect(playerid) { KillTimer(connect_timer[playerid]); return 1; } forward WelcomeTimer(playerid); public WelcomeTimer(playerid) { SendClientMessage(playerid, -1, "Welcome!"); }
From the SAMP Wiki, showing that your KillTimer line, isn't how you are supposed to use it.
|
Thx but as u se i want it so the timer start when player pause their game that's why i using
PHP код:
public OnPlayerPause(playerid)
Re: Timer help -
Sew_Sumi - 21.11.2015
Quote:
Originally Posted by N0FeaR
Thx but as u se i want it so the timer start when player pause their game that's why i using
PHP код:
public OnPlayerPause(playerid)
|
If you actually read what I brought up, you'd not focus on the fact that the timer is created OnPlayerConnect, rather look at the error you have made, in the KillTimer line, as I said...
pawn Код:
PlayerPause[playerid] = SetTimer("Pausetimer", 600000, false); // Set a timer of 1000 miliseconds (1 second)
pawn Код:
KillTimer(PlayerPause[playerid]);
Again though, if you'd actually read what was posted, you'd have found the point, rather than simply trying to make out what I'd posted was wrong.
You, could've gone to the wiki page yourself and read up on it, but you chose not to.
Re: Timer help -
N0FeaR - 21.11.2015
Quote:
Originally Posted by Sew_Sumi
If you actually read what I brought up, you'd not focus on the fact that the timer is created OnPlayerConnect, rather look at the error you have made, in the KillTimer line, as I said...
pawn Код:
PlayerPause[playerid] = SetTimer("Pausetimer", 600000, false); // Set a timer of 1000 miliseconds (1 second)
pawn Код:
KillTimer(PlayerPause[playerid]);
Again though, if you'd actually read what was posted, you'd have found the point, rather than simply trying to make out what I'd posted was wrong.
You, could've gone to the wiki page yourself and read up on it, but you chose not to.
|
Yeah i just focus to much on that, but now i understand what u was trying to tell me, thank you so much!!
Re: Timer help -
Sew_Sumi - 22.11.2015

Good to see