
/* 
===============================================================================
= 
AMX Mod Plugin 
http://amxmod.net 
-------------------------------------------------------------------------------
- 
Name     : Blanks 
Author : Freecode/T(+)rget/AssKicR <Freecode@hotmail.com>
-------------------------------------------------------------------------------
- 
Blanks v 1.2.0 
         Created by Freecode/T(+)rget/AssKicR

         Blanks 
         =========== 
         This plugin makes people shoot blanks out of their gun. When set on a 
certain 
         player he will shoot blanks which mean cant do damage to anyone. 

         USAGE 
         ===== 

         * amx_blank <name/id/wonid/@CT/@TERRORIST> 
         * amx_unblank <name/id/wonid/@CT/@TERRORIST> 
         * amx_saveblank <nick, authid, #userid>
         * amx_delsaveblank <nick, authid, #userid>(coming soon)

         Releases: 
         ======== 
         2003-07-29      version 1.0.0: 
                                                First version 
         2003-07-31      version 1.1.0 
                                                Fixed @TEAM 

         2003-06-08  version 1.2.0
                                                AssKicR Added:
                                                        Messages when commands 
are issued
                                                        amx_saveblank - Saving 
blanks in file so they are blanked forever
         TO DO 
         ===== 
         Make it so knife and granades wont do any damage. 
         make a amx_delsavedblank to delete wonid without editing blanked.ini m
anually

-------------------------------------------------------------------------------
- 
Installation : 
- Extract file blanks.amx to directory addons/amx/plugins 
- Open addons/amx/plugins/plugins.ini 
- Add a line containing : blanks.amx 
==================================================================== 
*/ 


#include <amxmod> 
#include <amxmisc> 

new bool:BlankFlag[33] 

public amx_blank(id, level, cid) { 
        if(!cmd_access(id, level, cid, 2)) return PLUGIN_HANDLED 

        new arg[32] 
        read_argv(1, arg, 31) 

        if(arg[0] == '@') { 
                new users[32], inum 
                get_players(users, inum, "ae", arg[1]) 
                if(inum == 0) { 
                        console_print(id, "No users in such team") 
                        return PLUGIN_HANDLED 
                } 
                for(new i = 0; i < inum; ++i) { 
                        set_user_hitzones(users[i], 0, 0) 
                        BlankFlag[users[i]] = true 
                } 
                new name1[33]
                get_user_name(id,name1,32)
                switch(get_cvar_num("amx_show_activity"))        { 
                        case 2:  client_print(0,print_chat,"ADMIN %s: filled al
l %s's Guns with blanks",name1,arg) 
                        case 1:  client_print(0,print_chat,"ADMIN: Fill all %s'
s Guns with blanks",arg) 
                } 
                console_print(id,"All clients on the %s team has Blanks",arg) 
        } else { 
                new uid = cmd_target(id, arg, 5) 
                if(!uid) return PLUGIN_HANDLED 
                set_user_hitzones(uid, 0, 0) 
                BlankFlag[uid] = true 
                new name1[33],name2[33]
                get_user_name(id,name1,32)
                get_user_name(uid,name2,32)
                switch(get_cvar_num("amx_show_activity"))        { 
                        case 2:  client_print(0,print_chat,"ADMIN %s: filled %s
's Guns with blanks",name1,name2) 
                        case 1:  client_print(0,print_chat,"ADMIN: Fill %s's Gu
ns with blanks",name2) 
                } 
                console_print(id,"Client %s has Blanks",name2) 
        } 
        return PLUGIN_HANDLED 
        } 

        public amx_unblank(id, level, cid) { 
        if(!cmd_access(id, level, cid, 2)) return PLUGIN_HANDLED 

        new arg[32] 
        read_argv(1, arg, 31) 

        if(arg[0] == '@') { 
                new users[32], inum 
                get_players(users, inum, "ae", arg[1]) 
                if(inum == 0) { 
                        console_print(id, "No users in such team") 
                        return PLUGIN_HANDLED 
                } 
                for(new i = 0; i < inum; ++i) { 
                        set_user_hitzones(users[i], 0, 255) 
                        BlankFlag[users[i]] = false 
                }
                new name1[33]
                get_user_name(id,name1,32)
                switch(get_cvar_num("amx_show_activity"))        { 
                        case 2:  client_print(0,print_chat,"ADMIN %s: gave real
 bullets to all %s's",name1,arg) 
                        case 1:  client_print(0,print_chat,"ADMIN: Give real bu
llets to all %s's",arg) 
                } 
                console_print(id,"All clients on the %s team has Real Bullets",
arg) 
        } else { 
                new uid = cmd_target(id, arg, 5) 
                if(!uid) return PLUGIN_HANDLED 
                set_user_hitzones(uid, 0, 255) 
                BlankFlag[uid] = false
                new name1[33],name2[33]
                get_user_name(id,name1,32)
                get_user_name(uid,name2,32)
                switch(get_cvar_num("amx_show_activity"))        { 
                        case 2:  client_print(0,print_chat,"ADMIN %s: gave real
 bullets to %s",name1,name2) 
                        case 1:  client_print(0,print_chat,"ADMIN: Give real bu
llets to %s",name2) 
                } 
                console_print(id,"Client %s has Real Bullets",name2) 
        }
        return PLUGIN_HANDLED 
} 

public blank_update() { 
        new users[32], inum 
        get_players(users, inum) 
        for(new i = 0; i < inum; ++i) if(BlankFlag[users[i]] == true) set_user_
hitzones(users[i], 0, 0) /* Hitzone FIX */ 
} 

public plugin_init() { 
        register_plugin("Blanks", "1.2.0", "Freecode/T(+)rget/AssKicR") 
        register_event("RoundTime", "blank_update", "bc") 
        register_clcmd("amx_blank", "amx_blank", ADMIN_SLAY, "<nick, authid, #u
serid, @team> - makes people shoot blanks") 
        register_clcmd("amx_unblank", "amx_unblank", ADMIN_SLAY, "<nick, authid
, #userid, @team> - makes people shoot real bullets")
        register_clcmd("amx_saveblank", "amx_saveblank", ADMIN_BAN, "<nick, aut
hid, #userid> - makes people shoot blanks & Saves it") 
}

public amx_saveblank(id, level, cid) { 
        if(!cmd_access(id, level, cid, 2)) return PLUGIN_HANDLED 
        new arg[32] 
        read_argv(1, arg, 31) 

        new player = cmd_target(id, arg, 5) 
        if(!player) return PLUGIN_HANDLED 

        set_user_hitzones(player, 0, 0) 
        BlankFlag[player] = true 
        new Logg[100]
        new authid[33]
        get_user_authid(player,authid,32)
        format(Logg,99,"%s",authid) 
        write_file("addons/amx/blanked.cfg",Logg,-1)

        new name1[33],name2[33]
        get_user_name(id,name1,32)
        get_user_name(player,name2,32)
        client_print(0,print_chat,"[AMX] Admin:%s filled %s's Guns with blanks"
,name1,name2)
        return PLUGIN_HANDLED 
} 

public client_putinserver(id) {
        if(file_exists("addons/amx/blanked.ini") == 1){ 
                new line, stxtsize 
                new data[192] 
                while((line=read_file("addons/amx/blanked.ini",line,data,191,st
xtsize))!=0) { 
                        for(new uid=1;uid<33;++uid){ 
                                new authid[33]
                                get_user_authid(uid,authid,32)
                                if (equal(data,authid)) { 
                                        BlankFlag[uid] = true
                                        client_print(0,print_chat,"[AMX] Blanke
d Client Connected")
                                } 
                        } 
                }
        } 
}

public client_disconnect(id) {
if (BlankFlag[id]) {
        client_print(0,print_chat,"[AMX] Blanked Client Disconnected")
        BlankFlag[id] = false
        }
}
