save weapons
#1

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;
}
Reply
#2

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

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..
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)