PHP Code:
/**
* Nozgaming.eu VIP Management 1.0 (c) Lawnmoverman
* www.nozgaming.eu | cs.nozgaming.eu
*
* Precache vip player models in your sub plugin
* This plugin should be last in your plugins.ini list
**/
#include <amxmodx>
#include <amxmisc>
#include <engine>
#include <cstrike>
#include <fun>
#include <hamsandwich>
#include <chatcolor>
#include <dhudmessage>
new UserName[32];
/*new SteamID[34];
new UserID[3];*/
new CsTeams:g_iTeam[33];
/*new bool:HasSite;*/
public plugin_init()
{
register_plugin("Nozgaming.eu VIP Management", "1.0", "Lawnmoverman");
register_event("TeamInfo", "event_TeamInfo", "a");
}
// Tell to all that VIP joined the server
public client_putinserver(id)
{
if(get_user_flags(id) & read_flags("s"))
{
get_user_name(id, UserName, charsmax(UserName));
client_print_color(0, 0,"^3[Vip] ^4User^3 %s ^4have joined the server, ^3VIP ^4priveleges granted!", UserName);
}
}
// Set VIP model to player
public fw_spawn_post(id)
{
if(get_user_flags(id) & read_flags("s"))
{
if (!is_user_alive(id))
return HAM_IGNORED;
new CsTeams:team = cs_get_user_team(id);
cs_set_user_model(id, team == CS_TEAM_CT ? "noz_vip_ct" : "noz_vip_t"); // Your model names here
return HAM_IGNORED;
}
return PLUGIN_HANDLED;
}
// VIP extras on spawn
public player_spawn(id)
{
if(get_user_flags(id) & read_flags("s"))
{
if (!is_user_alive(id))
cs_set_user_money(id, (cs_get_user_money(id) + 500)); // Gives extra $500 on every spawn
// Gives 2 flashbangs and 1 smokegrenade
give_item(id,"weapon_flashbang");
give_item(id,"weapon_flashbang");
give_item(id,"weapon_smokegrenade");
set_user_health(id, 120); // Sets user health to 120
set_user_rendering(id,kRenderFxGlowShell,0,0,0,kRenderTransAlpha,30); // Makes player semi transparent
set_task(5.0, "renderNormal", id); // Makes player normal after 5 secs
// Gives defuser if CT
if( is_user_alive(id) && cs_get_user_team(id) == CS_TEAM_CT )
{
cs_set_user_defuse(id, 1);
}
}
}
// Makes player rendering normal
public renderNormal(id)
{
set_user_rendering(id, kRenderNormal);
}
// Events on VIP when changing team, or when joining team for the first time
public event_TeamInfo(id)
{
if(get_user_flags(id) & read_flags("s"))
{
static sTeam[16];
static const iTeamLen = sizeof(sTeam) - 1;
read_data(2, sTeam, iTeamLen);
static CsTeams:iTeam;
switch(sTeam[0])
{
case 'U': iTeam = CS_TEAM_UNASSIGNED;
case 'T': iTeam = CS_TEAM_T;
case 'C': iTeam = CS_TEAM_CT;
case 'S': iTeam = CS_TEAM_SPECTATOR;
}
static id; id = read_data(1);
if(g_iTeam[id] != iTeam)
{
// VIP joined new team
get_user_name(id, UserName, charsmax(UserName));
if(iTeam == CS_TEAM_T)
{
// This will alert all players that VIP joined Ts
client_print_color(0, 0,"^3[Vip] ^4User^3 %s ^4have joined the ^3Terrorists ^4team!", UserName);
}
if(iTeam == CS_TEAM_CT)
{
// This will alert all players that VIP joined CTs
client_print_color(0, 0,"^3[Vip] ^4User^3 %s ^4have joined the ^3Counter-Terrorists ^4team!", UserName);
}
else
{
// This will alert all players that VIP joined Spectators
client_print_color(0, 0,"^3[Vip] ^4User^3 %s ^4have gone to ^3Spectators^4!", UserName);
}
if(g_iTeam[id] == CS_TEAM_UNASSIGNED)
{
// VIP joins team for the first time
set_task(10.0, "alertPlayer", id);
set_task(10.0, "setupVIP_3rdparty", id);
}
}
g_iTeam[id] = iTeam;
return PLUGIN_CONTINUE;
}
return PLUGIN_HANDLED;
}
// This code alerts player that he is VIP, this is called after 10 secs, when player joins team for the first time
public alertPlayer(id)
{
get_user_name(id, UserName, charsmax(UserName));
client_print_color(id, 0,"^3[Vip] ^4Welcome^3 %s ^4, you have ^3VIP ^4access, priveleges granted!", UserName);
set_dhudmessage( 44, 79, 255, -1.0, 0.25, 2, 6.0, 3.0, 0.1, 1.5 );
show_dhudmessage(id, "[Vip] Special priveleges granted!");
client_cmd(id, "spk ^"access granted^"");
}
// Third party plugin commands to execute on VIP, when he joins team for the first time
public setupVIP_3rdparty(id)
{
server_cmd("amx_speed #%d ON 106", get_user_userid(id));
server_cmd("amx_autobhop #%d 1", get_user_userid(id));
}