SA-MP Forums Archive
gun save? - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: gun save? (/showthread.php?tid=116951)



gun save? - WardenCS - 30.12.2009

how to make guns save?if someone reconnects the gun will save?thanks


Re: gun save? - WardenCS - 30.12.2009

BUMP!!


Re: gun save? - MadeMan - 30.12.2009

You can use Dini. http://dracoblue.net/download/dini-16/35/

Note: This is an example. You can't just copy and paste!

pawn Код:
public OnPlayerConnect(playerid)
{
    new pName[24], filename[36];
    GetPlayerName(playerid, pName, 24);
    format(filename, sizeof(filename), "%s.ini", pName);
    new weaponid = dini_Int(filename, "Weapon");
    new ammo = dini_Int(filename, "Ammo");
    GivePlayerWeapon(playerid, weaponid, ammo);
    return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
    new pName[24], filename[36];
    GetPlayerName(playerid, pName, 24);
    format(filename, sizeof(filename), "%s.ini", pName);
    dini_IntSet(filename, "Weapon", GetPlayerWeapon(playerid));
    dini_IntSet(filename, "Ammo", GetPlayerAmmo(playerid));
    return 1;
}