/weapons /scout /usp etc..

Started by doktor
16/02/2010 07:36
Page 1 of 1
doktor16/02/2010 07:36

With this plugin you can obtain any weapon typing /weaponname (/awp /m4a1 /mp5navy etc...) in tchat.
You also can get all weapons typing /weapons

CLIC ME HARD

SchlumPF16/02/2010 22:27

more advanced but you should add commands like /mp5 too. ive always thought about such an plugin but i was too lazy to create one :D honestly, nobody would ever call the mp5 mp5navi. also, at least germans do not say m249, they simply say para.

doktor17/02/2010 00:05

I could rewrite it with a Trie so you should be able to put as many aliases as you want for each weapon. Code would remain advanced :P
Just have to code the file part and it is so boring even for a short code...

beuhnoix17/02/2010 12:41

You come from France? :/
Btw nice plugin I'll use it!

doktor18/02/2010 20:22

Originally posted by Lolz#kkzfanclub
You come from France? :/
Btw nice plugin I'll use it!


Yes i do.

Which feature from weapon utility (or whatever) you wish i add in this plugin ?
I think the sound blocker is pretty useless, i plain to add show maxspeed feature, and also to allow few keywords for each weapon so, as schlumpf suggested, you can type /mp5 instead of /mp5navy

SchlumPF18/02/2010 21:18

the thingy about weaponsounds is actually really useless :) the maxspeed thing might be used by some ppl but its pretty ugly to see that msg if you know each weaponspeed by heart ^^

doktor23/04/2013 18:47

I'm rebuilding a kz server actually, so i had to review this plugin, added grenades (not usable), and added command /weapons so a menu is popping up with all weapons sorted by maxspeed.

Cheers.

#include 
#include
#include
#include

#pragma semicolon 1

#define PLUGIN "Kz Weapons Menu"
#define VERSION "0.0.1"

// const Float:MAX_FLOAT = Float:0x7F7FFFFF; // chez nous on fait pas les choses à moitié

const XO_CBASEPLAYERITEM = 4;
const m_pPlayer = 41;

const XO_CBASEPLAYERWEAPON = 4;
const m_iPrimaryAmmoType = 49;

const m_iMenu = 205;
new const m_rgAmmo_CBasePlayer[32] = {376,377,...};

new g_iWeaponsMenu;

enum mWeaponsDatas {
m_iWeaponId,
Float:m_flWeaponMaxSpeed
}

new const g_mWeaponsDatas[][mWeaponsDatas] = {
{CSW_SCOUT, 260.0},

{CSW_P228, 250.0},
{CSW_HEGRENADE, 250.0},
{CSW_C4, 250.0},
{CSW_MAC10, 250.0},
{CSW_SMOKEGRENADE, 250.0},
{CSW_ELITE, 250.0},
{CSW_FIVESEVEN, 250.0},
{CSW_UMP45, 250.0},
{CSW_USP, 250.0},
{CSW_GLOCK18, 250.0},
{CSW_MP5NAVY, 250.0},
{CSW_TMP, 250.0},
{CSW_FLASHBANG, 250.0},
{CSW_DEAGLE, 250.0},
{CSW_KNIFE, 250.0},

{CSW_P90, 245.0},

{CSW_XM1014, 240.0},
{CSW_AUG, 240.0},
{CSW_SG550, 240.0},
{CSW_GALIL, 240.0},
{CSW_FAMAS, 240.0},

{CSW_SG552, 235.0},

{CSW_M3, 230.0},
{CSW_M4A1, 230.0},
{CSW_AK47, 221.0},
{CSW_M249, 220.0},
{CSW_AWP, 210.0},
{CSW_G3SG1, 210.0}
};

public plugin_init()
{
register_plugin( PLUGIN, VERSION, "ConnorMcLeod" );

RegisterHam(Ham_Item_Holster, "weapon_hegrenade", "MiscNades_Holster");
RegisterHam(Ham_Item_Holster, "weapon_flashbang", "MiscNades_Holster");
RegisterHam(Ham_Item_Holster, "weapon_smokegrenade", "MiscNades_Holster");
RegisterHam(Ham_Item_Deploy, "weapon_hegrenade", "MiscNades_Deploy_Post", 1);
RegisterHam(Ham_Item_Deploy, "weapon_flashbang", "MiscNades_Deploy_Post", 1);
RegisterHam(Ham_Item_Deploy, "weapon_smokegrenade", "MiscNades_Deploy_Post", 1);

register_clcmd("say", "Host_Say", 0);
register_clcmd("say_team", "Host_Say", 1);

CreateMenu();
register_saycmd("weapons", "ClCmd_WeaponsMenu");
}

CreateMenu()
{
g_iWeaponsMenu = menu_create("\yWeapons Menu\R$ Speed", "Weapons_Menu_Handler");
menu_setprop(g_iWeaponsMenu, MPROP_NUMBER_COLOR, "\w");
new szItem[64], szWeapon[32];

for(new i; i {
get_weaponname(g_mWeaponsDatas[m_iWeaponId], szWeapon, charsmax(szWeapon));
szWeapon[7] = toupper(szWeapon[7]);
formatex(szItem, charsmax(szItem), "%s\y\R%.1f", szWeapon[7], g_mWeaponsDatas[m_flWeaponMaxSpeed]);
menu_additem(g_iWeaponsMenu, szItem);
}
}

public ClCmd_WeaponsMenu(id)
{
if( is_user_alive(id) )
{
MenuDisplay(id, g_iWeaponsMenu);
}
}

public Weapons_Menu_Handler(id, menu, item)
{
if( item == MENU_EXIT || !is_user_alive(id) )
{
return;
}

new iId = g_mWeaponsDatas[item][m_iWeaponId];
if( user_has_weapon(id, iId) )
{
Already_Have_One(id);
}
else
{
new szWeapon[32];
get_weaponname(iId, szWeapon, charsmax(szWeapon));
give_item(id, szWeapon);
}

MenuDisplay(id, g_iWeaponsMenu, GetUserMenuPage(id));
}

public Host_Say(id, teamonly)
{
new szArg1[15];
if( is_user_alive(id) && read_argv(1, szArg1, charsmax(szArg1)) < 14 && !isalnum(szArg1[0]) )
{
new szWeaponName[32] = "weapon_";
add(szWeaponName, charsmax(szWeaponName), szArg1[1]);
new iId = get_weaponid(szWeaponName);
if( iId )
{
if( !user_has_weapon(id, iId) )
{
give_item(id, szWeaponName);
}
else
{
Already_Have_One( id );
}
}
}
return PLUGIN_CONTINUE;
}

Already_Have_One( id )
{
client_print(id, print_center, "#Cstrike_TitlesTXT_Already_Have_One");
}

public MiscNades_Deploy_Post( ent )
{
set_pdata_int
(
get_pdata_cbase(ent, m_pPlayer, XO_CBASEPLAYERITEM),
m_rgAmmo_CBasePlayer[ get_pdata_int(ent, m_iPrimaryAmmoType, XO_CBASEPLAYERWEAPON) ],
0
);
}

public MiscNades_Holster( ent )
{
set_pdata_int
(
get_pdata_cbase(ent, m_pPlayer, XO_CBASEPLAYERITEM),
m_rgAmmo_CBasePlayer[ get_pdata_int(ent, m_iPrimaryAmmoType, XO_CBASEPLAYERWEAPON) ],
1
);
}

register_saycmd(saycommand[], function[], flags = -1, info[] = "", FlagManager = -1)
{
new temp[64];
formatex(temp, 63, "say /%s", saycommand);
register_clcmd(temp, function, flags, info, FlagManager);
formatex(temp, 63, "say .%s", saycommand);
register_clcmd(temp, function, flags, info, FlagManager);
formatex(temp, 63, "say_team /%s", saycommand, FlagManager);
register_clcmd(temp, function, flags, info);
formatex(temp, 63, "say_team .%s", saycommand, FlagManager);
register_clcmd(temp, function, flags, info, FlagManager);
formatex(temp, 63, ".%s", saycommand);
register_clcmd(temp, function, flags, info, FlagManager);
formatex(temp, 63, "/%s", saycommand);
register_clcmd(temp, function, flags, info, FlagManager);
}

MenuDisplay(id, menu, page=0)
{
set_pdata_int(id, m_iMenu, 0);
menu_display(id, menu, page);
}

GetUserMenuPage( id )
{
new crap, page;
player_menu_info(id, crap, crap, page);
return page;
}

Page 1 of 1

Please log in to post replies.