16.12.2017, 08:35
Visit samp wiki For weapon slots
look at the Slots section to know which slot that is for the weapon, as for GetPlayerWeaponData
here's the paramters (playerid, slot, &weapons, &ammo) so playerid, slot which u can get from the link i sent above and the weapon to be saved and the ammo, say i wanna save a player's weapons when he disconnects, so i'll do this:
for the 2nd question to do that with a dialogue simply format a string and set it as the dialogue like:
EDIT: this is merely an example to show you how it could work like, not an actual script to be used.
look at the Slots section to know which slot that is for the weapon, as for GetPlayerWeaponData
here's the paramters (playerid, slot, &weapons, &ammo) so playerid, slot which u can get from the link i sent above and the weapon to be saved and the ammo, say i wanna save a player's weapons when he disconnects, so i'll do this:
PHP код:
public OnPlayerDisconnect(playerid,reason)
{
new weapon[4],ammo[4];
GetPlayerWeaponData(playerid, 2, weapon[0], ammo[0]);
GetPlayerWeaponData(playerid, 3, weapon[1], ammo[1]);
GetPlayerWeaponData(playerid, 4, weapon[2], ammo[2]);
GetPlayerWeaponData(playerid, 5, weapon[3], ammo[3]);
//after that you save that weapon[0-->3] and same for ammo into the file for ex if i use DINI i will do this
dini_IntSet(file,"FirstWeapon",weapon[0]);
dini_IntSet(file,"FirstAmmo",ammo[0]);
//and so on for the rest of the ammo spots we saved
return 1;
}
PHP код:
new name[24],string[128],weapon0[15],weapon1[15];
GetPlayerName(playerid,name,sizeof(name));
GetWeaponName(weapon[0], weapon0, sizeof(weapon0));
GetWeaponName(weapon[1], weapon1,sizeof(weapon1));
format(string,sizeof(string),"%s has the weapon %s with %d ammmo and a %s with %d ammo",name,weapon0,ammo[0],weapon1,ammo[1]);
ShowPlayerDialog(playerid, 55, DIALOG_STYLE_MSGBOX, "Weapon Info", string, "Okay", "");