Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <amxmodx>
- #include <amxmisc>
- #include <ColorChat>
- #include <cstrike>
- #include <fun>
- #include <hamsandwich>
- #define PREFIX "[ ^4AMXX^1 ]"
- #define VERSION "v1.0"
- new g_pCvar;
- new bool:g_isEnabled;
- new bool:g_bResetHP;
- public plugin_init() {
- register_plugin("JailBreak Simple Box",VERSION,"Hyuna");
- register_cvar("jbsbox_version",VERSION,FCVAR_SERVER);
- register_clcmd("say /box","cmdBox");
- register_clcmd("say_team /box","cmdBox");
- RegisterHam(Ham_TakeDamage,"player","fwdHamTakeDamagePre",0);
- g_pCvar = get_cvar_pointer("mp_friendlyfire");
- if (!g_pCvar)
- set_fail_state("Failed to find cvar mp_friendlyfire");
- }
- public plugin_cfg() {
- set_pcvar_num(g_pCvar,0);
- }
- public cmdBox(client) {
- static some[256], iMenu, iCallBack;
- if (!isClientVaild(client))
- {
- ColorChat(client, NORMAL, "%s You must be ^3alive ^4Guard/Admin^1 to use the box system!",PREFIX);
- return PLUGIN_HANDLED;
- }
- iMenu = menu_create("[AMXX] Box Menu","mHandler");
- iCallBack = menu_makecallback("mCallback");
- formatex(some,charsmax(some),"Box Status: \d[ \r%sabled \d]",(g_isEnabled ? "En":"Dis"));
- menu_additem(iMenu,some);
- formatex(some,charsmax(some),"Reset HP to Terrorists: \d[ \r%sabled \d]",(g_bResetHP ? "En":"Dis"));
- menu_additem(iMenu,some,"",0,iCallBack);
- return PLUGIN_HANDLED;
- }
- public mCallback(client,menu,item) {
- return (g_isEnabled ? ITEM_DISABLED:ITEM_ENABLED);
- }
- public mHandler(client,menu,item) {
- static szName[32],players[32],pnum,i;
- if (item != MENU_EXIT)
- {
- switch(item)
- {
- case 0:
- {
- g_isEnabled = !g_isEnabled;
- get_user_name(client,szName,charsmax(szName));
- set_pcvar_num(g_pCvar,(g_isEnabled ? 1:0));
- if (g_isEnabled && g_bResetHP)
- {
- get_players(players,pnum,"aceh","TERRORIST");
- for (i = 0; i < pnum; i++)
- set_user_health(players[i],100);
- }
- ColorChat(client, NORMAL, "%s ^3%s^1 has ^4%sabled^1 the Box System!",PREFIX,szName,(g_isEnabled ? "en":"dis"));
- }
- case 1:
- {
- g_bResetHP = !g_bResetHP;
- ColorChat(client, NORMAL, "%s ^3Reset HP^1 is now ^4%sabled^1.",PREFIX,(g_bResetHP ? "en":"dis"));
- }
- }
- menu_destroy(menu); // Anti memory-leak
- return cmdBox(client);
- }
- menu_destroy(menu); // Anti memory-leak
- return PLUGIN_HANDLED;
- }
- public fwdHamTakeDamagePre(victim, idinflictor, attacker, Float:damage, damagebits) {
- static CsTeams:t1, CsTeams:t2;
- if (!is_user_alive(victim) || !is_user_alive(attacker))
- return HAM_IGNORED;
- t1 = cs_get_user_team(victim);
- t2 = cs_get_user_team(attacker);
- return ((t1 == CS_TEAM_T && t2 == CS_TEAM_CT) || (t1 == CS_TEAM_CT && t2 == CS_TEAM_CT)) ? HAM_SUPERCEDE:HAM_IGNORED;
- }
- stock bool:isClientVaild(client) {
- static CsTeams:tmp;
- if (!is_user_alive(client))
- return false;
- if (is_user_admin(client))
- return true;
- tmp = cs_get_user_team(client);
- if (tmp != CS_TEAM_T)
- return false;
- return true;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement