- Ошибка
-
предупреждение
- Компилятор
- Локальный
- Amx Mod X
- 1.9.0
- Исходный код
-
/*
AES: Status Info v. 0.1
by serfreeman1337 http://gf.hldm.org/
*/
#include <amxmodx>
#include <aes_main>
#define PLUGIN "AES: Status Info"
#define AUTHOR "serfreeman1337"
#define VERSION "0.1"
new statusText
enum _:cvars {
CVAR_FRIEND,
CVAR_ENEMY
}
new cvar[cvars]
new statusFriend[128],statusEnemy[128]
enum _:isTpl {
TPL_EXP,
TPL_EXPNEED,
TPL_LEVEL,
TPL_MAXLEVEL,
TPL_RANK
}
new isTplFormat[isTpl]
new tplForm[][] = {
"<exp>",
"<nxp>",
"<lvl>",
"<mvl>",
"<rnk>"
}
public plugin_init(){
register_plugin(PLUGIN,VERSION,AUTHOR)
statusText = get_user_msgid("StatusText")
register_event("StatusValue", "Show_Status", "bef", "1=2", "2!0")
cvar[CVAR_FRIEND] = register_cvar("aes_status_friend","1 %c1: %p2\n2 %h: %i3%%")
cvar[CVAR_ENEMY] = register_cvar("aes_status_enemy","1 %c1: %p2")
}
public plugin_cfg(){
get_pcvar_string(cvar[CVAR_FRIEND],statusFriend,127)
get_pcvar_string(cvar[CVAR_ENEMY],statusEnemy,127)
for(new i ; i < isTpl ; ++i){
if(contain(statusFriend,tplForm[i]))
isTplFormat[i] |= (1<<0)
if(contain(statusEnemy,tplForm[i]))
isTplFormat[i] |= (1<<1)
}
}
public Show_Status(id){
new targetId = read_data(2)
new isEnemy = get_user_team(id) != get_user_team(targetId)
new statusTxt[128]
copy(statusTxt,127,isEnemy ? statusEnemy : statusFriend)
if(!tplFormat(id,targetId,statusTxt,127,isEnemy))
return
message_begin(MSG_ONE,statusText,.player=id)
write_byte(0)
write_string(statusTxt)
message_end()
}
public tplFormat(id,targetId,statusTxt[],statusLen,isEnemy){
new aStats[AES_ST_END],tmp[32]
if(!aes_get_player_stats(targetId,aStats))
return 0
for(new i ; i < isTpl ; ++i){
if(isTplFormat[i] & (1<<isEnemy)){
switch(i){
case TPL_EXP:{
formatex(tmp,31,"%d",aStats[AES_ST_EXP])
replace_all(statusTxt,statusLen,tplForm[i],tmp)
}
case TPL_EXPNEED:{
formatex(tmp,31,"%d",aes_get_exp_to_next_level(aStats[AES_ST_LEVEL]))
replace_all(statusTxt,statusLen,tplForm[i],tmp)
}
case TPL_LEVEL:{
formatex(tmp,31,"%d",aStats[AES_ST_LEVEL])
replace_all(statusTxt,statusLen,tplForm[i],tmp)
}
case TPL_MAXLEVEL:{
formatex(tmp,31,"%d",aes_get_max_level())
replace_all(statusTxt,statusLen,tplForm[i],tmp)
}
case TPL_RANK:{
aes_get_level_name(aStats[AES_ST_LEVEL],tmp,31,id)
replace_all(statusTxt,statusLen,tplForm[i],tmp)
}
}
}
}
replace_all(statusTxt,statusLen,"\n","^n")
return 1
}
плагин не работает
В этой теме было размещено решение! Перейти к решению.