GetPlayerWeapon?
#1

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.
Reply
#2

Maybe it can help you
PHP код:
for (new 012i++)
                {
                    if(
PlayerInfo[giveplayerid][pGuns][i] > 0)
                    {
                        
GetWeaponName(PlayerInfo[giveplayerid][pGuns][i], weaponnamesizeof(weaponname));
                        
format(stringsizeof(string), "Weapon: %s"weaponname);
                        
SendClientMessageEx(playeridCOLOR_GRAD1string);
                    }
                } 
Reply
#3

PHP код:
new gun,ammo,string[50],wname[32];
for(new 
i13i++){
      
GetPlayerWeaponData(playerid,i,gun,ammo);
      
GetWeaponName(gun,wname,sizeof(wname));
      
format(string,sizeof(string),"Weapon: %s (%d) | Bullets: %d",wname,gun,ammo);
      
SendClientMessage(playerid, -1string);

Reply
#4

Quote:
Originally Posted by CodeStyle175
Посмотреть сообщение
PHP код:
new gun,ammo,string[50],wname[32];
for(new 
i13i++){
      
GetPlayerWeaponData(playerid,i,gun,ammo);
      
GetWeaponName(gun,wname,sizeof(wname));
      
format(string,sizeof(string),"Weapon: %s (%d) | Bullets: %d",wname,gun,ammo);
      
SendClientMessage(playerid, -1string);

Did you copy paste it from your script? I mean from a DM script? He asked for /frisk, which is only for RP
Reply
#5

Quote:
Originally Posted by CodeStyle175
Посмотреть сообщение
PHP код:
new gun,ammo,string[50],wname[32];
for(new 
i13i++){
      
GetPlayerWeaponData(playerid,i,gun,ammo);
      
GetWeaponName(gun,wname,sizeof(wname));
      
format(string,sizeof(string),"Weapon: %s (%d) | Bullets: %d",wname,gun,ammo);
      
SendClientMessage(playerid, -1string);

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
Reply
#6

PHP код:
new gun,ammo,string[70],wname[32]; 
for(new 
i13i++){ 
    
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, -1string); 
    }

Reply
#7

Quote:
Originally Posted by CodeStyle175
Посмотреть сообщение
PHP код:
new gun,ammo,string[50],wname[32];
for(new 
i13i++){
      
GetPlayerWeaponData(playerid,i,gun,ammo);
      
GetWeaponName(gun,wname,sizeof(wname));
      
format(string,sizeof(string),"Weapon: %s (%d) | Bullets: %d",wname,gun,ammo);
      
SendClientMessage(playerid, -1string);

Quote:
Originally Posted by CodeStyle175
Посмотреть сообщение
PHP код:
new gun,ammo,string[50],wname[32]; 
for(new 
i13i++){ 
    
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, -1string); 
    }

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"
Reply
#8

GetPlayerWeapon is to get the weapon the playerid is holding at that moment.
Reply
#9

PHP код:
GetWeaponNameEx(wid){
      new 
wname[32];
      switch(
wid){
            case 
30wname="Kalashnikov"//And so on you define every weapon name
            
case 31wname="M4";
      }
      return 
wname;       

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)