SA-MP Forums Archive
weapon info cmd - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: weapon info cmd (/showthread.php?tid=49796)



weapon info cmd - Dark-X - 05.09.2008

i wana do a cmd that if i write /winfo, it tells me what kind of weapons the player has, and the ammo..
and i want it to tell me what are the weapons that the player has, even if hes not holding them.. is it possible, and how ?


Re: weapon info cmd - Joe Staff - 05.09.2008

Try GetPlayerWeaponData

there's roughly 13 weapons a person can carry simultaneously I think, so best go with 15. That pawn function returns both weapon id and weapon ammo. REMEMBER: Just because it says a player has 65535 ammo, doesn't mean he has that much, it just means that the server can't get that information from the player


Re: weapon info cmd - Dark-X - 05.09.2008

i tryed that cmd, but had no luck, can you direct me a little?


Re: weapon info cmd - Nero_3D - 05.09.2008

pawn Код:
new WeapAmmo[2], name[24], string[128];
GetPlayerName(playerid, name, sizeof(name));
format(string, sizeof(string), "%s's Weapons:", name);
for(new w = 0; w < 13; w++)
{
    GetPlayerWeaponData(playerid, w, WeapAmmo[0], WeapAmmo[1]);
    GetWeaponName(WeapAmmo[0], name, sizeof(name));
    format(string, sizeof(string), "%s %s(%d),", string, name, WeapAmmo[1]);
}
string[strlen(string)-1] = 0;
SendClientMessage(playerid, COLOR_WHITE, string);



Re: weapon info cmd - Dark-X - 05.09.2008

oh thanks!~!
o and last question..
in the cmd you gave me, can i do that itll show me only the weapons he has, and wont show the 0's


Re: weapon info cmd - Nero_3D - 05.09.2008

maybe try that
pawn Код:
new WeapAmmo[2], name[24], string[128];
GetPlayerName(playerid, name, sizeof(name));
format(string, sizeof(string), "%s's Weapons:", name);
for(new w = 0; w < 13; w++)
{
    GetPlayerWeaponData(playerid, w, WeapAmmo[0], WeapAmmo[1]);
    if(WeapAmmo[0] == 0) continue;
    GetWeaponName(WeapAmmo[0], name, sizeof(name));
    format(string, sizeof(string), "%s %s(%d),", string, name, WeapAmmo[1]);
}
string[strlen(string)-1] = 0;
SendClientMessage(playerid, COLOR_WHITE, string);
dont know if that will work


Re: weapon info cmd - Dark-X - 05.09.2008

Quote:
Originally Posted by Nero_3D
maybe try that
pawn Код:
new WeapAmmo[2], name[24], string[128];
GetPlayerName(playerid, name, sizeof(name));
format(string, sizeof(string), "%s's Weapons:", name);
for(new w = 0; w < 13; w++)
{
    GetPlayerWeaponData(playerid, w, WeapAmmo[0], WeapAmmo[1]);
    if(WeapAmmo[0] == 0) continue;
    GetWeaponName(WeapAmmo[0], name, sizeof(name));
    format(string, sizeof(string), "%s %s(%d),", string, name, WeapAmmo[1]);
}
string[strlen(string)-1] = 0;
SendClientMessage(playerid, COLOR_WHITE, string);
dont know if that will work
yeah it works perfectly, thanks a lot dude !!!


Re: weapon info cmd - Horus - 11.03.2009

sorry for asking this, i realy have no clue

i can't see the cmd code of it, like what Dark-X said (/winfo)

should i add something like this in it?

if (strcmp(cmdtext, "/winfo", true)==0)

or maybe is already added but i'm too amateur to see it


Re: weapon info cmd - MenaceX^ - 11.03.2009

Quote:
Originally Posted by ♣ ⓐⓢⓢ
maybe try that
pawn Код:
new WeapAmmo[2], name[24], string[128];
GetPlayerName(playerid, name, sizeof(name));
format(string, sizeof(string), "%s's Weapons:", name);
for(new w = 0; w < 13; w++)
{
    GetPlayerWeaponData(playerid, w, WeapAmmo[0], WeapAmmo[1]);
    if(WeapAmmo[0] == 0) continue;
    GetWeaponName(WeapAmmo[0], name, sizeof(name));
    format(string, sizeof(string), "%s %s(%d),", string, name, WeapAmmo[1]);
}
string[strlen(string)-1] = 0;
SendClientMessage(playerid, COLOR_WHITE, string);
dont know if that will work
I am not sure if 13 is the maximum of holding guns.
Yes, it is. My bad.