Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* Copyright © 2019, PartialCloning
- This software is free software;
- you can redistribute it and/or modify it under the terms of the
- GNU General Public License as published by the Free Software Foundation.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this software; if not, write to the
- Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA.
- I, PartialCloning, retain ownership of anything I write.
- (the GPL grants you all the rights you could need).
- */
- #include <amxmodx>
- #include <amxmisc>
- #include <cstrike>
- #include <csx>
- #include <engine>
- #include <fakemeta>
- #include <hamsandwich>
- #define VIP_ACCESS ADMIN_LEVEL_H
- #define HUD_RED 0
- #define HUD_GREEN 255
- #define HUD_BLUE 0
- #define HUD_X 0.05
- #define HUD_Y 0.55
- #define HUD_TIME 6.0
- enum GoldWeaponsEnum {GOLD_V[64], GOLD_P[64], GOLD_W[64]};
- new const g_szGoldWeapon[][GoldWeaponsEnum] =
- {
- {"", "", ""}, //CSW_NONE
- {"", "", ""}, //CSW_P228
- {"", "", ""}, //CSW_GLOCK (Unused by game, See CSW_GLOCK18)
- {"", "", ""}, //CSW_SCOUT
- {"", "", ""}, //CSW_HEGRENADE
- {"", "", ""}, //CSW_XM1014
- {"", "", ""}, //CSW_C4 (You can't buy a C4)
- {"", "", ""}, //CSW_MAC10
- {"", "", ""}, //CSW_AUG
- {"", "", ""}, //CSW_SMOKEGRENADE
- {"", "", ""}, //CSW_ELITE
- {"", "", ""}, //CSW_FIVESEVEN
- {"", "", ""}, //CSW_UMP45
- {"", "", ""}, //CSW_SG550
- {"", "", ""}, //CSW_GALIL
- {"", "", ""}, //CSW_FAMAS
- {"", "", ""}, //CSW_USP
- {"", "", ""}, //CSW_GLOCK18
- {"models/weapons/gold/v_awp.mdl", "models/weapons/gold/p_awp.mdl", "models/weapons/gold/w_awp.mdl"}, //CSW_AWP
- {"", "", ""}, //CSW_MP5NAVY
- {"", "", ""}, //CSW_M249
- {"", "", ""}, //CSW_M3
- {"models/weapons/gold/v_m4a1.mdl", "models/weapons/gold/p_m4a1.mdl", "models/weapons/gold/w_m4a1.mdl"}, //CSW_M4A1
- {"", "", ""}, //CSW_TMP
- {"", "", ""}, //CSW_G3SG1
- {"", "", ""}, //CSW_FLASHBANG
- {"models/weapons/gold/v_deagle.mdl", "models/weapons/gold/p_deagle.mdl", "models/weapons/gold/w_deagle.mdl"}, //CSW_DEAGLE
- {"", "", ""}, //CSW_SG552
- {"models/weapons/gold/v_ak47.mdl", "models/weapons/gold/p_ak47.mdl", "models/weapons/gold/w_ak47.mdl"}, //CSW_AK47
- {"", "", ""}, //CSW_KNIFE
- {"", "", ""}, //CSW_P90
- };
- #define IMPULSECODE_GOLD 1234504321
- new FMSetModelID, bool:g_bBoughtGolden[33];
- public plugin_precache()
- {
- for(new i = CSW_P228; i < sizeof(g_szGoldWeapon); i++)
- {
- if(g_szGoldWeapon[i][GOLD_V][0] != EOS)
- precache_model(g_szGoldWeapon[i][GOLD_V]);
- if(g_szGoldWeapon[i][GOLD_P][0] != EOS)
- precache_model(g_szGoldWeapon[i][GOLD_P]);
- if(g_szGoldWeapon[i][GOLD_W][0] != EOS)
- precache_model(g_szGoldWeapon[i][GOLD_W]);
- }
- }
- public plugin_init()
- {
- register_plugin("VIP", "1.0", "Partial Cloning");
- register_clcmd("say", "CMD_Say", VIP_ACCESS, "@<text> - Displays HUD message.", 0);
- register_clcmd("say_team /vip", "CMD_VIPs");
- register_clcmd("say_team /vips", "CMD_VIPs");
- register_clcmd("say /vip", "CMD_VIPs");
- register_clcmd("say /vips", "CMD_VIPs");
- register_clcmd("say_team vip", "CMD_VIPs");
- register_clcmd("say_team vips", "CMD_VIPs");
- register_clcmd("say vip", "CMD_VIPs");
- register_clcmd("say vips", "CMD_VIPs");
- register_clcmd("say vm", "CMD_vipmenu");
- register_clcmd("say vipmenu", "CMD_vipmenu");
- register_clcmd("say /vm", "CMD_vipmenu");
- register_clcmd("say /vipmenu", "CMD_vipmenu");
- register_clcmd("say_team /vipmenu", "CMD_vipmenu");
- register_clcmd("say_team /vm", "CMD_vipmenu");
- register_clcmd("say_team vm", "CMD_vipmenu");
- register_clcmd("say_team /vipmenu", "CMD_vipmenu");
- register_clcmd("say wantvip", "cmdMOTD", -1);
- register_clcmd("say /wantvip", "cmdMOTD", -1);
- register_clcmd("say_team wantvip", "cmdMOTD", -1);
- register_clcmd("say_team /wantvip", "cmdMOTD", -1);
- new szWeapon[32];
- for(new i = CSW_P228; i < CSW_P90; i++)
- {
- if(g_szGoldWeapon[i][GOLD_V][0] == EOS || !get_weaponname(i, szWeapon, charsmax(szWeapon)))
- continue;
- RegisterHam(Ham_Item_Deploy, szWeapon, "Ham_WeaponDeploy_Post", true);
- RegisterHam(Ham_Item_AddToPlayer, szWeapon, "Ham_AddWeaponToPlayer_Post", true);
- }
- RegisterHam(Ham_Spawn, "weaponbox", "Ham_WeaponBoxSpawn_Post", true);
- RegisterHam(Ham_Touch, "weaponbox", "Ham_TouchWeaponbox");
- RegisterHam(Ham_Spawn, "player", "HamOnPlayerSpawnPost", 1);
- }
- public client_putinserver(id)
- {
- if(get_user_flags(id) & VIP_ACCESS)
- set_task(2.0, "TaskAnnounceConnect", id);
- }
- public client_disconnected(id)
- {
- g_bBoughtGolden[id] = false;
- remove_task(id);
- }
- public TaskAnnounceConnect(id)
- {
- set_hudmessage(HUD_RED, HUD_GREEN, HUD_BLUE, HUD_X, HUD_Y, 0, HUD_TIME, HUD_TIME, 0.5, 0.15);
- show_hudmessage(0, "VIP ^"%n^" Connected!^nThank you for supporting the server!", id);
- }
- public CMD_Say(id, Level)
- {
- if(!access(id, Level))
- return PLUGIN_CONTINUE;
- new Message[192];
- read_argv(1, Message, charsmax(Message));
- if(Message[0] != '@')
- return PLUGIN_CONTINUE;
- read_args(Message, charsmax(Message));
- remove_quotes(Message);
- static Y;
- if(++Y > 6 || Y < 3)
- Y = 3;
- set_hudmessage(HUD_RED, HUD_GREEN, HUD_BLUE, HUD_X, HUD_Y + (float(Y) / 35.0), 0, HUD_TIME, HUD_TIME, 0.5, 0.15);
- show_hudmessage(0, "%n : %s", id, Message[1]);
- client_print(0, print_notify, "%n : %s", id, Message[1]);
- return PLUGIN_HANDLED;
- }
- public Ham_WeaponDeploy_Post(Entity)
- {
- if(pev(Entity, pev_impulse) != IMPULSECODE_GOLD)
- return HAM_IGNORED;
- new CSW = get_ent_data(Entity, "CBasePlayerItem", "m_iId");
- if(g_szGoldWeapon[CSW][GOLD_V][0] == EOS)
- return HAM_IGNORED;
- new id = get_ent_data_entity(Entity, "CBasePlayerItem", "m_pPlayer");
- if(!(get_user_flags(id) & VIP_ACCESS))
- return HAM_IGNORED;
- set_pev(id, pev_viewmodel2, g_szGoldWeapon[CSW][GOLD_V][0]);
- if(g_szGoldWeapon[CSW][GOLD_P][0] != EOS)
- set_pev(id, pev_weaponmodel2, g_szGoldWeapon[CSW][GOLD_P][0]);
- return HAM_IGNORED;
- }
- public Ham_AddWeaponToPlayer_Post(Entity, id)
- {
- if(g_bBoughtGolden[id])
- {
- g_bBoughtGolden[id] = false;
- set_pev(Entity, pev_impulse, IMPULSECODE_GOLD);
- }
- return HAM_IGNORED;
- }
- public Ham_WeaponBoxSpawn_Post()
- {
- FMSetModelID = register_forward(FM_SetModel, "FakeMeta_SetModel");
- }
- public FakeMeta_SetModel(Entity)
- {
- unregister_forward(FM_SetModel, FMSetModelID);
- if(pev_valid(Entity) != 2)
- return FMRES_IGNORED;
- new Weapon, CSW;
- for(new i = CS_WEAPONSLOT_PRIMARY; i <= CS_WEAPONSLOT_C4; i++)
- {
- Weapon = get_ent_data_entity(Entity, "CWeaponBox", "m_rgpPlayerItems", i);
- if(pev_valid(Weapon) != 2 || pev(Weapon, pev_impulse) != IMPULSECODE_GOLD || g_szGoldWeapon[(CSW = get_ent_data(Weapon, "CBasePlayerItem", "m_iId"))][GOLD_W][0] == EOS)
- continue;
- engfunc(EngFunc_SetModel, Entity, g_szGoldWeapon[CSW][GOLD_W]);
- return FMRES_SUPERCEDE;
- }
- return FMRES_IGNORED;
- }
- public grenade_throw(id, Grenade, CSW)
- {
- if(g_szGoldWeapon[CSW][GOLD_V][0] == EOS|| g_szGoldWeapon[CSW][GOLD_W][0] == EOS)
- return;
- new szViewModel[32];
- pev(id, pev_viewmodel2, szViewModel, charsmax(szViewModel));
- if(equal(szViewModel, g_szGoldWeapon[CSW][GOLD_V]))
- engfunc(EngFunc_SetModel, Grenade, g_szGoldWeapon[CSW][GOLD_W]);
- }
- public Ham_TouchWeaponbox(Entity, id)
- {
- if(!(1 <= id <= MaxClients) || !is_user_alive(id) || pev_valid(Entity) != 2 || !(pev(Entity, pev_flags) & FL_ONGROUND))
- return HAM_IGNORED;
- new Weapon; static Float:flPrinTime[33];
- for(new i = CS_WEAPONSLOT_PRIMARY; i <= CS_WEAPONSLOT_C4; i++)
- {
- Weapon = get_ent_data_entity(Entity, "CWeaponBox", "m_rgpPlayerItems", i);
- if(pev_valid(Weapon) != 2 || pev(Weapon, pev_impulse) != IMPULSECODE_GOLD || g_szGoldWeapon[get_ent_data(Weapon, "CBasePlayerItem", "m_iId")][GOLD_W][0] == EOS)
- continue;
- if(!(get_user_flags(id) & VIP_ACCESS))
- {
- if(flPrinTime[id] < get_gametime())
- {
- flPrinTime[id] = get_gametime() + 1.9;
- client_print(id, print_center, "You must be VIP to use gold weapons!");
- }
- return HAM_SUPERCEDE;
- }
- }
- return HAM_IGNORED;
- }
- public CS_OnBuy(id, Item)
- {
- if(Item >= sizeof(g_szGoldWeapon) || !(get_user_flags(id) & VIP_ACCESS))
- return PLUGIN_CONTINUE;
- if(g_szGoldWeapon[Item][GOLD_V][0] != EOS || g_szGoldWeapon[Item][GOLD_W][0] != EOS)
- g_bBoughtGolden[id] = true;
- return PLUGIN_CONTINUE;
- }
- public CMD_vipmenu(id)
- {
- client_print(id, print_chat, "The VIP system does NOT have a vipmenu, type /wantvip to see what your VIP options are. ")
- }
- public CMD_VIPs(id)
- {
- new Message[256], Names[33][32], Players[32], Num, Count, Len;
- get_players(Players, Num, "h");
- for(new i = 0; i < Num; i++)
- {
- if(get_user_flags(Players[i]) & VIP_ACCESS)
- get_user_name(Players[i], Names[Count++], charsmax(Names));
- }
- if(Count > 0)
- {
- Len = formatex(Message, charsmax(Message), "VIPs Online: ");
- for(new i; i < Count; i++)
- {
- Len += formatex(Message[Len], charsmax(Message) - Len, "%s%s", Names[i], i < (Count - 1) ? ", " : "");
- if(Len > 96)
- {
- client_print_color(id, print_team_default, "^4%s", Message);
- Len = 0;
- }
- }
- client_print_color(id, print_team_default, "^4%s", Message);
- }
- else
- client_print_color(id, print_team_default, "^4No VIPs online.");
- }
- public cmdMOTD(id)
- {
- show_motd(id, "vipmotd.txt", "MOTD");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement