SA-MP Forums Archive
array must be indexed help - 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: array must be indexed help (/showthread.php?tid=609457)



array must be indexed help - jimis - 12.06.2016

i have this code guys and i get the error on this line :
PHP код:
if(TeamInfo[i][tName] == PlayerName(playerid)) 
error is that: error 033: array must be indexed (variable "PlayerName")
TeamInfo[i][tName] this contain the player name into an .ini text file , i am using dini ,
PHP код:
stock PlayerName(playerid)
{
    new 
pName[MAX_PLAYER_NAME];
    
GetPlayerName(playeridpNameMAX_PLAYER_NAME);
    return 
pName;

, anyone know?


Re: array must be indexed help - Sjn - 12.06.2016

Strings cannot be checked like that, use strcmp


Re: array must be indexed help - jimis - 12.06.2016

Quote:
Originally Posted by Sjn
Посмотреть сообщение
Strings cannot be checked like that, use strcmp
ok thanks i did it, now i dont have errors, but now the problem is that when i type /og take "Not access" as message but it should open the gates, , the tName into .ini is exactly the same as the player name, whats wrongg?
This is my code
PHP код:
strmid(TeamInfo[i][tName], dini_Get(file"Name"), falsestrlen(dini_Get(file"Name")), MAX_PLAYER_NAME);
if(
strcmp(TeamInfo[i][tName], PlayerName(playerid)))
            {
                
found true;
                if(
TeamInfo[i][tMember] == 1)
                {
                    
MoveObject(airgate4,395.8703613,2374.1357422,25.8018494,3);
                    
MoveObject(airgate5,380.8940735,2366.1770020,25.8284874,3);
                    
AirCloseTimer[playerid] = SetTimer("AirClose"4000true);
                }
            }
        }
    }
    if(!
found) return SendClientMessage(playeridCOLOR_RED"Not Access!");