GetPlayerWeaponData
#5

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:
PHP код:
public OnPlayerDisconnect(playerid,reason)
{
    new 
weapon[4],ammo[4];
    
GetPlayerWeaponData(playerid2weapon[0], ammo[0]);
    
GetPlayerWeaponData(playerid3weapon[1], ammo[1]);
    
GetPlayerWeaponData(playerid4weapon[2], ammo[2]);
    
GetPlayerWeaponData(playerid5weapon[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;

for the 2nd question to do that with a dialogue simply format a string and set it as the dialogue like:
PHP код:
new name[24],string[128],weapon0[15],weapon1[15];
GetPlayerName(playerid,name,sizeof(name));
GetWeaponName(weapon[0], weapon0sizeof(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(playerid55DIALOG_STYLE_MSGBOX"Weapon Info"string"Okay"""); 
EDIT: this is merely an example to show you how it could work like, not an actual script to be used.
Reply


Messages In This Thread
GetPlayerWeaponData - by NealPeteros - 16.12.2017, 07:50
Re: GetPlayerWeaponData - by Kane - 16.12.2017, 08:21
Re: GetPlayerWeaponData - by NealPeteros - 16.12.2017, 08:28
Re: GetPlayerWeaponData - by Kane - 16.12.2017, 08:33
Re: GetPlayerWeaponData - by RogueDrifter - 16.12.2017, 08:35
Re: GetPlayerWeaponData - by NealPeteros - 16.12.2017, 08:54
Re: GetPlayerWeaponData - by RogueDrifter - 16.12.2017, 09:01
Re: GetPlayerWeaponData - by NealPeteros - 16.12.2017, 09:14
Re: GetPlayerWeaponData - by RogueDrifter - 16.12.2017, 09:19
Re: GetPlayerWeaponData - by Kane - 16.12.2017, 09:26

Forum Jump:


Users browsing this thread: 1 Guest(s)