undefined symbol i
#1

Hello i am using a code and it shows me this error

my code:
pawn Код:
public Server()
{
   if(GetPVarInt(i, "HasSTD") == 1 && GetPVarInt(i, "Spawned") == 1 && health > 5 && IsPlayerConnected(i) && GetPVarInt(i, "HealthDown") == 0)
   {
      SetPlayerHealth(i, health-5);
      SetPVarInt(i, "HealthDown",30);
   }
   if(GetPVarInt(i, "HasSTD") == 1 && GetPVarInt(i, "Spawned") == 1 && health <=5 && IsPlayerConnected(i))
   {
      new string[200];
      format(string, 200, "%s has died from infection.", PlayerInfo(i));
      SendClientMessageToAll(COLOR_GREY, string);
      SetPlayerHealth(i, -1);
      DeletePVar(i, "HasSTD");
      DeletePVar(i, "HealthDown");
   }
   return 1;
}
Код:
C:\Program Files (x86)\Microsoft Power\GTA San Andreas\TeamDeathMatch\gamemodes\CNR.pwn(1357) : error 017: undefined symbol "i"
C:\Program Files (x86)\Microsoft Power\GTA San Andreas\TeamDeathMatch\gamemodes\CNR.pwn(1359) : error 017: undefined symbol "i"
C:\Program Files (x86)\Microsoft Power\GTA San Andreas\TeamDeathMatch\gamemodes\CNR.pwn(1360) : error 017: undefined symbol "i"
C:\Program Files (x86)\Microsoft Power\GTA San Andreas\TeamDeathMatch\gamemodes\CNR.pwn(1362) : error 017: undefined symbol "i"
C:\Program Files (x86)\Microsoft Power\GTA San Andreas\TeamDeathMatch\gamemodes\CNR.pwn(1365) : error 012: invalid function call, not a valid address
C:\Program Files (x86)\Microsoft Power\GTA San Andreas\TeamDeathMatch\gamemodes\CNR.pwn(1365) : error 017: undefined symbol "i"
C:\Program Files (x86)\Microsoft Power\GTA San Andreas\TeamDeathMatch\gamemodes\CNR.pwn(1365) : error 029: invalid expression, assumed zero
C:\Program Files (x86)\Microsoft Power\GTA San Andreas\TeamDeathMatch\gamemodes\CNR.pwn(1365) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


8 Errors.
Reply
#2

new i[MAX_PLAYERS];

Explanation i = playerid...
Reply
#3

Here you go
pawn Код:
public Server()
{
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(GetPVarInt(i, "HasSTD") == 1 && GetPVarInt(i, "Spawned") == 1 && health > 5 && IsPlayerConnected(i) && GetPVarInt(i, "HealthDown") == 0)
        {
            SetPlayerHealth(i, health-5);
            SetPVarInt(i, "HealthDown",30);
        }
        if(GetPVarInt(i, "HasSTD") == 1 && GetPVarInt(i, "Spawned") == 1 && health <=5 && IsPlayerConnected(i))
        {
            new string[200];
            format(string, 200, "%s has died from infection.", PlayerInfo(i));
            SendClientMessageToAll(COLOR_GREY, string);
            SetPlayerHealth(i, -1);
            DeletePVar(i, "HasSTD");
            DeletePVar(i, "HealthDown");
        }
    }
    return 1;
}
Reply
#4

NVM fixed
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)