[SOLVED] Need help about Dini_Get
#1

Hello, I'm a bit of a noob when it comes to dini and such.. I'm having a problem where I get this error:
Код:
error 033: array must be indexed (variable "owner") // LINE 2937
all the time.

This is the code:
pawn Код:
if(strcmp(cmd,"/sellprop",true)==0)
    {
    if(loggedin[playerid]) {
    new
      id = propPickups[lastPickup[playerid]],
        ids[256],
        owner[256],
        propcost,
      Float:x,
        Float:y,
        Float:z;
    format(ids,sizeof(ids),"%d", id);
    propcost = dini_Int("propertycost.ini",ids);
    GetPropertyEntrance( id, x, y, z );
    if( IsPlayerInRangeOfPoint( playerid, 3.0, x, y, z )){
    if(ownedprops[playerid]>=1) {
    owner = dini_Get("propertyowners.ini",ids);
    if(owner == PlayerName(playerid)) { // LINE 2937
    GivePlayerMoney(playerid, propcost);
    dini_IntSet("propertyowners.ini",ids,0);
    ownedprops[playerid]--;
    dini_IntSet(playerfile[playerid],"ownedprops",ownedprops[playerid]);
    format( string, 128, "You sold your property %d for %d$", id, propcost);
    SendClientMessage(playerid, C_YELLOW, string );
    }
    }
    }
    }
    }
Reply
#2

Which line does the error refers to?
Reply
#3

pawn Код:
if(owner == PlayerName(playerid))
This is not how strings can be compared in Pawn, please use strcmp function (string compare), like so:

pawn Код:
if(strcmp(owner,PlayerName(playerid),true) == 0)
{
//This means its the same
}
Reply
#4

JaTochNietDan, Thanks! It works now
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)