Y INI Saving accessories - 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: Y INI Saving accessories (
/showthread.php?tid=326652)
Y INI Saving accessories -
ryansheilds - 18.03.2012
I scripted an accessory system for my script, everything works fine except it doesn't save, you can receive accessory in game with scripted command but it just doesn't save, there are 4 slots that a player can fill, although the saving system I created works, it just leaves the output as 0 or on floats 0.0.
Heres the saving part:
pawn Код:
...erInfo[playerid][pFlag]);
INI_WriteString(File,"IP",PlayerInfo[playerid][pIP]);
INI_SetTag(File,"accessorys");
for(new v = 0; v < MAX_ACCESSORIES; v++)
{
INI_WriteInt(File,"ModelID",PlayerAccessoryInfo[playerid][v][paModelID]);
INI_WriteInt(File,"Bone",PlayerAccessoryInfo[playerid][v][paBone]);
INI_WriteFloat(File,"PosX",PlayerAccessoryInfo[playerid][v][paPosX]);
INI_WriteFloat(File,"PosY",PlayerAccessoryInfo[playerid][v][paPosY]);
INI_WriteFloat(File,"PosZ",PlayerAccessoryInfo[playerid][v][paPosZ]);
INI_WriteFloat(File,"RotX",PlayerAccessoryInfo[playerid][v][paRotX]);
INI_WriteFloat(File,"RotY",PlayerAccessoryInfo[playerid][v][paRotY]);
INI_WriteFloat(File,"RotZ",PlayerAccessoryInfo[playerid][v][paRotZ]);
}
Heres a little example of giving a accessory:
pawn Код:
CMD:vest(playerid, params[])
{
if (PlayerInfo[playerid][pAdmin] < 5)
{
SendClientMessage(playerid, COLOR_GREY, "This command is for admins only!.");
return 1;
}
new string[128], giveplayerid, slot;
if(sscanf(params, "uds[64]", giveplayerid, slot)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /vest [playerid] [slot(0-4)]");
PlayerAccessoryInfo[giveplayerid][slot][paModelID] = 19142;
PlayerAccessoryInfo[giveplayerid][slot][paBone] = 1;
PlayerAccessoryInfo[giveplayerid][slot][paPosX] = 0.07998;
PlayerAccessoryInfo[giveplayerid][slot][paPosY] = 0.03999;
PlayerAccessoryInfo[giveplayerid][slot][paPosZ] = 0.0;
PlayerAccessoryInfo[giveplayerid][slot][paRotX] = 0.0;
PlayerAccessoryInfo[giveplayerid][slot][paRotY] = 0.0;
PlayerAccessoryInfo[giveplayerid][slot][paRotZ] = 0.0;
format(string, sizeof(string), "You have been given a police vest in slot %d", slot);
SendClientMessage(giveplayerid, WHITE, string);
format(string, sizeof(string), "You have given %s a police vest in slot %d", GetPlayerNameRP(giveplayerid), slot);
SendClientMessage(playerid, COLOR_WHITE, string);
return 1;
}
This command works and gives you a accessory, but on relog its gone.