AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Weaponmenu (https://forums.alliedmods.net/showthread.php?t=163674)

pingplug 08-02-2011 05:35

Weaponmenu
 
1 Attachment(s)
weapons

Primary:
"awp"
"mp5navy"
"galil"
"m249"
"famas"
"mac10"
"ump45"
"xm1014"

Secondary:
"usp"
"deagle"
"fiveseven"
"elite"



Quote:

#include <amxmodx>
#include <hamsandwich>
#include <engine>
#include <fakemeta>
#include <cstrike>
#include <fun>

#define PLUGIN "weapon_GIVE"
#define VERSION "1.0"
#define AUTHOR "pingplug"

//Weapon Striper
#define OFFSET_PRIMARYWEAPON 116
#define OFFSET_C4_SLOT 372

new g_WeaponBPAmmo[] =
{
0,
52,
0,
90,
1,
32,
1,
100,
90,
1,
120,
100,
100,
90,
90,
90,
100,
120,
30,
120,
200,
32,
90,
120,
90,
2,
35,
90,
90,
0,
100
}

new const g_PrimaryWeapons[][] =
{
"none",
"awp",
"mp5navy",
"galil",
"m249",
"famas",
"mac10",
"ump45",
"xm1014"
};

new const g_SecondaryWeapons[][] =
{
"none",
"usp",
"deagle",
"fiveseven",
"elite"
};

new g_PrimaryWeaponMenu, g_SecondaryWeaponMenu;

public plugin_init()
{
register_plugin("Weapon Menu", "0.0.1", "pingplug");

RegisterHam(Ham_Spawn, "player", "fwdPlayerSpawn", 1);

g_PrimaryWeaponMenu = menu_create("Choose your primary weapon", "PrimaryWeaponMenuHandler");

//Primary Weapons Menu
new szPrimaryNum[3];

for(new i = 1; i < sizeof(g_PrimaryWeapons); i++)
{
num_to_str(i , szPrimaryNum , charsmax(szPrimaryNum));
menu_additem(g_PrimaryWeaponMenu , g_PrimaryWeapons[ i ] , szPrimaryNum , 0);
}
menu_setprop(g_PrimaryWeaponMenu , MPROP_EXIT , MEXIT_NEVER);

//Secondary Weapons Menu
g_SecondaryWeaponMenu = menu_create("Choose your primary weapon", "SecondaryWeaponMenuHandler");

new szSecondaryNum[3];

for(new i = 1; i < sizeof(g_SecondaryWeapons); i++)
{
num_to_str(i , szSecondaryNum , charsmax(szSecondaryNum));
menu_additem(g_SecondaryWeaponMenu , g_SecondaryWeapons[ i ] , szSecondaryNum , 0);
}
menu_setprop(g_SecondaryWeaponMenu , MPROP_EXIT , MEXIT_NEVER);

}

public fwdPlayerSpawn(id)
{
if(is_user_alive(id))
{
StripUserWeapons(id)
menu_display(id, g_PrimaryWeaponMenu);
}
}

public PrimaryWeaponMenuHandler( id , iMenu , iItem )
{
new szKey[ 3 ] , Dummy;
menu_item_getinfo( iMenu , iItem , Dummy , szKey , 2 , "" , 0 , Dummy );

new iSelectedWeapon = str_to_num( szKey );

if(!iSelectedWeapon)
return PLUGIN_HANDLED;

new weaponName[32];
format(weaponName, charsmax(weaponName), "weapon_%s", g_PrimaryWeapons[iSelectedWeapon]);
Give_Weapon(id, weaponName);
menu_display(id, g_SecondaryWeaponMenu);

return PLUGIN_CONTINUE;
}

public SecondaryWeaponMenuHandler( id , iMenu , iItem )
{
new szKey[ 3 ] , Dummy;
menu_item_getinfo( iMenu , iItem , Dummy , szKey , 2 , "" , 0 , Dummy );

new iSelectedWeapon = str_to_num( szKey );

if(!iSelectedWeapon)
return PLUGIN_HANDLED;

new weaponName[32];
format(weaponName, charsmax(weaponName), "weapon_%s", g_SecondaryWeapons[iSelectedWeapon]);
Give_Weapon(id, weaponName);

return PLUGIN_CONTINUE;
}

stock Give_Weapon(id, const weapon[])
{
give_item(id, weapon);

new iWeaponId = get_weaponid(weapon);
cs_set_user_bpammo(id, iWeaponId, g_WeaponBPAmmo[iWeaponId]);
}

stock StripUserWeapons(id)
{
new iC4Ent = get_pdata_cbase(id, OFFSET_C4_SLOT);

if( iC4Ent > 0 )
{
set_pdata_cbase(id, OFFSET_C4_SLOT, FM_NULLENT);
}

strip_user_weapons(id);
give_item(id, "weapon_knife");
set_pdata_int(id, OFFSET_PRIMARYWEAPON, 0);

if( iC4Ent > 0 )
{
entity_set_int(id, EV_INT_weapons, entity_get_int(id, EV_INT_weapons) | (1<<CSW_C4));
set_pdata_cbase(id, OFFSET_C4_SLOT, iC4Ent);
cs_set_user_bpammo(id, CSW_C4, 1);
cs_set_user_plant(id, 1);
}
return PLUGIN_HANDLED;
}

Doc-Holiday 08-02-2011 05:42

Re: Weaponmenu
 
lmfao way to copy/paste my code...

Hunter-Digital 08-02-2011 05:44

Re: Weaponmenu
 
So this guy just copies the plugins and releases them here like he made them ? Wow, the level of 'r-tardacy' !

Doc-Holiday 08-02-2011 05:45

Re: Weaponmenu
 
Quote:

Originally Posted by Hunter-Digital (Post 1523980)
So this guy just copies the plugins and releases them here like he made them ? Wow, the level of 'r-tardacy' !

lol...

pingplug 08-02-2011 05:47

Re: Weaponmenu
 
no my friend help me

pingplug 08-02-2011 05:48

Re: Weaponmenu
 
no spam or report

Doc-Holiday 08-02-2011 05:48

Re: Weaponmenu
 
Quote:

Originally Posted by pingplug (Post 1523983)
no my friend help me

https://forums.alliedmods.net/showthread.php?t=163642

lol you should atleast pick something like 12 pages in not just above lol

pingplug 08-02-2011 05:50

Re: Weaponmenu
 
Is it the same
Make sure

pingplug 08-02-2011 05:51

Re: Weaponmenu
 
See my script and See his script
not the same guy

Hunter-Digital 08-02-2011 06:15

Re: Weaponmenu
 
Doc-Holiday's script from that thread is exacly the same as the plugin you posted, the ONLY change is the author, shame on you pingplug !


All times are GMT -4. The time now is 03:19.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.