06.08.2013, 10:22
Hello.
I created a script to load it. Running oky.
Now I placed an order which I make in the game. But I do not know how to save them.
Any opinions?
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;
}
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;
}