error 033 giving rep
#1

well i have made a command to give the player -pot,like take pot from him and he is offline,i made:
pawn Code:
CMD:opot(playerid, params[])
{
    new pot[128], target[MAX_PLAYER_NAME], amount;
    if(pInfo[playerid][pAdminLevel] >= 1)
    {
        if(!sscanf(params, "s[128]d", target, amount))
        {
            format(targetname, sizeof(targetname), "%s.ini",target);
            if(dini_Exists(target))
            {
                        pot = dini_Get(targetname, "Pot");
                dini_IntSet(target, "Pot", pot-amount);
                return 1;
            }
            else
            {
                SendClientMessage(playerid, COLOR_GRAD2, "That player does not exist!");
            }
        }
        else
        {
            SendClientMessage(playerid, COLOR_WHITE, "USAGE: /opot [full name] [amount]");
        }
    }
    else
    {
        SendClientMessage(playerid, COLOR_GRAD1, "   You are not authorized to use that command !");
    }
    return 1;
}
and iget this error:
pawn Code:
error 033: array must be indexed (variable "pot")
what to do?
Reply
#2

Pot is a string, not an integer, you should use

pawn Code:
dini_IntSet(target, "Pot", strval(pot) - amount);
Oh yeah, I doubt you give any positive rep.
Reply
#3

I will try it if it works i will give you 2 reps !!!!!!
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)