Help just work for id 0
#1

i have this script
pawn Код:
SetTimer("UpdateExp", 5000, 1);

forward UpdateExp(playerid);
public UpdateExp(playerid)
{
    for (new i; i < MAX_PLAYERS; i++)
    {
//      new string[30]; // String.
        if(IsPlayerConnected(i) == 1) // Checks if player is connected.
        {
            //new points[248]; // Points.
            new nxtlevel = PlayerInfo[i][pLevel]+1; // As soon as its executed, It adds +1 to your score.
            new expamount = nxtlevel*levelexp+100; // Exp amount, Its 2 CURRENTLY but you can raise it by adding +number after levelexp
            if(PlayerInfo[i][pExp] < expamount) // Checks if player's exp amount is above the required one or not.
            {
               // format(points,sizeof(points)," You need [%d] Exp Points in order to level up, You currently have [%d]",expamount,PlayerInfo[playerid][pExp]); // Format, This is pretty obvious.
                //SendClientMessage(playerid,white,points); // Sends the message.
                return 1;
            }
            else
            {
                PlayerInfo[i][pExp] = 0; //  Sets the EXP amount to 0 as you level'd up.
                PlayerInfo[i][pLevel]++; // Adds a level.
          //      format(string,sizeof(string),"~g~Your now level:[%d]",PlayerInfo[playerid][pLevel]); // Format.
            //    GameTextForPlayer(playerid,string,6000,1); // Sends gametext about his new level'ing up.
                return 1;
            }
        }
        return 1;
    }
    return 1;
}
my problem is why that script only work for player id 0 ?
not for all player ?
thanks before .
Repp ++ for who helped
Reply
#2

replace with
PHP код:
SetTimer("UpdateExp"50001); 
to this
PHP код:
SetTimer("UpdateExp"50001,"i",playerid); 
Reply
#3

show this eror
pawn Код:
D:\xxx\gamemodes\xxx.pwn(3113) : warning 202: number of arguments does not match definition
D:\xxx\gamemodes\xxx.pwn(3113) : error 017: undefined symbol "playerid"
i put the timer ongamemodeinit
Reply
#4

Quote:
Originally Posted by Loveno
Посмотреть сообщение
show this eror
pawn Код:
D:\xxx\gamemodes\xxx.pwn(3113) : warning 202: number of arguments does not match definition
D:\xxx\gamemodes\xxx.pwn(3113) : error 017: undefined symbol "playerid"
i put the timer ongamemodeinit
Ohh okay, delete all, put this in the Public OnPlayerConnect,
PHP код:
SetTimer("UpdateExp"50001,"i",playerid); 
and this Down mode,
PHP код:
forward UpdateExp(playerid);
public 
UpdateExp(playerid)
{
        
//new points[248]; // Points.
        
new nxtlevel PlayerInfo[playerid][pLevel]+1// As soon as its executed, It adds +1 to your score.
        
new expamount nxtlevel*levelexp+100// Exp amount, Its 2 CURRENTLY but you can raise it by adding +number after levelexp
            
if(PlayerInfo[playerid][pExp] < expamount// Checks if player's exp amount is above the required one or not.
        
{
           
// format(points,sizeof(points)," You need [%d] Exp Points in order to level up, You currently have [%d]",expamount,PlayerInfo[playerid][pExp]); // Format, This is pretty obvious.
            //SendClientMessage(playerid,white,points); // Sends the message.
            
return 1;
            }
        else
        {
            
PlayerInfo[playerid][pExp] = 0//  Sets the EXP amount to 0 as you level'd up.
            
PlayerInfo[playerid][pLevel]++; // Adds a level.
            //format(string,sizeof(string),"~g~Your now level:[%d]",PlayerInfo[playerid][pLevel]); // Format.
            //GameTextForPlayer(playerid,string,6000,1); // Sends gametext about his new level'ing up.
            
return 1;
         }
    }
        return 
1;
 }
        return 
1;

Good luck.
Reply
#5

pawn Код:
SetTimerEx("UpdateExp", 5000, 1, "i", playerid);

forward UpdateExp(playerid);
public UpdateExp(playerid)
{
//* * * new string[30]; // String.
                //new points[248]; // Points.
                new nxtlevel = PlayerInfo[playerid][pLevel]+1; // As soon as its executed, It adds +1 to your score.
                new expamount = nxtlevel*levelexp+100; // Exp amount, Its 2 CURRENTLY but you can raise it by adding +number after levelexp
                if(PlayerInfo[playerid][pExp] < expamount) // Checks if player's exp amount is above the required one or not.
                {
                // format(points,sizeof(points)," You need [%d] Exp Points in order to level up, You currently have [%d]",expamount,PlayerInfo[playerid][pExp]); // Format, This is pretty obvious.
               //SendClientMessage(playerid,white,points); // Sends the message.
               return 1;
               }
               else
              {
              PlayerInfo[playerid][pExp] = 0; // *Sets the EXP amount to 0 as you level'd up.
              PlayerInfo[playerid][pLevel]++; // Adds a level.
              // format(string,sizeof(string),"~g~Your now level:[%d]",PlayerInfo[playerid][pLevel]); // Format.
             // GameTextForPlayer(playerid,string,6000,1); // Sends gametext about his new level'ing up
            }
           return 1;
            }
          return 1;
}
Reply
#6

pawn Код:
SetTimer("UpdateExp", 5000, 1);
this to this
pawn Код:
SetTimerEx("UpdateExp", 5000, true, "i", playerid);
Reply
#7

Zeus, Can you please scroll up? Your answer was already said and he(thread author) got a few errors with it..
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)