PHP Code:
/* Plugin generated by AMXX-Studio */
#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <fun>
#include <hamsandwich>
#include <fakemeta_util>
#define PLUGIN "Vip wIN"
#define VERSION "1.0"
#define AUTHOR "c0stY*"
new gfi_WorkFile[ 128 ];
new gs_VipsList[ 128 ][ 32 ], gi_TotalLines;
new gi_IsUserVip[ 33 ];
new g_pVisiblity;
new const gs_VipsFile[ ] = "vips.ini";
enum
{
Primary = 1
, Secondary
, Knife
, Grenades
, C4
};
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)
register_concmd("say /powers", "showAdmin", ADMIN_LEVEL_H, "")
register_clcmd( "say /vmenu","Powermenu", ADMIN_LEVEL_H )
g_pVisiblity = register_cvar( "km_invis", "150" ); // 255 = vizibil total
}
public plugin_cfg ( )
{
new fi_Dir[ 64 ];
get_configsdir ( fi_Dir, charsmax ( fi_Dir ) );
formatex ( gfi_WorkFile, charsmax ( gfi_WorkFile ), "%s/%s", fi_Dir, gs_VipsFile );
if ( ! file_exists ( gfi_WorkFile ) )
write_file ( gfi_WorkFile, "; *VIP List*" );
new s_Buffer[ 192 ], i_Line, i_Len;
while ( ( i_Line = read_file ( gfi_WorkFile, i_Line, s_Buffer, charsmax ( s_Buffer ), i_Len ) ) )
{
if ( ! strlen ( s_Buffer ) || s_Buffer[ 0 ] == ';' || ( s_Buffer[ 0 ] == '/' && s_Buffer[ 1 ] == '/' ) )
continue;
copy ( gs_VipsList[ gi_TotalLines++ ], 32, s_Buffer );
}
}
public client_putinserver ( id ) gi_IsUserVip[ id ] = 0;
public client_disconnect ( id ) gi_IsUserVip[ id ] = 0;
public Powermenu( id )
{
if ( ! is_user_alive ( id ) )
return PLUGIN_HANDLED
if ( ! is_user_vip ( id ) )
{
gi_IsUserVip[ id ] = 0;
return PLUGIN_HANDLED
}
gi_IsUserVip[ id ] = 1;
new menu = menu_create( "\rPowers Menu:", "menu_handler" );
menu_additem( menu, "\yViata.", "1", 0 )
menu_additem( menu, "\yViteza.", "2", 0 )
menu_additem( menu, "\yGravitate.", "3",0 )
menu_additem( menu, "\yAk47 +\wM4a1 + \yDeagle", "4",0 )
menu_additem( menu, "\yRifles \w[Arme \ytari].", "5",0 )
menu_additem( menu, "\yShiels.", "6",0 )
menu_additem( menu, "\yPachet grenazi.", "7",0 )
menu_additem( menu, "\yMachine Guns \w[5.9]", "8",0 )
menu_additem( menu, "\yViteza normala.", "9",0 )
menu_additem( menu, "\yArmura." , "10",0)
menu_setprop( menu, MPROP_EXIT, MEXIT_ALL );
menu_display( id, menu, 0 );
return PLUGIN_HANDLED
}
public menu_handler( id, menu, item )
{
switch( item )
{
case 0:
{
set_user_health(id,800)
}
case 1:
{
set_pev( id,pev_maxspeed, 1200.0)
client_cmd(id,"cl_forwardspeed 1200.0")
client_cmd(id,"cl_backspeed 1200.0")
client_cmd(id,"cl_sidespeed 1200.0")
}
case 2:
{
set_pev( id, pev_gravity, 0.3125);
}
case 3:
{
StripWeapons(id, Primary)
give_item(id,"weapon_ak47")
cs_set_user_bpammo(id, CSW_AK47, 250);
StripWeapons(id, Primary)
give_item(id,"weapon_m4a1")
cs_set_user_bpammo(id, CSW_M4A1, 250 );
StripWeapons(id, Secondary);
give_item(id,"weapon_deagle")
cs_set_user_bpammo(id, CSW_DEAGLE, 250 );
}
case 4:
{
StripWeapons(id, Primary)
give_item(id,"weapon_ak47")
cs_set_user_bpammo(id, CSW_AK47, 250);
StripWeapons(id, Primary)
give_item(id,"weapon_m4a1")
cs_set_user_bpammo(id, CSW_M4A1, 250 );
StripWeapons(id, Secondary)
give_item(id,"weapon_deagle")
cs_set_user_bpammo(id, CSW_DEAGLE, 250 );
StripWeapons(id,Primary)
give_item(id,"weapon_famas")
cs_set_user_bpammo(id, CSW_FAMAS, 250 );
StripWeapons(id, Primary)
give_item(id,"weapon_awp")
cs_set_user_bpammo(id, CSW_AWP, 250 );
StripWeapons(id, Primary)
give_item(id,"weapon_mp5navy")
cs_set_user_bpammo(id, CSW_MP5NAVY, 250 );
StripWeapons(id, Secondary)
give_item(id,"weapon_ump45")
cs_set_user_bpammo(id, CSW_UMP45, 250 );
StripWeapons(id, Primary)
give_item(id,"weapon_galil")
cs_set_user_bpammo(id, CSW_GALIL, 250 );
StripWeapons(id, Secondary)
give_item(id,"weapon_scout")
cs_set_user_bpammo(id, CSW_SCOUT, 250 );
StripWeapons(id, Primary)
give_item(id,"weapon_aug")
cs_set_user_bpammo(id, CSW_AUG, 250 );
StripWeapons(id, Primary)
give_item(id,"weapon_sg550")
cs_set_user_bpammo(id, CSW_SG550, 250 );
}
case 5:
{
StripWeapons(id, Primary)
give_item(id,"weapon_shield")
}
case 6:
{
give_item(id, "weapon_hegrenade")
cs_set_user_bpammo(id, CSW_HEGRENADE, 10 );
give_item(id, "weapon_flashbang")
give_item(id, "weapon_flashbang")
give_item(id, "weapon_smokegrenade")
cs_set_user_bpammo(id, CSW_SMOKEGRENADE, 10 );
}
case 7:
{
StripWeapons(id, Primary)
give_item(id,"weapon_m249")
cs_set_user_bpammo(id, CSW_M249, 300 );
}
case 8:
{
set_pev( id,pev_maxspeed, 350.0)
client_cmd(id,"cl_forwardspeed 350.0")
client_cmd(id,"cl_backspeed 350.0")
client_cmd(id,"cl_sidespeed 350.0")
}
case 9:
{
set_user_armor(id,800)
set_user_rendering( id, kRenderFxNone, 0, 0, 0, kRenderTransAlpha, get_pcvar_num( g_pVisiblity ) );
}
}
menu_destroy( menu );
return PLUGIN_HANDLED;
}
public showAdmin(id)
{
new num, iLen, admin
static pl[32], name[32], szBuff[2048]
get_players(pl, num, "c")
for(new i = 0; i < num; i++)
{
if ( is_user_vip ( pl[i] ) )
{
gi_IsUserVip[ pl[i] ] = 1;
get_user_name(pl[i], name, 31)
iLen += format(szBuff[iLen], 2048 - iLen, "%d. %s^n", admin + 1, name)
admin++
}
}
set_hudmessage(0, 255, 0, 0.02, 0.2, 0, 6.0, 7.0 )
show_hudmessage(id, " %s online:^n%s", admin > 1 ? "Vips" : "Vips", szBuff)
arrayset(szBuff, 0, 2048)
return PLUGIN_HANDLED
}
//========================================================================================
stock is_user_vip ( id )
{
new s_Name[ 32 ], s_AuthID[ 32 ];
get_user_name ( id, s_Name, 31 );
get_user_authid ( id, s_AuthID, 31 );
for ( new i; i < gi_TotalLines; i++ )
{
if ( ! strcmp ( s_Name, gs_VipsList[ i ] ) )
return 1;
if ( ! strcmp ( s_AuthID, gs_VipsList[ i ] ) )
return 1;
}
return 0;
}
stock StripWeapons(id, Type, bool: bSwitchIfActive = true)
{
new iReturn;
if(is_user_alive(id))
{
new iEntity, iWeapon;
while((iWeapon = GetWeaponFromSlot(id, Type, iEntity)) > 0)
iReturn = ham_strip_user_weapon(id, iWeapon, Type, bSwitchIfActive);
}
return iReturn;
}
stock GetWeaponFromSlot( id , iSlot , &iEntity )
{
if ( !( 1 <= iSlot <= 5 ) )
return 0;
iEntity = 0;
const m_rgpPlayerItems_Slot0 = 367;
const m_iId = 43;
const XO_WEAPONS = 4;
const XO_PLAYER = 5;
iEntity = get_pdata_cbase( id , m_rgpPlayerItems_Slot0 + iSlot , XO_PLAYER );
return ( iEntity > 0 ) ? get_pdata_int( iEntity , m_iId , XO_WEAPONS ) : 0;
}
stock ham_strip_user_weapon(id, iCswId, iSlot = 0, bool:bSwitchIfActive = true)
{
new iWeapon
if( !iSlot )
{
static const iWeaponsSlots[] = {
-1,
2, //CSW_P228
-1,
1, //CSW_SCOUT
4, //CSW_HEGRENADE
1, //CSW_XM1014
5, //CSW_C4
1, //CSW_MAC10
1, //CSW_AUG
4, //CSW_SMOKEGRENADE
2, //CSW_ELITE
2, //CSW_FIVESEVEN
1, //CSW_UMP45
1, //CSW_SG550
1, //CSW_GALIL
1, //CSW_FAMAS
2, //CSW_USP
2, //CSW_GLOCK18
1, //CSW_AWP
1, //CSW_MP5NAVY
1, //CSW_M249
1, //CSW_M3
1, //CSW_M4A1
1, //CSW_TMP
1, //CSW_G3SG1
4, //CSW_FLASHBANG
2, //CSW_DEAGLE
1, //CSW_SG552
1, //CSW_AK47
3, //CSW_KNIFE
1 //CSW_P90
}
iSlot = iWeaponsSlots[iCswId]
}
const XTRA_OFS_PLAYER = 5
const m_rgpPlayerItems_Slot0 = 367
iWeapon = get_pdata_cbase(id, m_rgpPlayerItems_Slot0 + iSlot, XTRA_OFS_PLAYER)
const XTRA_OFS_WEAPON = 4
const m_pNext = 42
const m_iId = 43
while( iWeapon > 0 )
{
if( get_pdata_int(iWeapon, m_iId, XTRA_OFS_WEAPON) == iCswId )
{
break
}
iWeapon = get_pdata_cbase(iWeapon, m_pNext, XTRA_OFS_WEAPON)
}
if( iWeapon > 0 )
{
const m_pActiveItem = 373
if( bSwitchIfActive && get_pdata_cbase(id, m_pActiveItem, XTRA_OFS_PLAYER) == iWeapon )
{
ExecuteHamB(Ham_Weapon_RetireWeapon, iWeapon)
}
if( ExecuteHamB(Ham_RemovePlayerItem, id, iWeapon) )
{
user_has_weapon(id, iCswId, 0)
ExecuteHamB(Ham_Item_Kill, iWeapon)
return 1
}
}
return 0
}
But when I chose to give me guns they give me only m4a1 and deagle not ak47 and when I chose rifles it give me only awp.I have an deathrun server and I found the problem it is because of hamdata.ini, I found a good hamdata and it works all weapons when I choose them but then it wont give me USP when the round starts.