SA-MP Forums Archive
Saving problem - 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)
+--- Thread: Saving problem (/showthread.php?tid=415615)



Saving problem - Noles2197 - 13.02.2013

When I /createhouse somewhere it saves in the Scriptfiles only once as %i

pawn Код:
#define HousePath "Houses/%i.ini"

new hCount;

CMD:createhouse(playerid, params[])
{
    if(pInfo[playerid][Admin]==3)
    {
        new hPrice,id=hCount;
        if(sscanf(params,"i",hPrice)) return SendClientMessage(playerid,COLOR_GRAY,"USAGE: /createhouse [price]");
        new Float:x,Float:y,Float:z;
        GetPlayerPos(playerid,x,y,z);
        hInfo[id][Price] = hPrice;
        hInfo[id][Owned] = 0;
        hInfo[id][Xpos] = x;
        hInfo[id][Ypos] = y;
        hInfo[id][Zpos] = z;
        hInfo[id][World] = GetPlayerVirtualWorld(playerid);
        format(hInfo[id][Owner],24,"Dale");
        SendClientMessage(playerid,-1,"House created");
        hEnter[id] = CreateDynamicCP(x,y,z,1.5,GetPlayerVirtualWorld(playerid));
        hExit[id] = CreateDynamicCP(443.9237,509.4609,1001.4195,1.5,GetPlayerVirtualWorld(playerid));
       
        new str[100];
        new INI:file = INI_Open(HousePath);
        INI_WriteInt(file,"Price",hPrice);
        INI_WriteInt(file,"Owned",0);
        INI_WriteFloat(file,"Xpos",x);
        INI_WriteFloat(file,"Ypos",y);
        INI_WriteFloat(file,"Zpos",z);
        INI_WriteInt(file,"World",GetPlayerVirtualWorld(playerid));
        INI_WriteString(file,"Owner","Dale");
        INI_Close(file);
        format(str,sizeof(str),"Owned: No \nPrice: $%i",hPrice);
        hInfo[id][Label] = Create3DTextLabel(str,COLOR_GREEN,x,y,z,7,GetPlayerVirtualWorld(playerid));
        hCount++;
    }
    return 1;
}



Re: Saving problem - austin070 - 13.02.2013

My guess is
Quote:
Originally Posted by ******
pawn Код:
new
    // The name of the file, can be any string variable or literal.
    fileToWrite[] = "mine.INI",
   
    // "INI_Open" returns a variable with tag "INI".
    INI:iniFile = INI_Open(fileToWrite);



Re: Saving problem - macparas - 14.02.2013

How to get capture point? can someone help me to get that script? please ...


Re: Saving problem - ]Rafaellos[ - 14.02.2013

Try change "#define HousePath "Houses/%i.ini" to #define HousePath "Houses/%s.ini"