SA-MP Forums Archive
[SOLVED] Need help about Dini_Get - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: [SOLVED] Need help about Dini_Get (/showthread.php?tid=97312)



[SOLVED] Need help about Dini_Get - spyr0x - 13.09.2009

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



Re: [HELP] Need help about Dini_Get - x-cutter - 13.09.2009

Which line does the error refers to?


Re: [HELP] Need help about Dini_Get - JaTochNietDan - 13.09.2009

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
}



Re: [HELP] Need help about Dini_Get - spyr0x - 13.09.2009

JaTochNietDan, Thanks! It works now