SA-MP Forums Archive
help =D - 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: help =D (/showthread.php?tid=199883)



help =D - MestreKiller - 16.12.2010

pawn Код:
dcmd_buyhouse(playerid,params[])
{
    #pragma unused params
    new pName[MAX_PLAYER_NAME],string[128],file[128],string2[64];
    for(new i = 0; i < MAX_HOUSES; i++)
    {
        if(!IsPlayerInRangeOfPoint(playerid, 3, HInfo[i][HX], HInfo[i][HY], HInfo[i][HZ])) continue;
        if(HInfo[i][owned] != 0) return SendClientMessage(playerid,red,"Error: This house is owned");
        if(GetPlayerMoney(playerid) < HInfo[i][price]) return SendClientMessage(playerid,red,"Error: You dont have enough money");
        format(file,sizeof(file),"HouseSystem/Houses/%d.ini",i);
        format(string2,sizeof(string2),"%s",pName);
        GetPlayerName(playerid,pName,sizeof(pName));
        HInfo[i][owned] = 1;
        HInfo[i][ownername] = string2;
        dini_Set(file, "Ownername", pName);
        dini_IntSet(file, "Owned", 1);
        format(string,sizeof(string),"||- Info: %s has bought a house for %d -||",pName,HInfo[i][price]);
        SendClientMessageToAll(0xF50ACCFF,string);
        GivePlayerMoney(playerid, - HInfo[i][price]);
        return 1;
    }
    SendClientMessage(playerid, 0xF60000AA, "You are not close enough to a house");
    return 1;
}
pawn Код:
HInfo[i][ownername] = string2;
Quote:

C:\Users\Carlos\Desktop\New folder\filterscripts\housesystem.pwn(94) : error 006: must be assigned to an array
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
1 Error.




Re: help =D - [XA]PuNi$HeR_ - 17.12.2010

not so sure im gonna have a look ill post on here if i can help


Re: help =D - blackwave - 17.12.2010

Change
pawn Код:
new string2[64];
FOR
pawn Код:
new string2;



Re: help =D - Benjo - 17.12.2010

Just replace the error line with this (you'll kick yourself :P):
pawn Код:
format(HInfo[i][ownername], sizeof(HInfo[i][ownername]), "%s", string2);
EDIT: Although I don't see a need for string2, you could just as easily remove string2 and do:
pawn Код:
format(HInfo[i][ownername], sizeof(HInfo[i][ownername]), "%s", pName);