Error in /seen command
#1

Hi, whats wrong with this command?

im getting this error
Код:
error 033: array must be indexed (variable "tmp")
pawn Код:
if(strcmp(cmd, "/seen", true)==0)
    {
        if(IsPlayerConnected(playerid))
        {
            if (PlayerInfo[playerid][pAdmin] & ADMIN_WAR)
            {
                tmp = strtok(cmdtext, idx);
                if(!strlen(tmp))
                {
                    SendClientMessage(playerid, COLOR_GRAD2, "{F7FF61}Usage:"COL_WHITE" /seen [full_name(case sensitive)]");
                    return 1;
                }
                GetPlayerName(playerid, sendername, sizeof(sendername));
                format(string,sizeof(string),"%s%s.ini", USERS_PATH, tmp);    
                if(fexist(string))
                {
                    format(string, sizeof(string), "%s last seen on %d of d d @ d:d", tmp, PlayerInfo[tmp][LastLoginDay],PlayerInfo[tmp][LastLoginMonth],PlayerInfo[tmp][LastLoginYear],PlayerInfo[tmp][LastLoginMinute],PlayerInfo[tmp][LastLoginHour]);
                    ABroadCast(COLOR_LIGHTRED,string,1);
                }
                else
                {
                    SendClientMessage(playerid, COLOR_GRAD2, "   That account name doesn't exist !");
                }

            }
            else
            {
                SendClientMessage(playerid, GREY, AdminOnly);
            }
        }
        return 1;
    }
Reply
#2

The tmp must be like that: tmp[24] or MAX_PLAYER_NAME which is 24 as well. Also, the PlayerInfo[tmp] , the tmp must be a number(Integer) but this one is a string. I suggest to store this in a variable you create inside the command.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)