SA-MP Forums Archive
Save pickup in .cfg - 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: Save pickup in .cfg (/showthread.php?tid=456507)



Save pickup in .cfg - gabitzu4ever - 06.08.2013

Hello.

I created a script to load it. Running oky.
pawn Код:
stock LoadPickup()
{
    new arrCoords[7][128];
    new strFromFile2[256];
    new string[128];
    new File: file = fopen("pickup.cfg", io_read);
    if (file)
    {
        new idx;
        while (idx < sizeof(PickupInfo))
        {
            fread(file, strFromFile2);
            split(strFromFile2, arrCoords, '|');
            PickupInfo[idx][pModel] = strval(arrCoords[0]);
            PickupInfo[idx][pType] = strval(arrCoords[1]);
            PickupInfo[idx][pX] = floatstr(arrCoords[2]);
            PickupInfo[idx][pY] = floatstr(arrCoords[3]);
            PickupInfo[idx][pZ] = floatstr(arrCoords[4]);
            strmid(PickupInfo[idx][pDiscription], arrCoords[5], 0, strlen(arrCoords[5]), 255);
            PickupInfo[idx][pID] = strval(arrCoords[6]);
           
            format(string, sizeof(string), "Model: %d | Type: %d | X: %d | Y: %d | Z: %d | Discription: %s | ID: %d",
            PickupInfo[idx][pModel],
            PickupInfo[idx][pType],
            PickupInfo[idx][pX],
            PickupInfo[idx][pY],
            PickupInfo[idx][pZ],
            PickupInfo[idx][pDiscription],
            PickupInfo[idx][pID]);
            LoadPickupLog(string);
           
            CreatePickup(PickupInfo[idx][pModel],PickupInfo[idx][pType],PickupInfo[idx][pX],PickupInfo[idx][pY],PickupInfo[idx][pZ]);
            Create3DTextLabel(PickupInfo[idx][pDiscription],0x006400FF,PickupInfo[idx][pX], PickupInfo[idx][pY], PickupInfo[idx][pZ]+1,15,0,1);
            idx++;
        }
        printf("[ZONEK RPG] Au fost incarcate %d Pickup !",idx);
        fclose(file);
    }
    return 1;
}
Now I placed an order which I make in the game. But I do not know how to save them.

pawn Код:
if(strcmp(cmd, "/createpickup", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            if(PlayerInfo[playerid][pAdmin] <= 1337)
            {
                SendClientMessage(playerid, COLOR_WHITE, " Trebuie sa ai admin 1337!");
                return 1;
            }
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, COLOR_GRAD1, "Foloseste: /createpickup [pickup id]");
                return 1;
            }
            moneys = strval(tmp);
            new Float:x1,Float:y1,Float:z1;
            GetPlayerPos(playerid,x1,y1,z1);
            new pickupid;
            pickupid = CreatePickup(moneys,23,x1,y1,z1);
            format(string, sizeof(string), "Pickup id %d creat.",pickupid);
            SendClientMessage(playerid, COLOR_GRAD1, string);
        }
        return 1;
    }
Any opinions?