Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <amxmodx>
- #include <amxmisc>
- native zp_get_user_ammo_packs(id)
- native zp_set_user_ammo_packs(id, amount)
- #define LOG_FILE "a_giveap_.log"
- #define LOG_FILE2 "a_removeap.log"
- public plugin_init()
- {
- register_plugin("GiveAP", "1.0", "X3")
- register_concmd ( "zp_giveap", "AddAmmo", ADMIN_RCON, "<nick, #userid, authid | @all / @ct / @t> <ap>" )
- register_concmd ( "zp_removeap", "RemoveAmmo", ADMIN_RCON, "<nick, #userid, authid | @all / @ct / @t> <ap>" )
- }
- public AddAmmo(iPlayer, level, cid)
- {
- if(!cmd_access(iPlayer, level, cid, 3)) return PLUGIN_HANDLED;
- new arg [32]
- read_argv (1, arg, 31)
- new Ammo [32]
- read_argv (2, Ammo, charsmax (Ammo))
- new ammo = str_to_num (Ammo)
- new admin [32]
- new player [32]
- get_user_name (iPlayer, admin, charsmax (admin))
- if(arg[0]=='@')
- {
- if(equali(arg[1],"All") || equali(arg[1],"ALL"))
- {
- new players[32], totalplayers, All
- get_players(players, totalplayers)
- for (new i = 0; i < totalplayers; i++)
- {
- All = players[i]
- zp_set_user_ammo_packs(All,zp_get_user_ammo_packs(All)+ ammo)
- }
- client_print_color(0,"^1[ADMIN] ^4%s: ^1give ^4%i ^1AmmoPacks to ^4All Players!", admin, ammo )
- }
- else if(equali(arg[1],"T") || equali(arg[1],"t"))
- {
- new players[32], totalplayers, T
- get_players(players, totalplayers)
- for (new i = 0; i < totalplayers; i++)
- {
- if (get_user_team(players[i]) == 1)
- {
- T = players[i]
- zp_set_user_ammo_packs(T,zp_get_user_ammo_packs(T)+ ammo)
- }
- }
- client_print_color(0,"^1[ADMIN] ^4%s: ^1give ^4%i ^1AmmoPacks to ^3All Zombies", admin, ammo)
- log_to_file( LOG_FILE, "[ADMIN] %s: give %i AmmoPacks to All Zombies", admin,ammo)
- }
- else if(equali(arg[1],"CT") || equali(arg[1],"ct"))
- {
- new players[32], totalplayers, CT
- get_players(players, totalplayers)
- for(new i = 0; i < totalplayers; i++)
- {
- if(get_user_team(players[ i ] ) == 2)
- {
- CT = players[i]
- zp_set_user_ammo_packs(CT,zp_get_user_ammo_packs(CT) + ammo)
- }
- }
- client_print_color(0,"^1[ADMIN] ^4%s: ^1give ^4%i ^1AmmoPacks to ^3All Humans!", admin, ammo)
- log_to_file( LOG_FILE, "[ADMIN] %s: give %i AmmoPacks to All Humans!", admin,ammo)
- }
- }
- else
- {
- new Target = cmd_target(iPlayer, arg, 3)
- get_user_name (Target, player, charsmax (player))
- if(Target)
- {
- zp_set_user_ammo_packs(Target,zp_get_user_ammo_packs(Target)+ ammo)
- client_print_color(0,"^1[ADMIN] ^4%s: ^1give ^4%i ^1AmmoPacks to ^4%s", admin, ammo, player)
- log_to_file( LOG_FILE, "[ADMIN] %s: give %i AmmoPacks to %s", admin,ammo,player)
- }
- }
- return PLUGIN_HANDLED
- }
- public RemoveAmmo (iPlayer, level, cid)
- {
- if(!cmd_access(iPlayer, level, cid, 3)) return PLUGIN_HANDLED;
- new arg [32]
- read_argv (1, arg, 31)
- new RemoveAP [32]
- read_argv (2, RemoveAP, charsmax (RemoveAP))
- new ra = str_to_num (RemoveAP)
- new admin [32]
- new player [32]
- get_user_name (iPlayer, admin, charsmax (admin))
- if(arg[0]=='@')
- {
- if(equali(arg[1],"All") || equali(arg[1],"ALL"))
- {
- new players[32], totalplayers, All
- get_players(players, totalplayers)
- for (new i = 0; i < totalplayers; i++)
- {
- All = players[i]
- zp_set_user_ammo_packs(All,zp_get_user_ammo_packs(All) - ra)
- }
- client_print_color(0,"^1[ADMIN] ^4%s: ^1removed ^4%i ^1AmmoPacks from ^4All Players!", admin, ra)
- log_to_file( LOG_FILE, "[ADMIN] %s: removed %i AmmoPacks from All Players!", admin,ra)
- }
- else if(equali(arg[1],"T") || equali(arg[1],"t"))
- {
- new players[32], totalplayers, T
- get_players(players, totalplayers)
- for (new i = 0; i < totalplayers; i++)
- {
- if (get_user_team(players[i]) == 1)
- {
- T = players[i]
- zp_set_user_ammo_packs(T,zp_get_user_ammo_packs(T) - ra)
- }
- }
- client_print_color( 0,"^1[ADMIN] ^4%s: ^1removed ^4%i ^1AmmoPacks from ^3All Zombies", admin, ra)
- log_to_file( LOG_FILE, "[ADMIN] %s: removed %i AmmoPacks from All Zombies", admin,ra)
- }
- else if(equali(arg[1],"CT") || equali(arg[1],"ct"))
- {
- new players[32], totalplayers, CT
- get_players(players, totalplayers)
- for(new i = 0; i < totalplayers; i++)
- {
- if(get_user_team(players[ i ] ) == 2)
- {
- CT = players[i]
- zp_set_user_ammo_packs(CT,zp_get_user_ammo_packs(CT) - ra)
- }
- }
- client_print_color(0,"^1[ADMIN] ^4%s: ^1removed ^4%i ^1AmmoPacks from ^3 All Humans", admin, ra)
- log_to_file( LOG_FILE, "ADMIN %s removed %i ammo packs from all humans", admin,ra)
- }
- }
- else
- {
- new iTarget = cmd_target(iPlayer, arg, 3)
- get_user_name (iTarget, player, charsmax (player))
- if(!iTarget)
- return PLUGIN_HANDLED
- zp_set_user_ammo_packs(iTarget,zp_get_user_ammo_packs(iTarget) - ra)
- client_print_color(0,"^1[ADMIN] ^4%s: ^1removed ^4%i ^1AmmoPacks from ^4%s!", admin, ra, player)
- log_to_file( LOG_FILE, "[ADMIN] %s: removed %i AmmoPacks from %s!", admin,ra,player)
- }
- return PLUGIN_HANDLED;
- }
- stock client_print_color(const id, const input[], any:...)
- {
- new count = 1, players[32], i, player
- static msg[191]
- if(numargs() == 2)
- copy(msg, 190, input)
- else
- vformat(msg, 190, input, 3)
- replace_all(msg, 190, "!g", "^4")
- replace_all(msg, 190, "!y", "^1")
- replace_all(msg, 190, "!t", "^3")
- if(id) {
- if(!is_user_connected(id)) return
- players[0] = id
- }
- else get_players(players, count, "ch")
- for(i = 0; i < count; i++)
- {
- player = players[i]
- message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("SayText"), _, player)
- write_byte(player)
- write_string(msg)
- message_end()
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement