SA-MP Forums Archive
undefined symbol i - 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: undefined symbol i (/showthread.php?tid=469339)



undefined symbol i - efrim123 - 12.10.2013

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.



Re: undefined symbol i - Scrillex - 12.10.2013

new i[MAX_PLAYERS];

Explanation i = playerid...


Re: undefined symbol i - Patrick - 12.10.2013

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;
}



Re: undefined symbol i - efrim123 - 12.10.2013

NVM fixed