GetPlayerWeapon? - 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)
+--- Thread: GetPlayerWeapon? (
/showthread.php?tid=581059)
GetPlayerWeapon? -
Lirbo - 10.07.2015
How can I get all player's weapons? It's with GetPlayerWeaponData? I never understood how to use it, anyone can explain me plox?
EDIT: If somebody didnt understand it's for /Frisk command.
Re: GetPlayerWeapon? -
SoFahim - 10.07.2015
Maybe it can help you
PHP код:
for (new i = 0; i < 12; i++)
{
if(PlayerInfo[giveplayerid][pGuns][i] > 0)
{
GetWeaponName(PlayerInfo[giveplayerid][pGuns][i], weaponname, sizeof(weaponname));
format(string, sizeof(string), "Weapon: %s", weaponname);
SendClientMessageEx(playerid, COLOR_GRAD1, string);
}
}
Re: GetPlayerWeapon? -
CodeStyle175 - 10.07.2015
PHP код:
new gun,ammo,string[50],wname[32];
for(new i; i < 13; i++){
GetPlayerWeaponData(playerid,i,gun,ammo);
GetWeaponName(gun,wname,sizeof(wname));
format(string,sizeof(string),"Weapon: %s (%d) | Bullets: %d",wname,gun,ammo);
SendClientMessage(playerid, -1, string);
}
Re: GetPlayerWeapon? -
SoFahim - 10.07.2015
Quote:
Originally Posted by CodeStyle175
PHP код:
new gun,ammo,string[50],wname[32];
for(new i; i < 13; i++){
GetPlayerWeaponData(playerid,i,gun,ammo);
GetWeaponName(gun,wname,sizeof(wname));
format(string,sizeof(string),"Weapon: %s (%d) | Bullets: %d",wname,gun,ammo);
SendClientMessage(playerid, -1, string);
}
|
Did you copy paste it from your script? I mean from a DM script? He asked for /frisk, which is only for RP
Re: GetPlayerWeapon? -
Lirbo - 10.07.2015
Quote:
Originally Posted by CodeStyle175
PHP код:
new gun,ammo,string[50],wname[32];
for(new i; i < 13; i++){
GetPlayerWeaponData(playerid,i,gun,ammo);
GetWeaponName(gun,wname,sizeof(wname));
format(string,sizeof(string),"Weapon: %s (%d) | Bullets: %d",wname,gun,ammo);
SendClientMessage(playerid, -1, string);
}
|
How can I do it if I want to send a message only if he have the weapon? I mean that would not send a message if he haven't the weapon
Re: GetPlayerWeapon? -
CodeStyle175 - 10.07.2015
PHP код:
new gun,ammo,string[70],wname[32];
for(new i; i < 13; i++){
GetPlayerWeaponData(playerid,i,gun,ammo);
if(gun > 0){
GetWeaponName(gun,wname,sizeof(wname));
format(string,sizeof(string),"Weapon: %s (%d) | Bullets: %d",wname,gun,ammo);
SendClientMessage(playerid, -1, string);
}
}
Re: GetPlayerWeapon? -
Lirbo - 10.07.2015
Quote:
Originally Posted by CodeStyle175
PHP код:
new gun,ammo,string[50],wname[32];
for(new i; i < 13; i++){
GetPlayerWeaponData(playerid,i,gun,ammo);
GetWeaponName(gun,wname,sizeof(wname));
format(string,sizeof(string),"Weapon: %s (%d) | Bullets: %d",wname,gun,ammo);
SendClientMessage(playerid, -1, string);
}
|
Quote:
Originally Posted by CodeStyle175
PHP код:
new gun,ammo,string[50],wname[32];
for(new i; i < 13; i++){
GetPlayerWeaponData(playerid,i,gun,ammo);
if(gun > 0){
GetWeaponName(gun,wname,sizeof(wname));
format(string,sizeof(string),"Weapon: %s (%d) | Bullets: %d",wname,gun,ammo);
SendClientMessage(playerid, -1, string);
}
}
|
Ye haha ty I just thought about it. btw how can I get my own Weapon names? I mean for example for "AK47" it would be "Kalashnikov"
Re: GetPlayerWeapon? -
notime - 10.07.2015
GetPlayerWeapon is to get the weapon the playerid is holding at that moment.
Re: GetPlayerWeapon? -
CodeStyle175 - 10.07.2015
PHP код:
GetWeaponNameEx(wid){
new wname[32];
switch(wid){
case 30: wname="Kalashnikov"; //And so on you define every weapon name
case 31: wname="M4";
}
return wname;
}