Код за потвърждение: Избери целия код
/*
---------------------------------------------------------
# # # #=== ### ## #
# ## #=== # # # #
# # #=== ### ## #
---------------------------------------------------------
[ZP] Ultimate Addon UAIO by <VeCo> 3.0
Plugin made by <VeCo>
Special thanks to:
- sick : for the idea of the plugin and testing.
- xxxDiVXxxx : for the idea of the /ap command and zp_takeap.
- ardi : for the idea of the ammo pack limit CVAR.
- remotiv : for the idea of the zp_giveap command.
- gloBi: for the idea of logging give commands.
- d-WaLkMaN-b ;] : for the idea for zp_ammolist command.
If you modify the code, please DO NOT change the author!
---------------------------------------------------------
* PLUGIN CONTAINS:
==> Save Ammo Packs
==> Save Last Chosen Zombie Class
==> Show remaining health of the attacked zombie
==> Command for seeing your amount of your ammo packs.
==> Command for giving ammo packs to another player.
==> Admin command for giving ammo packs to other players.
==> Command for seeing another player's amount of ammo packs.
==> Admin command for taking ammo packs from other players.
---------------------------------------------------------
Contacts:
e-mail: [email protected]
skype: veco_kn
---------------------------------------------------------
Changes log:
-> v 1.0 = First release!
-> v 1.1 = Added CVAR for limit of the ammo packs.
-> v 1.2 = Fixed bug with client_print native.
-> v 1.3 = Fixed bugs with ammo give.
-> v 1.4 = Added "KILLED!" instead of negative health value
in the victim health displayer.
-> v 1.5 = Added autosave on new round.
Added autoload on player nick change.
-> v 1.6 = Changed zp_ua_data_save_type CVAR.
Fixed bug with the ammo pack saving.
Fixed bug in the /give command.
Added admin command zp_giveap.
-> v 1.7 = Fixed bug with the zp_giveap command.
-> v 1.8 = Fixed bug with saving the ammo packs to ip.
-> v 1.9 = Changes in code for saving.
-> v 2.0 = Fixed bug with Damage event.
Added chat command /ammo.
-> v 2.1 = Fixed bugs in the /ammo command.
-> v 2.2 = Fixed bug with Damage event. (again)
-> v 2.3 = Changes in code for saving. (again, hope they are final)
-> v 2.4 = zp_giveap now can take ammo packs if you use negative
value.
-> v 2.5 = Added admin command zp_takeap.
-> v 2.6 = Added CVARs for turning off/on the chat commands.
If your ammo packs aren't saved in the nvault file,
you will have the ammo pack amount from the ZP
CVAR zp_starting_ammo_packs.
-> v 2.7 = Added logging for give and take commands.
-> v 2.8 = Removed unnecessary code.
Added support for ZP 5.0 or higher and define
for it.
-> v 2.9 = Fixed error in ZP 5.0 support.
-> v 3.0 = Added zp_ammolist command.
---------------------------------------------------------
Don't forget to visit http://www.amxmodxbg.org :)
---------------------------------------------------------
*/
#include <amxmodx>
#include <amxmisc>
#include <nvault>
#define ADMIN_GIVE_AMMO ADMIN_IMMUNITY // access level for zp_giveap command
#define ADMIN_TAKE_AMMO ADMIN_RCON // access level for zp_takeap command
#define ADMIN_AMMO_LIST ADMIN_ADMIN // access level for zp_ammolist command
//#define USE_ZP_50 // remove "//" in the beginning of this line if you use Zombie Plague 5.0 or higher
#if !defined USE_ZP_50
#include <zombieplague>
#else
#include <zp50_core>
#include <zp50_class_zombie>
#include <zp50_class_nemesis>
#include <zp50_ammopacks>
#endif
#define LOGFILE "addons/amxmodx/logs/zp_ua_uaio_veco.log"
/*START - From colorchat.inc by Numb */
enum Color {
NORMAL = 1,
GREEN,
TEAM_COLOR,
GREY,
RED,
BLUE,
}
new TeamName[][] = {
"",
"TERRORIST",
"CT",
"SPECTATOR"
}
/*END - From colorchat.inc by Numb */
new must_save[33],data_vault, pointer_activity,
cvar_data_save_type, cvar_cmd_give,cvar_cmd_ap,cvar_cmd_ammo, cvar_show_hp, cvar_give_ammo_public, cvar_ammo_limit
public plugin_init() {
register_plugin("[ZP] Ultimate Addon UAIO by <VeCo>", "2.9", "<VeCo>")
register_cvar("zp_ua_uaio_veco_version","2.9",FCVAR_SERVER | FCVAR_SPONLY)
pointer_activity = get_cvar_pointer("amx_show_activity")
register_concmd("zp_giveap","admin_ammo_give",ADMIN_GIVE_AMMO,"<name / #userid / @H / @Z / @ALL> <ammo packs>")
register_concmd("zp_takeap","admin_ammo_take",ADMIN_TAKE_AMMO,"<name / #userid / @H / @Z / @ALL> <ammo packs>")
register_concmd("zp_ammolist","admin_ammo_list",ADMIN_AMMO_LIST,"- displays all players' ammo packs")
register_clcmd("say","hook_say")
register_clcmd("say_team","hook_say")
register_event("Damage","event_damage","b","2!0","3=0","4!0")
cvar_data_save_type = register_cvar("zp_ua_data_save_type","0")
cvar_cmd_give = register_cvar("zp_ua_give_command","1")
cvar_cmd_ap = register_cvar("zp_ua_ap_command","1")
cvar_cmd_ammo = register_cvar("zp_ua_ammo_command","1")
cvar_show_hp = register_cvar("zp_ua_show_hp","3")
cvar_give_ammo_public = register_cvar("zp_ua_give_ammo_public","1")
cvar_ammo_limit = register_cvar("zp_ua_ammo_limit","0")
data_vault = nvault_open("zp_ua_uaio_veco")
}
public admin_ammo_give(id,level,cid)
{
if(!cmd_access(id,level,cid,1)) return PLUGIN_HANDLED
new arg_name[32],arg_ap[10]
read_argv(1,arg_name,31)
read_argv(2,arg_ap,9)
new name[32],target_name[32], ip[16],target_ip[16], steamid[32],target_steamid[32],
target,type, num_ap = str_to_num(arg_ap)
if(!equali(arg_name,"@H") && !equali(arg_name,"@Z") && !equali(arg_name,"@ALL")) target = cmd_target(id,arg_name,0)
get_user_name(id,name,31)
get_user_ip(id,ip,15,1)
get_user_authid(id,steamid,31)
get_user_name(target,target_name,31)
get_user_ip(target,target_ip,15,1)
get_user_authid(target,target_steamid,31)
if(num_ap <= 0)
{
console_print(id,"[ZP]^x01 You can give only positive ammo packs.")
return PLUGIN_HANDLED
}
type = 0
if(equali(arg_name,"@H"))
{
type = 1
#if !defined USE_ZP_50
for(new i=1;i<33;i++) if(is_user_connected(i) && !zp_get_user_zombie(i)) zp_set_user_ammo_packs(i, zp_get_user_ammo_packs(i) + num_ap)
#else
for(new i=1;i<33;i++) if(is_user_connected(i) && !zp_core_is_zombie(i)) zp_ammopacks_set(i, zp_ammopacks_get(i) + num_ap)
#endif
} else if(equali(arg_name,"@Z"))
{
type = 2
#if !defined USE_ZP_50
for(new i=1;i<33;i++) if(is_user_connected(i) && !zp_get_user_zombie(i)) zp_set_user_ammo_packs(i, zp_get_user_ammo_packs(i) + num_ap)
#else
for(new i=1;i<33;i++) if(is_user_connected(i) && zp_core_is_zombie(i)) zp_ammopacks_set(i, zp_ammopacks_get(i) + num_ap)
#endif
} else if(equali(arg_name,"@ALL"))
{
type = 3
#if !defined USE_ZP_50
for(new i=1;i<33;i++) if(is_user_connected(i)) zp_set_user_ammo_packs(i, zp_get_user_ammo_packs(i) + num_ap)
#else
for(new i=1;i<33;i++) if(is_user_connected(i)) zp_ammopacks_set(i, zp_ammopacks_get(i) + num_ap)
#endif
} else {
#if !defined USE_ZP_50
zp_set_user_ammo_packs(target, zp_get_user_ammo_packs(target) + num_ap)
#else
zp_ammopacks_set(target, zp_ammopacks_get(target) + num_ap)
#endif
}
if(get_pcvar_num(cvar_give_ammo_public))
{
switch(get_pcvar_num(pointer_activity))
{
case 1:
{
switch(type)
{
case 1: ColorChat(0,GREEN,"[ZP]^x01 ADMIN gave ^x04%s^x01 ammo packs to all humans.",arg_ap)
case 2: ColorChat(0,GREEN,"[ZP]^x01 ADMIN gave ^x04%s^x01 ammo packs to all zombies.",arg_ap)
case 3: ColorChat(0,GREEN,"[ZP]^x01 ADMIN gave ^x04%s^x01 ammo packs to all players.",arg_ap)
default: ColorChat(0,GREEN,"[ZP]^x01 ADMIN gave ^x04%s^x01 ammo packs to ^x04%s^x01.",arg_ap,target_name)
}
}
case 2:
{
switch(type)
{
case 1: ColorChat(0,GREEN,"[ZP]^x01 ADMIN ^x04%s^x01 gave ^x04%s^x01 ammo packs to all humans.",name,arg_ap)
case 2: ColorChat(0,GREEN,"[ZP]^x01 ADMIN ^x04%s^x01 gave ^x04%s^x01 ammo packs to all zombies.",name,arg_ap)
case 3: ColorChat(0,GREEN,"[ZP]^x01 ADMIN ^x04%s^x01 gave ^x04%s^x01 ammo packs to all players.",name,arg_ap)
default: ColorChat(0,GREEN,"[ZP]^x01 ADMIN ^x04%s^x01 gave ^x04%s^x01 ammo packs to ^x04%s^x01.",name,arg_ap,target_name)
}
}
}
}
switch(type)
{
case 1: log_to_file(LOGFILE,"ADMIN %s [IP: %s][STEAMID: %s] gave [%i] ammo packs to all humans.",name,ip,steamid,num_ap)
case 2: log_to_file(LOGFILE,"ADMIN %s [IP: %s][STEAMID: %s] gave [%i] ammo packs to all zombies.",name,ip,steamid,num_ap)
case 3: log_to_file(LOGFILE,"ADMIN %s [IP: %s][STEAMID: %s] gave [%i] ammo packs to all players.",name,ip,steamid,num_ap)
default: log_to_file(LOGFILE,"ADMIN %s [IP: %s][STEAMID: %s] gave [%i] ammo packs to %s [IP: %s][STEAMID: %s]",name,ip,steamid, num_ap, target_name,target_ip,target_steamid)
}
return PLUGIN_HANDLED
}
public admin_ammo_take(id,level,cid)
{
if(!cmd_access(id,level,cid,1)) return PLUGIN_HANDLED
new arg_name[32],arg_ap[10]
read_argv(1,arg_name,31)
read_argv(2,arg_ap,9)
new name[32],target_name[32], ip[16],target_ip[16], steamid[32],target_steamid[32],
target,type, num_ap = str_to_num(arg_ap)
if(!equali(arg_name,"@H") && !equali(arg_name,"@Z") && !equali(arg_name,"@ALL")) target = cmd_target(id,arg_name,0)
get_user_name(id,name,31)
get_user_ip(id,ip,15,1)
get_user_authid(id,steamid,31)
get_user_name(target,target_name,31)
get_user_ip(target,target_ip,15,1)
get_user_authid(target,target_steamid,31)
if(num_ap <= 0)
{
console_print(id,"[ZP]^x01 You can take only positive ammo packs.")
return PLUGIN_HANDLED
}
type = 0
if(equali(arg_name,"@H"))
{
type = 1
#if !defined USE_ZP_50
for(new i=1;i<33;i++) if(is_user_connected(i) && !zp_get_user_zombie(i)) zp_set_user_ammo_packs(i, zp_get_user_ammo_packs(i) - num_ap)
#else
for(new i=1;i<33;i++) if(is_user_connected(i) && !zp_core_is_zombie(i)) zp_ammopacks_set(i, zp_ammopacks_get(i) - num_ap)
#endif
} else if(equali(arg_name,"@Z"))
{
type = 2
#if !defined USE_ZP_50
for(new i=1;i<33;i++) if(is_user_connected(i) && !zp_get_user_zombie(i)) zp_set_user_ammo_packs(i, zp_get_user_ammo_packs(i) - num_ap)
#else
for(new i=1;i<33;i++) if(is_user_connected(i) && zp_core_is_zombie(i)) zp_ammopacks_set(i, zp_ammopacks_get(i) - num_ap)
#endif
} else if(equali(arg_name,"@ALL"))
{
type = 3
#if !defined USE_ZP_50
for(new i=1;i<33;i++) if(is_user_connected(i)) zp_set_user_ammo_packs(i, zp_get_user_ammo_packs(i) - num_ap)
#else
for(new i=1;i<33;i++) if(is_user_connected(i)) zp_ammopacks_set(i, zp_ammopacks_get(i) - num_ap)
#endif
} else {
#if !defined USE_ZP_50
zp_set_user_ammo_packs(target, zp_get_user_ammo_packs(target) - num_ap)
#else
zp_ammopacks_set(target, zp_ammopacks_get(target) - num_ap)
#endif
}
#if !defined USE_ZP_50
if(zp_get_user_ammo_packs(target) < 0) zp_set_user_ammo_packs(target,0)
#else
if(zp_ammopacks_get(target) < 0) zp_ammopacks_set(target,0)
#endif
if(get_pcvar_num(cvar_give_ammo_public))
{
switch(get_pcvar_num(pointer_activity))
{
case 1:
{
switch(type)
{
case 1: ColorChat(0,GREEN,"[ZP]^x01 ADMIN took ^x04%s^x01 ammo packs from all humans.",arg_ap)
case 2: ColorChat(0,GREEN,"[ZP]^x01 ADMIN took ^x04%s^x01 ammo packs from all zombies.",arg_ap)
case 3: ColorChat(0,GREEN,"[ZP]^x01 ADMIN took ^x04%s^x01 ammo packs from all players.",arg_ap)
default: ColorChat(0,GREEN,"[ZP]^x01 ADMIN took ^x04%s^x01 ammo packs from ^x04%s^x01.",arg_ap,target_name)
}
}
case 2:
{
switch(type)
{
case 1: ColorChat(0,GREEN,"[ZP]^x01 ADMIN ^x04%s^x01 took ^x04%s^x01 ammo packs from all humans.",name,arg_ap)
case 2: ColorChat(0,GREEN,"[ZP]^x01 ADMIN ^x04%s^x01 took ^x04%s^x01 ammo packs from all zombies.",name,arg_ap)
case 3: ColorChat(0,GREEN,"[ZP]^x01 ADMIN ^x04%s^x01 took ^x04%s^x01 ammo packs from all players.",name,arg_ap)
default: ColorChat(0,GREEN,"[ZP]^x01 ADMIN ^x04%s^x01 took ^x04%s^x01 ammo packs from ^x04%s^x01.",name,arg_ap,target_name)
}
}
}
}
switch(type)
{
case 1: log_to_file(LOGFILE,"ADMIN %s [IP: %s][STEAMID: %s] took [%i] ammo packs from all humans.",name,ip,steamid,num_ap)
case 2: log_to_file(LOGFILE,"ADMIN %s [IP: %s][STEAMID: %s] took [%i] ammo packs from all zombies.",name,ip,steamid,num_ap)
case 3: log_to_file(LOGFILE,"ADMIN %s [IP: %s][STEAMID: %s] took [%i] ammo packs from all players.",name,ip,steamid,num_ap)
default: log_to_file(LOGFILE,"ADMIN %s [IP: %s][STEAMID: %s] took [%i] ammo packs from %s [IP: %s][STEAMID: %s]",name,ip,steamid, num_ap, target_name,target_ip,target_steamid)
}
return PLUGIN_HANDLED
}
public admin_ammo_list(id,level,cid)
{
if(!cmd_access(id,level,cid,1)) return PLUGIN_HANDLED
static players[32],num, i,ii
get_players(players,num)
console_print(id,"Name | IP | SteamID | Ammo Packs :")
static name[32],ip[16],steamid[24]
for(i=0;i<num;i++)
{
ii = players[i]
get_user_name(ii,name,31)
get_user_ip(ii,ip,15,1)
get_user_authid(ii,steamid,23)
#if !defined USE_ZP_50
console_print(id,"%s %s %s %i",name,ip,steamid, zp_get_user_ammo_packs(ii))
#else
console_print(id,"%s %s %s %i",name,ip,steamid, zp_ammopacks_get(ii))
#endif
}
return PLUGIN_HANDLED
}
public hook_say(id)
{
new args[129], arg_cmd[6],arg_name[32],arg_ap[10]
read_args(args,128)
remove_quotes(args)
parse(args, arg_cmd,5, arg_name,31, arg_ap,9)
if(get_pcvar_num(cvar_cmd_give) && equali(arg_cmd,"/give"))
{
new name[32],target_name[32], ip[16],target_ip[16], steamid[32],target_steamid[32],
target, num_ap = str_to_num(arg_ap)
get_user_name(id,name,31)
get_user_ip(id,ip,15,1)
get_user_authid(id,steamid,31)
target = cmd_target(id,arg_name,0)
get_user_name(target,target_name,31)
get_user_ip(target,target_ip,15,1)
get_user_authid(target,target_steamid,31)
if(equal(arg_name,""))
{
ColorChat(id,GREEN,"[ZP]^x01 You must enter a name.")
return
}
if(!target)
{
ColorChat(id,GREEN,"[ZP]^x01 I can't find player with the name ^x04%s^x01.",arg_name)
return
}
if(id == target)
{
ColorChat(id,GREEN,"[ZP]^x01 You can't give ammo packs to yourself.")
return
}
#if !defined USE_ZP_50
if(zp_get_user_ammo_packs(id) < num_ap)
#else
if(zp_ammopacks_get(id) < num_ap)
#endif
{
ColorChat(id,GREEN,"[ZP]^x01 You don't have enough ammo packs.")
return
}
if(num_ap <= 0)
{
ColorChat(id,GREEN,"[ZP]^x01 You can give only positive ammo packs.")
return
}
#if !defined USE_ZP_50
zp_set_user_ammo_packs(id, zp_get_user_ammo_packs(id) - num_ap)
zp_set_user_ammo_packs(target, zp_get_user_ammo_packs(target) + num_ap)
#else
zp_ammopacks_set(id, zp_ammopacks_get(id) - num_ap)
zp_ammopacks_set(target, zp_ammopacks_get(target) + num_ap)
#endif
ColorChat(id,GREEN,"[ZP]^x01 You successfully gave ^x04%s^x01 ammo packs to ^x04%s^x01.",arg_ap,target_name)
ColorChat(target,GREEN,"[ZP] %s^x01 gave you ^x04%s^x01 ammo packs.",name,arg_ap)
if(get_pcvar_num(cvar_give_ammo_public)) ColorChat(0,GREEN,"[ZP] %s^x01 gave ^x04%s^x01 ammo packs to ^x04%s^x01.",name,arg_ap,target_name)
log_to_file("addons/amxmodx/logs/zp_ua_uaio_veco.log","%s [IP: %s][STEAMID: %s] gave [%i] ammo packs to %s [IP: %s][STEAMID: %s]",name,ip,steamid, num_ap, target_name,target_ip,target_steamid)
}
#if !defined USE_ZP_50
if(get_pcvar_num(cvar_cmd_ap) && equali(arg_cmd,"/ap")) ColorChat(id,GREEN,"[ZP]^x01 You have ^x04%i^x01 ammo packs.",zp_get_user_ammo_packs(id))
#else
if(get_pcvar_num(cvar_cmd_ap) && equali(arg_cmd,"/ap")) ColorChat(id,GREEN,"[ZP]^x01 You have ^x04%i^x01 ammo packs.",zp_ammopacks_get(id))
#endif
if(get_pcvar_num(cvar_cmd_ammo) && equali(arg_cmd,"/ammo"))
{
new target_name[32],target
target = cmd_target(id,arg_name,0)
get_user_name(target,target_name,31)
if(equal(arg_name,""))
{
ColorChat(id,GREEN,"[ZP]^x01 You must enter a name.")
return
}
if(!target)
{
ColorChat(id,GREEN,"[ZP]^x01 I can't find player with the name ^x04%s^x01.",arg_name)
return
}
if(id == target)
{
ColorChat(id,GREEN,"[ZP]^x01 Try the^x04 /ap^x01 command to see your ammo packs.")
return
}
#if !defined USE_ZP_50
ColorChat(id,GREEN,"[ZP] %s^x01 has ^x04%i^x01 ammo packs.",target_name,zp_get_user_ammo_packs(target))
#else
ColorChat(id,GREEN,"[ZP] %s^x01 has ^x04%i^x01 ammo packs.",target_name,zp_ammopacks_get(target))
#endif
}
}
public event_damage(id)
{
new killer,hp
killer = get_user_attacker(id)
hp = get_user_health(id)
if(is_user_connected(id) && is_user_connected(killer))
{
if(hp > 0)
{
switch(get_pcvar_num(cvar_show_hp))
{
#if !defined USE_ZP_50
case 1: if(zp_get_user_zombie(id)) client_print(killer,print_center,"HP: %i",hp)
case 2: if(zp_get_user_nemesis(id)) client_print(killer,print_center,"HP: %i",hp)
case 3: if(zp_get_user_zombie(id) || zp_get_user_nemesis(id)) client_print(killer,print_center,"HP: %i",hp)
#else
case 1: if(zp_core_is_zombie(id)) client_print(killer,print_center,"HP: %i",hp)
case 2: if(zp_class_nemesis_get(id)) client_print(killer,print_center,"HP: %i",hp)
case 3: if(zp_core_is_zombie(id) || zp_class_nemesis_get(id)) client_print(killer,print_center,"HP: %i",hp)
#endif
}
} else {
switch(get_pcvar_num(cvar_show_hp))
{
#if !defined USE_ZP_50
case 1: if(zp_get_user_zombie(id)) client_print(killer,print_center,"KILLED!")
case 2: if(zp_get_user_nemesis(id)) client_print(killer,print_center,"KILLED!")
case 3: if(zp_get_user_zombie(id) || zp_get_user_nemesis(id)) client_print(killer,print_center,"KILLED!")
#else
case 1: if(zp_core_is_zombie(id)) client_print(killer,print_center,"KILLED!")
case 2: if(zp_class_nemesis_get(id)) client_print(killer,print_center,"KILLED!")
case 3: if(zp_core_is_zombie(id) || zp_class_nemesis_get(id)) client_print(killer,print_center,"KILLED!")
#endif
}
}
}
}
public client_connect(id) if(get_pcvar_num(cvar_data_save_type) != -1) load_user_data(id)
public client_disconnect(id)
{
if(get_pcvar_num(cvar_data_save_type) != -1 && must_save[id])
{
save_user_data(id)
must_save[id] = false
}
}
public load_user_data(id)
{
if(!is_user_connected(id)) return
new user_data[64], vaultkey[64],vaultdata[63], data_ammo_packs[32],data_zombie_class[32], vault_timestamp
switch(get_pcvar_num(cvar_data_save_type))
{
case 1:
{
get_user_ip(id,user_data,63,1)
format(vaultkey,63,"[ip]%s",user_data)
}
case 2:
{
get_user_authid(id,user_data,63)
format(vaultkey,63,"[aulthid]%s",user_data)
}
default:
{
get_user_name(id,user_data,63)
format(vaultkey,63,"[name]%s",user_data)
}
}
if(!nvault_lookup(data_vault,vaultkey,vaultdata,62,vault_timestamp))
{
must_save[id] = true
return
}
nvault_get(data_vault,vaultkey,vaultdata,62)
replace_all(vaultdata,62,"#"," ")
parse(vaultdata, data_ammo_packs,31, data_zombie_class,31)
#if !defined USE_ZP_50
zp_set_user_ammo_packs(id, str_to_num(data_ammo_packs))
zp_set_user_zombie_class(id, str_to_num(data_zombie_class))
#else
zp_ammopacks_set(id, str_to_num(data_ammo_packs))
if(str_to_num(data_zombie_class) != -1) zp_class_zombie_set_next(id, str_to_num(data_zombie_class))
#endif
must_save[id] = true
#if !defined USE_ZP_50
if(get_pcvar_num(cvar_ammo_limit) != 0 && zp_get_user_ammo_packs(id) > get_pcvar_num(cvar_ammo_limit)) zp_set_user_ammo_packs(id,get_pcvar_num(cvar_ammo_limit))
#else
if(get_pcvar_num(cvar_ammo_limit) != 0 && zp_ammopacks_get(id) > get_pcvar_num(cvar_ammo_limit)) zp_ammopacks_set(id,get_pcvar_num(cvar_ammo_limit))
#endif
}
public save_user_data(id)
{
new user_data[64], vaultkey[64],vaultdata[63]
switch(get_pcvar_num(cvar_data_save_type))
{
case 1:
{
get_user_ip(id,user_data,63,1)
format(vaultkey,63,"[ip]%s",user_data)
}
case 2:
{
get_user_authid(id,user_data,63)
format(vaultkey,63,"[aulthid]%s",user_data)
}
default:
{
get_user_name(id,user_data,63)
format(vaultkey,63,"[name]%s",user_data)
}
}
#if !defined USE_ZP_50
format(vaultdata,62,"%i#%i#",zp_get_user_ammo_packs(id),zp_get_user_zombie_class(id))
#else
format(vaultdata,62,"%i#%i#",zp_ammopacks_get(id),zp_class_zombie_get_current(id))
#endif
nvault_set(data_vault,vaultkey,vaultdata)
}
/*START - From colorchat.inc by Numb */
ColorChat(id, Color:type, const msg[], {Float, Sql, Result,_}:...) {
new message[256]
switch(type) {
case NORMAL: message[0] = 0x01
case GREEN: message[0] = 0x04
default: message[0] = 0x03
}
vformat(message[1], 251, msg, 4)
message[192] = '^0'
new team, ColorChange, index, MSG_Type
if(id) {
MSG_Type = MSG_ONE
index = id
} else {
index = FindPlayer()
MSG_Type = MSG_ALL
}
team = get_user_team(index)
ColorChange = ColorSelection(index, MSG_Type, type)
ShowColorMessage(index, MSG_Type, message)
if(ColorChange)
Team_Info(index, MSG_Type, TeamName[team])
}
ShowColorMessage(id, type, message[]) {
static bool:saytext_used
static get_user_msgid_saytext
if(!saytext_used) {
get_user_msgid_saytext = get_user_msgid("SayText")
saytext_used = true
}
message_begin(type, get_user_msgid_saytext, _, id)
write_byte(id)
write_string(message)
message_end()
}
Team_Info(id, type, team[]) {
static bool:teaminfo_used
static get_user_msgid_teaminfo
if(!teaminfo_used) {
get_user_msgid_teaminfo = get_user_msgid("TeamInfo")
teaminfo_used = true
}
message_begin(type, get_user_msgid_teaminfo, _, id)
write_byte(id)
write_string(team)
message_end()
return 1
}
ColorSelection(index, type, Color:Type) {
switch(Type) {
case RED: return Team_Info(index, type, TeamName[1])
case BLUE: return Team_Info(index, type, TeamName[2])
case GREY: return Team_Info(index, type, TeamName[0])
}
return 0
}
FindPlayer() {
new i = -1
while(i <= get_maxplayers()) {
if(is_user_connected(++i))
return i
}
return -1
}
/*END - From colorchat.inc by Numb */