SA-MP Forums Archive
save weapons - 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 weapons (/showthread.php?tid=569690)



save weapons - StarPeens - 01.04.2015

how i can create when player die, remove all weapons, and save the txt file player no longer has weapons? when i die, he continue with weapons.

i already try use ResetPlayerWeapons but he set the weapon yet..

pawn Код:
stock LoadWeapons(playerid)
{
    new pname[MAX_PLAYER_NAME];
    if(!GetPlayerName(playerid, pname, MAX_PLAYER_NAME)) return false;
    if(!udb_Exists(pname)) udb_Create(pname, "weapons");
    for(new wep[8], amm[6], i; i < 13; i++)
    {
        format(amm, sizeof amm, "Ammo%d", i);
        format(wep, sizeof wep, "Weapon%d", i);
        GiveGunEx(playerid, dUserINT(pname).(wep), dUserINT(pname).(amm));
    }
    return true;
}

stock SaveWeapons(playerid)
{
    new pname[MAX_PLAYER_NAME];
    if(!GetPlayerName(playerid, pname, MAX_PLAYER_NAME)) return false;
    if(!udb_Exists(pname)) udb_Create(pname, "weapons");
    for(new wep[8], amm[6], i, cwep, camm; i < 13; i++)
    {
        format(amm, sizeof amm, "Ammo%d", i);
        format(wep, sizeof wep, "Weapon%d", i);
        GetPlayerWeaponData(playerid, i, cwep, camm);
        dUserSetINT(pname).(amm, camm);
        dUserSetINT(pname).(wep, cwep);
    }
    return true;
}



Re: save weapons - nezo2001 - 01.04.2015

Use ResetPlayerWeapon under OnPlayerSpawn and re-explain the other part I can't unserstand


Re: save weapons - StarPeens - 01.04.2015

Quote:
Originally Posted by nezo2001
Посмотреть сообщение
Use ResetPlayerWeapon under OnPlayerSpawn and re-explain the other part I can't unserstand
wtf? why i will put it on onplayerspawn if i have one system of save weapon? read the topic..