#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <engine>
#include <hamsandwich>
#include <fakemeta_util>
#define PLUGIN "Vip System"
#define VERSION "1.1"
#define AUTHOR "Truth"
#define VIP ADMIN_LEVEL_H
#define is_user_valid(%1) (1 <= %1 <= get_maxplayers())
enum Color
{
NORMAL = 1, // Culoarea care o are jucatorul setata in cvar-ul scr_concolor.
GREEN, // Culoare Verde.
TEAM_COLOR, // Culoare Rosu, Albastru, Gri.
GREY, // Culoarea Gri.
RED, // Culoarea Rosu.
BLUE, // Culoarea Albastru.
}
new TeamName[ ][ ] =
{
"",
"TERRORIST",
"CT",
"SPECTATOR"
}
new jumpnum[33] = 0
new bool:dojump[33] = false
new bool:HasWeapon[33] = false;
new CvarHP, CvarHHP, CvarKM, CvarHM;
public plugin_init() {
register_plugin(PLUGIN, VERSION, AUTHOR)
CvarHP = register_cvar("vip_hp_kill", "25" );
CvarHHP = register_cvar("vip_hp_hs", "45" );
CvarKM = register_cvar("vip_money_kill", "500" );
CvarHM = register_cvar("vip_money_hs", "1000" );
register_clcmd("say /wantvip", "VIPMotd");
register_clcmd("say_team /wantvip", "VIPMotd");
register_clcmd("say /vipmenu", "VipMenuCMD");
register_clcmd("say_team /vipmenu", "VipMenuCMD");
register_cvar("amx_maxjumps","2")
register_cvar("amx_onlyvip","1")
RegisterHam( Ham_Spawn, "player", "VipSpawnCmd", true );
register_event ( "DeathMsg", "eDeath", "a" );
}
public VIPMotd ( id ) show_motd(id, "addons/amxmodx/configs/VIP.html", "Buy VIP");
public client_putinserver(id)
{
jumpnum[id] = 0;
dojump[id] = false;
HasWeapon[id] = false;
}
public client_disconnect(id)
{
jumpnum[id] = 0;
dojump[id] = false;
HasWeapon[id] = false;
}
public VipSpawnCmd ( id ) {
if( is_user_alive(id) && get_user_flags(id) & VIP )
{
//HE+FLASH
fm_give_item(id, "weapon_hegrenade" );
cs_set_user_bpammo(id, CSW_HEGRENADE, 2);
fm_give_item(id, "weapon_flashbang" );
cs_set_user_bpammo(id, CSW_FLASHBANG, 2);
HasWeapon[id] = false;
VipMenuCMD( id );
}
}
public VipMenuCMD( id ) {
new MeniuVIP = menu_create( "\r* V.I.P. * \yMenu", "VipMenuCMDHandler" )
if(get_user_flags(id) & VIP)
{
menu_additem( MeniuVIP, "\y M4A1+Deagle ", "1", 0 )
}
else
{
menu_additem( MeniuVIP, "\y M4A1+Deagle \d( Only VIP )", "1", 0 )
}
if(get_user_flags(id) & VIP )
{
menu_additem( MeniuVIP, "\y AK47+Deagle", "2", 0 )
}
else
{
menu_additem( MeniuVIP, "\y AK47+Deagle \d( Only VIP )", "2", 0 )
}
if(get_user_flags(id) & VIP )
{
menu_additem( MeniuVIP, "\y MAWP+Deagle", "3", 0 )
}
else
{
menu_additem( MeniuVIP, "\y AWP+Deagle \d( Only VIP )", "3", 0 )
}
menu_setprop( MeniuVIP, MPROP_NUMBER_COLOR, "\r" );
menu_setprop( MeniuVIP, MPROP_EXIT, MEXIT_ALL )
menu_display( id, MeniuVIP, 0 )
}
public VipMenuCMDHandler( id, MeniuVIP, item )
{
if( !is_user_alive( id ) )
{
ColorChat( id, GREEN, "^x01[^x04 AVENGERS^x01 ] Nu poti accesa meniul cand esti mort!" )
menu_destroy( MeniuVIP );
return PLUGIN_HANDLED;
}
if( HasWeapon[id] )
{
ColorChat( id, GREEN, "^x01[^x04 AVENGERS^x01 ] Nu poti accesa meniul decat o data pe runda!" )
menu_destroy( MeniuVIP );
return PLUGIN_HANDLED;
}
if(get_user_flags(id) & VIP )
{
ColorChat(id, GREEN, "^x01[^x04 AVENGERS^x01 ] Nu ai acces la acest meniu !" );
menu_destroy( MeniuVIP );
return PLUGIN_HANDLED;
}
if( item == MENU_EXIT )
{
menu_destroy( MeniuVIP )
return PLUGIN_HANDLED
}
switch( item )
{
case 0 :
{
fm_strip_user_weapons(id);
fm_give_item(id, "weapon_knife");
fm_give_item(id, "weapon_hegrenade" );
cs_set_user_bpammo(id, CSW_HEGRENADE, 2);
fm_give_item(id, "weapon_flashbang" );
cs_set_user_bpammo(id, CSW_FLASHBANG, 2);
fm_give_item(id, "weapon_deagle");
cs_set_user_bpammo( id, CSW_DEAGLE, 70 );
fm_give_item(id, "weapon_m4a1" );
cs_set_user_bpammo( id, CSW_M4A1, 90 );
HasWeapon[id] = true;
}
case 1 :
{
fm_strip_user_weapons(id);
fm_give_item(id, "weapon_knife");
fm_give_item(id, "weapon_hegrenade" );
cs_set_user_bpammo(id, CSW_HEGRENADE, 2);
fm_give_item(id, "weapon_flashbang" );
cs_set_user_bpammo(id, CSW_FLASHBANG, 2);
fm_give_item(id, "weapon_deagle");
cs_set_user_bpammo( id, CSW_DEAGLE, 70 );
fm_give_item(id, "weapon_ak47");
cs_set_user_bpammo( id, CSW_AK47, 90 );
HasWeapon[id] = true;
}
case 2 :
{
fm_strip_user_weapons(id);
fm_give_item(id, "weapon_knife");
fm_give_item(id, "weapon_hegrenade" );
cs_set_user_bpammo(id, CSW_HEGRENADE, 2);
fm_give_item(id, "weapon_flashbang" );
cs_set_user_bpammo(id, CSW_FLASHBANG, 2);
fm_give_item(id, "weapon_deagle");
cs_set_user_bpammo( id, CSW_DEAGLE, 70 );
fm_give_item(id, "weapon_awp");
cs_set_user_bpammo( id, CSW_AWP, 90 );
HasWeapon[id] = true;
}
}
menu_destroy( MeniuVIP );
return PLUGIN_HANDLED;
}
public eDeath ( ) {
new iKiller = read_data ( 1 );
new iVictim = read_data ( 2 );
new iHS = read_data ( 3 );
if(iKiller == iVictim) return 1;
if(get_user_flags(iKiller) & VIP ) {
if(iHS) {
fm_set_user_health(iKiller, get_pcvar_num(CvarHHP));
cs_set_user_money(iKiller, cs_get_user_money(iKiller) + get_pcvar_num(CvarHM));
}
else
{
fm_set_user_health(iKiller, get_pcvar_num(CvarHP));
cs_set_user_money(iKiller, cs_get_user_money(iKiller) + get_pcvar_num(CvarKM));
}
}
return 1;
}
public client_PreThink(id)
{
if(!is_user_alive(id)) return PLUGIN_CONTINUE
if(get_cvar_num("amx_onlyvip") && (!access(id,VIP))) return PLUGIN_CONTINUE
new nbut = get_user_button(id)
new obut = get_user_oldbutton(id)
if((nbut & IN_JUMP) && !(get_entity_flags(id) & FL_ONGROUND) && !(obut & IN_JUMP))
{
if(jumpnum[id] < get_cvar_num("amx_maxjumps"))
{
dojump[id] = true
jumpnum[id]++
return PLUGIN_CONTINUE
}
}
if((nbut & IN_JUMP) && (get_entity_flags(id) & FL_ONGROUND))
{
jumpnum[id] = 0
return PLUGIN_CONTINUE
}
return PLUGIN_CONTINUE
}
public client_PostThink(id)
{
if(!is_user_alive(id)) return PLUGIN_CONTINUE
if(get_cvar_num("amx_onlyvip") && (!access(id,VIP))) return PLUGIN_CONTINUE
if(dojump[id] == true)
{
new Float:velocity[3]
entity_get_vector(id,EV_VEC_velocity,velocity)
velocity[2] = random_float(265.0,285.0)
entity_set_vector(id,EV_VEC_velocity,velocity)
dojump[id] = false
return PLUGIN_CONTINUE
}
return PLUGIN_CONTINUE
}
ColorChat( id, Color:iType, const msg[ ], { Float, Sql, Result, _}:... )
{
// Daca nu se afla nici un jucator pe server oprim TOT. Altfel dam de erori..
if( !get_playersnum( ) ) return;
new szMessage[ 256 ];
switch( iType )
{
// Culoarea care o are jucatorul setata in cvar-ul scr_concolor.
case NORMAL: szMessage[ 0 ] = 0x01;
// Culoare Verde.
case GREEN: szMessage[ 0 ] = 0x04;
// Alb, Rosu, Albastru.
default: szMessage[ 0 ] = 0x03;
}
vformat( szMessage[ 1 ], 251, msg, 4 );
// Ne asiguram ca mesajul nu este mai lung de 192 de caractere.Altfel pica server-ul.
szMessage[ 192 ] = '^0';
new iTeam, iColorChange, iPlayerIndex, MSG_Type;
if( id )
{
MSG_Type = MSG_ONE_UNRELIABLE;
iPlayerIndex = id;
}
else
{
iPlayerIndex = CC_FindPlayer( );
MSG_Type = MSG_ALL;
}
iTeam = get_user_team( iPlayerIndex );
iColorChange = CC_ColorSelection( iPlayerIndex, MSG_Type, iType);
CC_ShowColorMessage( iPlayerIndex, MSG_Type, szMessage );
if( iColorChange ) CC_Team_Info( iPlayerIndex, MSG_Type, TeamName[ iTeam ] );
}
CC_ShowColorMessage( id, const iType, const szMessage[ ] )
{
static bool:bSayTextUsed;
static iMsgSayText;
if( !bSayTextUsed )
{
iMsgSayText = get_user_msgid( "SayText" );
bSayTextUsed = true;
}
message_begin( iType, iMsgSayText, _, id );
write_byte( id )
write_string( szMessage );
message_end( );
}
CC_Team_Info( id, const iType, const szTeam[ ] )
{
static bool:bTeamInfoUsed;
static iMsgTeamInfo;
if( !bTeamInfoUsed )
{
iMsgTeamInfo = get_user_msgid( "TeamInfo" );
bTeamInfoUsed = true;
}
message_begin( iType, iMsgTeamInfo, _, id );
write_byte( id );
write_string( szTeam );
message_end( );
return 1;
}
CC_ColorSelection( id, const iType, Color:iColorType)
{
switch( iColorType )
{
case RED: return CC_Team_Info( id, iType, TeamName[ 1 ] );
case BLUE: return CC_Team_Info( id, iType, TeamName[ 2 ] );
case GREY: return CC_Team_Info( id, iType, TeamName[ 0 ] );
}
return 0;
}
CC_FindPlayer( )
{
new iMaxPlayers = get_maxplayers( );
for( new i = 1; i <= iMaxPlayers; i++ )
if( is_user_connected( i ) )
return i;
return -1;
}