[HELP] Calling a callback in a public timer ? - 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: [HELP] Calling a callback in a public timer ? (
/showthread.php?tid=476616)
[HELP] Calling a callback in a public timer ? -
Saw® - 19.11.2013
Hi , I've scripted a timer that calls each 1 sec my map change system
so I wanted to set pos/give weapons for teams in the MapChange system....
this is why I have this callback
pawn Код:
public GiveStuffs(playerid) // Here I give weapons/setposition...
{
GivePlayerWeapon(playerid,5000); //exemple
SetPlayerPos(playerid,bla,bla,bla);
return 1;
}
-Now the map change system
pawn Код:
public NextMap() // this is a map change system I call this callback each 1 sec
{
//codes....
GiveStuffs(playerid); // I get an error in that line because playerid isn't defined
return 1;
}
How to fix that error ? "NextMap" is a public timer for everyone .... how to make it knows the playerid ? should I use a boucle ?
thanks
Re: [HELP] Calling a callback in a public timer ? -
Dragonsaurus - 19.11.2013
pawn Код:
public NextMap()
{
for(new i = 0; i < GetMaxPlayers; i ++)
{
// Other stuff... if you have playerid change to i...
GiveStuffs(i);
}
return 1;
}
Re: [HELP] Calling a callback in a public timer ? -
Saw® - 19.11.2013
Thanks a lot !
one more thing : should I change public GiveStuffs(playerid) to GiveStuffs(i) too or not ?
Re: [HELP] Calling a callback in a public timer ? -
JeaSon - 19.11.2013
no dont change
pawn Код:
public GiveStuffs(playerid)
Re: [HELP] Calling a callback in a public timer ? -
Saw® - 19.11.2013
Thanks guys resolved