SA-MP Forums Archive
Command Not Saving - 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: Command Not Saving (/showthread.php?tid=452600)



Command Not Saving - San1 - 21.07.2013

No Errors at all, Everything is right, But problem is Stuff is not Saving..
pawn Код:
CMD:createbiz(playerid, params[])
{
    new bizid, price, type, string[128], Float:x, Float:y, Float:z;
    if(PlayerInfo[playerid][pAdmin] < 5) return SCM(playerid, COLOR_RED, "You are not authorized to use this command");
    if(sscanf(params,"ddd", bizid, price, type)) SendClientMessage(playerid, COLOR_FADE3, "/createbiz [bizid] [price] [biz type]");
    new file[40];
    format(file, sizeof(file), BPATH, bizid);
    if(fexist(file)) return SendClientMessage(playerid, COLOR_GRAD2, "This Business ID is not available.");
    if(bizid >= MAX_BIZ) return SendClientMessage(playerid, COLOR_GRAD2, "MAX_BIZ is reached. Please increase MAX_BIZ.");
    if(type < 1 || type > 3) return SendClientMessage(playerid, COLOR_GRAD2, "Choose a type between 1 and 3.");
    else
    {
        new INI:File = INI_Open(file);// This Stuff not Saving
        INI_SetTag(File,"data");
        GetPlayerPos(playerid, x, y, z);
        INI_WriteFloat(File,"xCoord",x);
        INI_WriteFloat(File,"yCoord",y);
        INI_WriteFloat(File,"zCoord",z);
        INI_WriteInt(File,"Products",0);
        INI_WriteInt(File,"Type",type);
        INI_WriteInt(File,"Vault",0);
        INI_WriteInt(File,"Owned",0);
        INI_WriteInt(File,"Price",price);
        INI_WriteInt(File,"Locked",0);
        INI_WriteString(File,"Owner","The State"); // Stuff Ends HEere = None of this is Saving at all
       
        if(type == 1)
        {
            INI_WriteFloat(File, "ix", -26.691598);
            INI_WriteFloat(File, "iy", -55.714897);
            INI_WriteFloat(File, "iz", 1003.546875);
            INI_WriteInt(File, "Int", 6);

            SetGlobalMapIcon(idmap, x, y, z, 17, 0, MAPICON_LOCAL);
        }
        if(type == 2)
        {
            INI_WriteFloat(File, "ix", 314.820983);
            INI_WriteFloat(File, "iy", -141.431991);
            INI_WriteFloat(File, "iz", 999.601562);
            INI_WriteInt(File, "Int", 7);
            SetGlobalMapIcon(idmap, x, y, z, 18, 0, MAPICON_LOCAL);
        }
        if(type == 3)
        {
            INI_WriteFloat(File, "ix", 207.737991);
            INI_WriteFloat(File, "iy", -109.019996);
            INI_WriteFloat(File, "iz", 1005.132812);
            INI_WriteInt(File, "Int", 15);
            SetGlobalMapIcon(idmap, x, y, z, 45, 0, MAPICON_LOCAL);
        }
        INI_Close(File);
        SaveBiz(bizid);
        INI_ParseFile(string,"LoadBiz_%s", .bExtra = true, .extra = bizid);
        format(string,sizeof(string),"You've created Business ID %d", bizid);
        SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
    }
    return 1;
}



Re: Command Not Saving - IceCube! - 22.07.2013

Remove SaveBiz (from this command only!). Your likely overwriting the input of this as the Biz is already being saved. Try that and report back results.

Also show us your ini file after


Re: Command Not Saving - San1 - 22.07.2013

Alright it works, But When I create it, It dont spawn the pickup and 3d Text, And it only saves this stuff when i Disconnect, Weird