/check a cmd to see player's guns [+REP]
#1

So I was wondering how to make this command,I advised samp wiki but couldnt find a solution,anyone who helps me gets rep.everyone not just the first one.
Reply
#2

Could you provide us with more info?
Which game mode are you using?
Some commands? /stats would help a lot
Reply
#3

https://sampwiki.blast.hk/wiki/GetPlayerWeaponData
Reply
#4

PHP код:
new const shortWeaponNames[48][13] = {
    { 
"Unarmed"      },{ "Knuckles"     },{ "Golfclub"     },{ "Nightstick"   },{ "Knife"        },
    { 
"Bat"          },{ "Shovel"       },{ "Pool Cue"     },{ "Katana"       },{ "Chainsaw"     },
    { 
"Dildo"        },{ "Vibrator"     },{ "Vibrator"     },{ "Vibrator"     },{ "Flowers"      },
    { 
"Cane"         },{ "Grenade"      },{ "Teargas"      },{ "Molotov"      },{ " "            },
    { 
" "            },{ " "            },{ "Colt 45"      },{ "Silenced"     },{ "Deagle"       },
    { 
"Shotgun"      },{ "Sawnoffs"     },{ "Spas"         },{ "Micro UZI"    },{ "MP5"          },
    { 
"AK47"         },{ "M4"           },{ "Tec 9"        },{ "Rifle"        },{ "Sniper"       },
    { 
"Rocket"       },{ "RPG"          },{ "Flamethrower" },{ "Minigun"      },{ "Satchel"      },
    { 
"Detonator"    },{ "Spraycan"     },{ "Extinguisher" },{ "Camera"       },{ "Nightvision"  },
    { 
"Infrared"     },{ "Parachute"    },{ "Fake Pistol"  }
};
stock Ret_PlayerWeapons(playerid) {
    new 
tmp[128]
    for ( new 
slot 0slot 13slot++ )
    {
        
GetPlayerWeaponDataplayeridslotweaponammo );
        if ( 
weapon != && ammo != )
        {
            if(
slot == 1)
            {
                
formattmpsizeoftmp ), "%s(%d)"shortWeaponNamesweapon ] , ammo);
            }
            else
            {
                
formattmpsizeoftmp ), "%s, %s(%d)"tmpshortWeaponNamesweapon ] , ammo);
            }
        }
    }
    return 
tmp;

example:
PHP код:
CMD:myweapons(playerid) {

    new 
tmpstr[128];
    
format(tmpstrsizeof tmpstr"My Weapons: %s"Ret_PlayerWeapons(playerid))
    
SendClientMessage(playerid, -1tmpstr);
    return 
true;

Reply
#5

Quote:
Originally Posted by OneTwoThree
Посмотреть сообщение
Could you provide us with more info?
Which game mode are you using?
Some commands? /stats would help a lot
Seriously?... Anyways...
Hi!, Here you have one function that I just made, I wish it helps you.

Код:
CheckPlayerWeaps(playerid)
{
	new weap, ammo, string[64];
	for (new i = 0; i <= 12; i++)
	{
    	GetPlayerWeaponData(playerid, i, weap, ammo);
    	format(string,sizeof(string),"SLOT: %i. WEAPON: %i, AMMO: %i",i, weap, ammo);
	SendClientMessage(playerid,-1,string);
	}
	return 1;
}
This is not tested!... Here an example of using it, using sscanf and zcmd.
Код:
CMD:checkweaps(playerid, params[])
{
	new player;
	if(!sscanf(params, "r", player))
	{
		CheckPlayerWeaps(player);
	}
        else SendClientMessage(playerid, -1 "[USAGE]: /checkweaps [ID player]");
	return 1;
}
EDIT: I started posting this before all the answers, sorry. And also sorry for my bad english:V
Reply
#6

Thanks you PawnHunter and Whillyrez,both repped
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)