[HELP] Calling a callback in a public timer ?
#1

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
Reply
#2

pawn Код:
public NextMap()
{
    for(new i = 0; i < GetMaxPlayers; i ++)
    {
        // Other stuff... if you have playerid change to i...
        GiveStuffs(i);
    }
    return 1;
}
Reply
#3

Thanks a lot !
one more thing : should I change public GiveStuffs(playerid) to GiveStuffs(i) too or not ?
Reply
#4

no dont change
pawn Код:
public GiveStuffs(playerid)
Reply
#5

Thanks guys resolved
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)