Weapon name help
#1

Can anyone gives me full stock with all weapon names?
PHP код:
stock GetWeaponNameEx(weaponidweapon[], len sizeof(weapon))
{
    switch(
weaponid)
    {
        case 
18strcat(weapon"Molotov Cocktail"len);
        case 
44strcat(weapon"Night Vision Goggles"len);
        case 
45:  strcat(weapon"Thermal Goggles"len);
        default: 
GetWeaponName(weaponidweaponlen);
    }
    return 
weapon

this found on wikki, can you add other weapons too for me? I am not at my home so I don't have pawno with me that's why I am asking you.

Thanks.

EDIT: and yes, how can I use this GetWeaponNameEx to show weapon name in SendClientMessage?
Reply
#2

You can easily do that using "%W" placeholder in format syntax.
Example :
Код:
new msg[128];
format(msg, sizeof(msg), "Your weapon : %W", GetPlayerWeapon(playerid));
SendcClientMessage(playerid, -1, msg);
BTW, there's all weapon names :
Код:
new WeaponNames[55][] = //by Sascha
{
	"Fist", "Brass Knuckles", "Golf Club", "Nightstick", "Knife", "Baseball Bat",
	"Shovel", "Pool Cue", "Katana", "Chainsaw", "Double-ended Dilde", "Dildo",
	"Vibrator", "Silver Vibrator", "Flowers", "Cane", "Grenade", "Tear Gas",
	"Molotov Cocktail", "Unknow", "Unknown", "Unknown", "9mm", "Silenced 9mm",
	"Desert Eagle", "Shotgun", "Sawnoff Shotgun", "Combat Shotgun", "Micro SMG",
	"MP5", "AK-47", "M4", "Tec-9", "Country Rifle", "Sniper Rifle", "RPG", "HS Rocket",
	"Flamethrower", "Minigun", "Satchel Charge", "Detonator", "Spraycan", "Fire Extinguisher",
	"Camera", "Night Vis Goggles", "Thermal Goggles", "Parachute", "Fake Pistol", "Unknown",
	"Vehicle", "Helicopter Blades", "Explosion", "Unkown", "Drowned", "Spat"
};
Here's the code to use this :
Код:
new msg[128];
format(msg, sizeof(msg), "Your weapon : %W", WeaponNames[GetPlayerWeapon(playerid)]);
SendcClientMessage(playerid, -1, msg);
Reply
#3

Thanks Bro your awesome.... rep++ you.

hmm I still have one doubt, I am using this for my Anti Weapon Hack FS and my doubt is how it will know that player has hacked This weapon and it shows it in SendClientMessage.
Reply
#4

As far as I know, there is nothing like %w !!

Use %s instead.
Reply
#5

If you are using it as an anti-cheat, and you wan't to prevent players from having it, use this :

PHP код:
forward PlayerOneSecondVariables();
public 
PlayerOneSecondVariables()
{
     foreach(new 
i:Playeer)
    {
        if(
HasIlegalWeapon(i))
            {
                 new 
pname[24];
                 
GetPlayerName(playeridpname24);
                 
format(string,sizeof(string),"%s has spawned an %s",pname,GetPlayerWeapon(i));
                 
SendClientMessageToAll(COLOR_ADMIN,string);
                 
//Add your punishement above
             
}
    }
    return 
1;
}
forward HasIlegalWeapon(playerid);
public 
HasIlegalWeapon(playerid)
{
    if(
GetPlayerWeapon(playerid) == 16 || GetPlayerWeapon(playerid) == 35 ||
    
GetPlayerWeapon(playerid) == 36 || GetPlayerWeapon(playerid) == 37 || GetPlayerWeapon(playerid) == 38 ||
    
GetPlayerWeapon(playerid) == 39 || GetPlayerWeapon(playerid) == 40 || GetPlayerWeapon(playerid) == 18)
    {
        return 
1;
    }
    return 
0;

Reply
#6

I don't want like they cant have it, I want player get ban. the one I am using is working, I am using this
PHP код:
new msg[128];
    
format(msgsizeof(msg), "AdmCmd: %s was permanently banned by AntiCheat for Weapon Hacking[%s].",GetPlayerName(playerid), WeaponNames[GetPlayerWeapon(playerid)]);
    
SendClientMessageToAll(0xFF6347AAmsg); 
all works well but, SendClientMessageToAll is not working, It say "yCg!" in place of AdmCmd:...... one!!
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)