01.04.2015, 20:12
to com esse sistema de quando um player esta com armas e sai do server, ele salva as armas, e quando o player volta ele esta com essas armas que salvaram, mais quando morre nгo perde essas armas, ja tentei por ResetPlayerWeapons mais ele nгo reseta..
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;
}