29.04.2015, 20:39
Never use ShowPlayerDialog in a loop as it'll be called way too many times and also no need to loop twice:
PS: You declared "targetid" and you are trying to get the name. It has not been assigned to any value so it will always return the name of the player with ID 0.
PHP Code:
for (new c = 0; c < 13; c++)
{
GetPlayerWeaponData(id, c, weaponid, ammo);
if (weaponid != 0 && ammo != 0)
{
GetWeaponName(weaponid, weapon, 24);
format(string, sizeof(string), "%sWeapons: %s Ammo: %d\n", string, weapon, ammo);
count++;
}
}
if(!count) SendClientMessage(playerid, COLOR_GREY, "This player has no weapons!");
else ShowPlayerDialog(playerid,DIALOG_ADMINS,DIALOG_STYLE_MSGBOX,"Client",string,"Close","");
return 1;