Post by hazmi03 on May 18, 2022 2:45:12 GMT
help me fix this code ,this for zp 5.0.8
new count = 1, players[32], i, player [error line 172]
#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
zp_set_user_ammo_packs(All,zp_get_user_ammo_packs(All)+ ammo)
}
client_print_color(0,"^4[^1ADMIN^4] %s :^1Gave %i AmmoPacks to all ^4players!", admin, ammo )
log_to_file( LOG_FILE, "ADMIN %s give %i ammo packs to all 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) == 1)
{
T = players
zp_set_user_ammo_packs(T,zp_get_user_ammo_packs(T)+ ammo)
}
}
client_print_color(0,"^4[^1ADMIN^4] %s:^1Gave %i AmmoPacks to all ^4Zombies", admin, ammo)
log_to_file( LOG_FILE, "ADMIN %s give %i ammo packs 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
zp_set_user_ammo_packs(CT,zp_get_user_ammo_packs(CT) + ammo)
}
}
client_print_color(0,"^4[^1ADMIN^4] %s:^1Gave %i AmmoPacks to all ^4humans!", admin, ammo)
log_to_file( LOG_FILE, "ADMIN %s give %i ammo packs 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,"^4[^1ADMIN^4] %s:^1Gave %i AmmoPacks to ^4%s", admin, ammo, player)
log_to_file( LOG_FILE, "ADMIN %s give %i ammo packs 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
zp_set_user_ammo_packs(All,zp_get_user_ammo_packs(All) - ra)
}
client_print_color(0,"^4[^1ADMIN^4] %s: ^1Removed ^4%i ^1AmmoPacks from ^4All Players!", admin, ra)
log_to_file( LOG_FILE, "ADMIN %s removed %i ammo packs 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) == 1)
{
T = players
zp_set_user_ammo_packs(T,zp_get_user_ammo_packs(T) - ra)
}
}
client_print_color( 0,"^4[^1ADMIN^4] %s: ^1Removed ^4%i ^1AmmoPacks from ^4All Zombies!", admin, ra)
log_to_file( LOG_FILE, "ADMIN %s removed %i ammo packs 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
zp_set_user_ammo_packs(CT,zp_get_user_ammo_packs(CT) - ra)
}
}
client_print_color(0,"^4[^1ADMIN^4] %s: ^1Removed ^4%i ^1AmmoPacks from ^4All 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,"^4[^1ADMIN^4] %s: ^1Removed ^4%i ^1AmmoPacks from ^4%s!", admin, ra, player)
log_to_file( LOG_FILE, "ADMIN %s removed %i ammo packs 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
message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("SayText"), _, player)
write_byte(player)
write_string(msg)
message_end()
}
}
new count = 1, players[32], i, player [error line 172]
#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
zp_set_user_ammo_packs(All,zp_get_user_ammo_packs(All)+ ammo)
}
client_print_color(0,"^4[^1ADMIN^4] %s :^1Gave %i AmmoPacks to all ^4players!", admin, ammo )
log_to_file( LOG_FILE, "ADMIN %s give %i ammo packs to all 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) == 1)
{
T = players
zp_set_user_ammo_packs(T,zp_get_user_ammo_packs(T)+ ammo)
}
}
client_print_color(0,"^4[^1ADMIN^4] %s:^1Gave %i AmmoPacks to all ^4Zombies", admin, ammo)
log_to_file( LOG_FILE, "ADMIN %s give %i ammo packs 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
zp_set_user_ammo_packs(CT,zp_get_user_ammo_packs(CT) + ammo)
}
}
client_print_color(0,"^4[^1ADMIN^4] %s:^1Gave %i AmmoPacks to all ^4humans!", admin, ammo)
log_to_file( LOG_FILE, "ADMIN %s give %i ammo packs 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,"^4[^1ADMIN^4] %s:^1Gave %i AmmoPacks to ^4%s", admin, ammo, player)
log_to_file( LOG_FILE, "ADMIN %s give %i ammo packs 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
zp_set_user_ammo_packs(All,zp_get_user_ammo_packs(All) - ra)
}
client_print_color(0,"^4[^1ADMIN^4] %s: ^1Removed ^4%i ^1AmmoPacks from ^4All Players!", admin, ra)
log_to_file( LOG_FILE, "ADMIN %s removed %i ammo packs 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) == 1)
{
T = players
zp_set_user_ammo_packs(T,zp_get_user_ammo_packs(T) - ra)
}
}
client_print_color( 0,"^4[^1ADMIN^4] %s: ^1Removed ^4%i ^1AmmoPacks from ^4All Zombies!", admin, ra)
log_to_file( LOG_FILE, "ADMIN %s removed %i ammo packs 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
zp_set_user_ammo_packs(CT,zp_get_user_ammo_packs(CT) - ra)
}
}
client_print_color(0,"^4[^1ADMIN^4] %s: ^1Removed ^4%i ^1AmmoPacks from ^4All 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,"^4[^1ADMIN^4] %s: ^1Removed ^4%i ^1AmmoPacks from ^4%s!", admin, ra, player)
log_to_file( LOG_FILE, "ADMIN %s removed %i ammo packs 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
message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("SayText"), _, player)
write_byte(player)
write_string(msg)
message_end()
}
}