#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <fakemeta>
#include <fun>
#include <hamsandwich>
#include <engine>
#pragma tabsize 0;
#define PLUGIN "Meniu V.I.P"
#define VERSION "1.0"
#define AUTHOR "MrGaben"
#define VIP_LEVEL ADMIN_LEVEL_F
new const gTitle[] = "Beneficii V.I.P"
new Prefix[] = "[Dark]"
#define COLOR "^x04"
#define CONTACT "
[email protected]"
#define is_user_vip(%1) (get_user_flags(%1) & VIP_LEVEL )
const TASK_ID = 12323;
new jumpnum[33] = 0
new bool: dojump[33] = false
new cvar_vip_health, cvar_vip_armor, cvar_vip_ap_kill, cvar_vip_hp_kill, cvar_vip_ap_hs, cvar_vip_hp_hs , cvar_vip_money_kill, cvar_vip_money_hs, cvar_vip_jumps
new maxplayers
new gmsgSayText
new g_knife[33]
public plugin_init() {
register_plugin(PLUGIN, VERSION, AUTHOR)
RegisterHam(Ham_Spawn, "player", "p_Spawn", 1);
register_event( "DeathMsg" , "DeathMsgEvent" , "a" );
register_event("CurWeapon", "CurWeapon", "be");
cvar_vip_armor = register_cvar("vip_spawn_armor", "150") //Armura la spawn
cvar_vip_health = register_cvar("vip_spawn_health", "150") //Viata la spawn
cvar_vip_ap_kill = register_cvar("vip_kill_armor", "10") //Armura pe kill
cvar_vip_hp_kill = register_cvar("vip_kill_health", "10") //Viata pe kill
cvar_vip_ap_hs = register_cvar("vip_hs_armor", "15") //Armura pe Hs
cvar_vip_hp_hs = register_cvar("vip_hs_health", "15") //Viata pe Hs
cvar_vip_money_kill = register_cvar("vip_kill_money", "16000") //Bani pe un kill
cvar_vip_money_hs = register_cvar("vip_hs_money", "16000") //Bani pe un hs
cvar_vip_jumps = register_cvar("vip_max_jumps", "3") //De cate ori poate sari
//register_clcmd("say /vmenu","UltracsMenu");
//register_clcmd("say_team /vmenu","UltracsMenu");
register_clcmd("say /vips", "print_adminlist", 1)
register_clcmd("say /vip", "Motd");
maxplayers = get_maxplayers()
gmsgSayText = get_user_msgid("SayText")
register_event( "ResetHUD", "ev_ResetHud", "be" );
}
public p_Spawn(id){
if(get_user_flags(id) & VIP_LEVEL )
{
set_user_health(id, get_pcvar_num(cvar_vip_health) )
set_user_armor(id, get_pcvar_num(cvar_vip_armor) )
UltracsMenu(id);
}
}
public plugin_precache()
{
engfunc(EngFunc_PrecacheModel, "models/v_knife_axe.mdl")
engfunc(EngFunc_PrecacheModel, "models/p_knife_axe.mdl")
}
public client_putinserver ( id )
{
g_knife[id] = false
if ( is_user_vip ( id ) ) ColorChat ( id, "!g[Dark] V.I.P-ul!t %s!g se conecteaza.", get_name ( id ) , Prefix );
}
public client_disconnect(id)
g_knife[id] = false
public client_connect(id)
g_knife[id] = false
public DeathMsgEvent()
{
new iKiller = read_data( 1 );
new headshot = read_data( 3 );
if(get_user_flags(iKiller) & VIP_LEVEL )
{
set_user_health(iKiller, get_user_health(iKiller) + get_pcvar_num(cvar_vip_hp_kill) )
set_user_armor(iKiller, get_user_armor(iKiller) + get_pcvar_num(cvar_vip_ap_kill) )
cs_set_user_money( iKiller, cs_get_user_money( iKiller ) + get_pcvar_num(cvar_vip_money_kill ) );
if(headshot)
set_user_health(headshot, get_user_health(headshot) + get_pcvar_num(cvar_vip_hp_hs))
set_user_armor(headshot, get_user_armor(headshot) + get_pcvar_num(cvar_vip_ap_hs))
cs_set_user_money(headshot, cs_get_user_money( headshot ) + get_pcvar_num(cvar_vip_money_hs));
}
}
public ev_ResetHud( id )
{
set_task( 0.1, "addviptab", id + TASK_ID );
}
public addviptab( taskid )
{
new i_Index = taskid - TASK_ID;
if( get_user_flags( i_Index ) & VIP_LEVEL )
{
message_begin( MSG_ALL, get_user_msgid( "ScoreAttrib" ) );
write_byte( i_Index );
write_byte( 4 );
message_end( );
}
}
public UltracsMenu(id) {
if( get_user_flags( id ) & VIP_LEVEL ) {
new menu = menu_create ("\wMeniu \rV.I.P", "CaseMenu");
menu_additem(menu, "\wScout cu 10 gloante", "1");
menu_additem(menu, "\wGlock cu 20 gloante", "2");
menu_additem(menu, "\w200 viata", "3");
menu_additem(menu, "\w100 gravitate", "4");
menu_additem(menu, "\wInvizibilitate completa", "5");
menu_additem(menu, "\wSkin Knife", "6");
menu_additem(menu, "\wViteza", "7");
menu_setprop(menu, MPROP_EXIT, MEXIT_ALL);
menu_display(id, menu, 0 );
}
else
{
ColorChat(id, "[Dark] Nu esti V.I.P ! Pentru a cumpara contacteaza un fondator !", CONTACT)
}
}
public CaseMenu(id, menu, item)
{
if(item == MENU_EXIT)
{
return 1;
}
new data [6], szName [64];
new access, callback;
menu_item_getinfo (menu, item, access, data,charsmax (data), szName,charsmax (szName), callback);
new key = str_to_num (data);
switch (key)
{
case 1:{
give_item(id, "weapon_scout");
cs_set_user_bpammo(id, CSW_SCOUT, 0);
ColorChat(id, "!t[Dark] !gAi ales Scoutul cu 10 gloante !", Prefix);
}
case 2:{
give_item(id, "weapon_glock18");
cs_set_user_bpammo(id, CSW_GLOCK18, 0);
ColorChat(id, "!t[Dark] !gAi ales Glockul cu 20 gloante !", Prefix);
}
case 3:{
set_user_health(id, 200);
ColorChat(id, "!t[Dark] !gAi ales sa ai 200 viata !", Prefix);
}
case 4:{
set_user_gravity(id, 100.0);
ColorChat(id, "!t[Dark] Ai ales sa ai 100 gravitatie !", Prefix);
}
case 5:{
set_user_rendering(id, kRenderFxNone, 0, 0, 0, kRenderTransAlpha, 0);
ColorChat(id, "!t[Dark] Ai ales sa fii invizibil complet !", Prefix);
}
case 6:{
give_knife(id)
ColorChat(id, "!t[Dark] Ai ales Knife Skin !", Prefix);
}
case 7:{
set_user_maxspeed(id, 400.0);
ColorChat(id, "!t[Dark] Ai ales viteza !", Prefix);
}
}
menu_destroy (menu);
return 1;
}
public give_knife(id)
{
g_knife[id] = true
engfunc(EngFunc_EmitSound, id, CHAN_BODY, "items/gunpickup2.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)
}
public CurWeapon(id) {
if (!is_user_alive(id))
return PLUGIN_HANDLED;
new weapon = get_user_weapon(id)
if (weapon == CSW_KNIFE && g_knife[id])
checkModel(id)
return PLUGIN_HANDLED;
}
public checkModel(id)
{
new weapon = get_user_weapon(id)
if(weapon == CSW_KNIFE)
{
if (g_knife[id])
{
set_pev(id, pev_viewmodel2, "models/v_knife_axe.mdl")
set_pev(id, pev_weaponmodel2, "models/p_knife_axe.mdl")
}
}
return PLUGIN_HANDLED
}
public client_PreThink(id)
{
if(!is_user_alive(id))
{
return PLUGIN_HANDLED;
}
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(get_user_flags(id) & VIP_LEVEL )
{
if(jumpnum[id] < get_pcvar_num(cvar_vip_jumps))
{
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_user_flags(id) & VIP_LEVEL )
{
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;
}
stock get_name( id )
{
new name[ 32 ];
get_user_name( id, name, sizeof ( name ) -1 );
return name;
}
public print_adminlist(user)
{
new adminnames[33][32]
new message[256]
new contactinfo[256], contact[112]
new id, count, x, len
for(id = 1 ; id <= maxplayers ; id++)
if(is_user_connected(id))
if(get_user_flags(id) & VIP_LEVEL)
get_user_name(id, adminnames[count++], 31)
len = format(message, 255, "%s [Membrii V.I.P] - ",COLOR)
if(count > 0) {
for(x = 0 ; x < count ; x++) {
len += format(message[len], 255-len, "%s%s ", adminnames[x], x < (count-1) ? ", ":"")
if(len > 96 ) {
print_message(user, message)
len = format(message, 255, "%s ",COLOR)
}
}
print_message(user, message)
}
else {
len += format(message[len], 255-len, "Nu sunt Membrii V.I.P conectati !")
print_message(user, message)
}
get_cvar_string("amx_contactinfo", contact, 63)
if(contact[0]) {
format(contactinfo, 111, "Fondator MrGaben sau Fondator Kaydo", COLOR, contact)
print_message(user, contactinfo)
}
}
print_message(id, msg[]) {
message_begin(MSG_ONE, gmsgSayText, {0,0,0}, id)
write_byte(id)
write_string(msg)
message_end()
}
public Motd(id) {
new iCfgDir[32], iFile[192];
get_configsdir(iCfgDir, charsmax(iCfgDir));
formatex(iFile, charsmax(iFile), "%s/vip.html", iCfgDir);
show_motd(id, iFile, gTitle);
}
stock ColorChat(const id, const input[], any:...)
{
new count = 1, Jucatori[32]
static msg[191]
vformat(msg, 190, input, 3)
replace_all(msg, 190, "!g", "^4") // Culoarea Verde
replace_all(msg, 190, "!n", "^1") // Culoarea Normala a Chat-ului (galben)
replace_all(msg, 190, "!t", "^3") // Culoarea Echipei : CT = Albastru | T = Rosu.
if (id) Jucatori[0] = id; else get_players(Jucatori, count, "ch")
{
for (new Y = 0; Y < count; Y++)
{
if (is_user_connected(Jucatori[Y]))
{
message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("SayText"), _, Jucatori[Y])
write_byte(Jucatori[Y]);
write_string(msg);
message_end();
}
}
}
}