Post by newbie on Nov 29, 2017 15:16:53 GMT
I am a beginner you can give specific instructions
/*
Copyright(C). 2014. zmd94 ;)
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
// Uncomment 'IM_USING_ZP50' if your server is running ZP50 and above
//#define IM_USING_ZP50
// if you are using this Custom Level for ZPA,
// just change line below into #include <zombie_plague_advance>
#include <zombieplague>
//Uncomment 'CUSTOM_CHAT' if your want to use custom chat
#define CUSTOM_CHAT
//Uncomment 'DATA_EXPIRED' if your want to enable data expired function
//Uncomment 'CHANGE_NAME' if your want to enable player to change their name
//#define CHANGE_NAME
#include <amxmodx>
#include <fakemeta>
#include <hamsandwich>
#include <nvault_util>
#include <nvault>
#include <engine>
#include <fun>
#if defined IM_USING_ZP50
#include <zp50_core>
#include <zp50_class_zombie>
#endif
new const VERSION[] = "3.2"
new const VAULTNAME[] = "custom_level"
new const RANKS[][]=
{
"0", // 0
"1", // 1
"2", // 2
"3", // 3
"4", // 4
"5", // 5
"6", // 6
"7", // 7
"8", // 8
"9", // 9
"10", // 10
"11", // 11
"12", // 12
"13", // 13
"14", // 14
"15", // 15
"16", // 16
"17", // 17
"18",// 18
"19",
"20",
"21",
"22",
"23",
"24",
"25",
"26",
"27",
"28",
"29",
"30",
"31",
"32",
"33",
"34",
"35",
"36",
"37",
"38",
"39",
"40",
"41",
"42",
"43",
"44",
"45",
"46",
"47",
"48",
"49",
"50",
"51",
"52",
"53",
"54",
"55",
"56",
"57",
"58",
"59",
"60",
"61",
"62",
"63",
"64",
"65",
"66",
"67",
"68",
"69",
"70",
"71",
"72",
"73",
"74",
"75",
"76",
"77",
"78",
"79",
"80",
"81",
"82",
"83",
"84",
"85",
"86",
"87",
"88",
"89",
"90",
"91",
"92",
"93",
"94",
"95",
"96",
"97",
"98",
"99",
"100"
}
new const EXP[] =
{
0, // 0
100, // 1
300, // 2
600, // 3
1000, // 4
1500, // 5
2100, // 6
2800, // 7
3600, // 8
4500, // 9
5500, // 10
6600, // 11
7800, // 12
8900, // 13
10300, // 14
11800, // 15
13400, // 16
15100, // 17
16900, // 18
18700,
20600,
22600,
24700,
26900,
29200,
31600,
34100,
36700,
39400,
42200,
45100,
48100,
51200,
54400,
57700,
61100,
64600,
68200,
71900,
75700,
79600,
83600,
87700,
91900,
96200,
100600,
105100,
109700,
114400,
119200,
124100,
129100,
134200,
139400,
144700,
150100,
155600,
161200,
166900,
172700,
178600,
184600,
190700,
196900,
203200,
209600,
216100,
222700,
229400,
236200,
243100,
250100,
257200,
264400,
271700,
279100,
286600,
294200,
301900,
309700,
317600,
325600,
333700,
341900,
350200,
358600,
367100,
375700,
384400,
393200,
402100,
411100,
420200,
429400,
438700,
448100,
457600,
467200,
476900,
486700,
496600,
506600
}
#define ADMIN_FLAG ADMIN_IMMUNITY
#define MAXPLAYERS 32
#define TOPLEVEL 15
#define TASK_INFO 2399
// Bool
new bool:g_bKilledZombie[MAXPLAYERS+1][33]
// String
new g_szMotd[1536]
new g_sName[MAXPLAYERS+1][32]
// Variables
new g_iLevel[MAXPLAYERS+1], g_iXP[MAXPLAYERS+1]
new g_iDamage[MAXPLAYERS+1][33], g_iSprite[MAXPLAYERS+1]
new g_iSteamID[MAXPLAYERS+1][32]
new g_iZombieScore, g_iHumanScore
new g_iVault, g_msgSayText
new g_iELevelBonus, g_iEAPRewards, g_iEHitRecieved, g_iEHitDealt, g_iEShowScore, g_iEHumanWin, g_iEHumanWinBonus
, g_iEZombieWinBonus, g_iEZombieInfectBonus, g_iESurvKillBonus, g_iENemKillBonus, g_iEDamageEXP
, g_iEHPBonus, g_iEArmorBonus
new g_iSaveType, g_iConnectMessage, g_iELevelIcon, g_iLevelIconTime, g_iEInformHud, g_iHudLocation
, g_iHudColors, g_iScoreColors, g_iHumanEXP, g_iZombieEXP, g_iHeadShotEXP, g_iLevelEXPBonus, g_iLevelHPBonus
, g_iLevelArBonus, g_iLevelAPBonus, g_iHumanWinEXP, g_iZombieWinEXP, g_iInfectEXP, g_iSurKillEXP
, g_iNemKillEXP, g_iDamageAmount, g_iDamageEXP
#if defined IM_USING_ZP50
new g_iMaxHealth[MAXPLAYERS+1]
new g_iEAssistEXP, g_iAssistEXP, g_iAssistDivide
#endif
#if defined DATA_EXPIRED
new g_iDataExpired
#endif
public plugin_init()
{
// Original plugin is by Excalibur007. ;)
register_plugin("Custom Level", VERSION, "zmd94")
register_dictionary("custom_level.txt")
#if defined CUSTOM_CHAT
register_clcmd("say", "custom_say")
register_clcmd("say_team", "custom_say_team")
#endif
register_clcmd("say /cles", "custom_menu")
register_clcmd("say_team /cles", "custom_menu")
register_clcmd("say /clnext", "show_stats")
register_clcmd("say_team /clnext", "show_stats")
register_clcmd("say /cltop", "show_global_top")
register_clcmd("say_team /cltop", "show_global_top")
register_clcmd("say /ontop", "show_online_top")
register_clcmd("say_team /ontop", "show_online_top")
register_clcmd("say /savecl", "save_data")
register_clcmd("say_team /savecl", "save_data")
register_clcmd("free_give","cl_give", ADMIN_FLAG, "Enable to give free EXP")
register_event("HLTV", "event_new_round", "a", "1=0", "2=0")
register_event("Damage", "event_Damage", "be", "2!0", "3=0", "4!0")
register_event("DeathMsg", "event_DeathMsg", "a", "1>0")
register_event("StatusValue", "event_StatusValue", "be", "1=2", "2!0")
register_event("TextMsg", "event_Restart", "a", "2Game_C", "2Game_w")
RegisterHam(Ham_Spawn, "player", "fw_PlayerRespawn", 1)
#if defined CHANGE_NAME
register_forward( FM_ClientUserInfoChanged, "FwdClientUserInfoChanged" )
#endif
g_iSaveType = register_cvar("cl_save_type", "2") // 1; Save the EXP via player steamID | 2; Save the EXP via player name
#if defined DATA_EXPIRED
g_iDataExpired = register_cvar("cl_data_expired", "5") // This will remove all entries in the vault that are X days old
#endif
g_iConnectMessage = register_cvar("cl_connect_message", "1") // Enable connect message
g_iHumanEXP = register_cvar("cl_human_EXP", "20") // Amount of EXP gain from killing a zombie without headshot
g_iZombieEXP = register_cvar("cl_zombie_EXP", "100") // Amount of EXP gain from killing a human
g_iHeadShotEXP = register_cvar("cl_level_head_EXP", "30") // Amount of EXP gain from killing a zombie with headshot
g_iELevelIcon = register_cvar("cl_level_icon", "1") // Enable level icon
g_iLevelIconTime = register_cvar("cl_level_icon_time", "1.5") // The time for the icon to stay displaying
g_iELevelBonus = register_cvar("cl_level_bonus", "1") // Enable level bonus
g_iLevelEXPBonus = register_cvar("cl_EXP_bonus", "3") // Amount of EXP gain when level up
g_iEHPBonus = register_cvar("cl_enable_health_bonus", "1") // Enable HP bonus
g_iLevelHPBonus = register_cvar("cl_health_bonus", "10") // The values of health reward
g_iEArmorBonus = register_cvar("cl_enable_armor_bonus", "1") // Enable armor bonus
g_iLevelArBonus = register_cvar("cl_armor_bonus", "10") // The values of armor reward
g_iEAPRewards = register_cvar("cl_enable_AP_bonus", "1") // Enable ammo packs reward when level up
g_iLevelAPBonus = register_cvar("cl_AP_amount", "25") // The values of ammo packs reward
g_iEInformHud = register_cvar("cl_level_hud", "1") // Enable level hud information
g_iHudColors = register_cvar("cl_hud_colors", "255 0 0")
g_iHudLocation = register_cvar("cl_hud_position", "2") // 1; The position of hud information is in the left | 2; The position of hud information is in the right
g_iEDamageEXP = register_cvar("cl_level_damage", "1") // Enable human to recieve EXP from dealing a damage
g_iDamageAmount = register_cvar("cl_damage_amount", "50") // Amount of damage need to recieve EXP for human
g_iDamageEXP = register_cvar("cl_damage_EXP_amount", "1") // Amount of EXP gain from dealing a damage
g_iEHitRecieved = register_cvar("cl_show_hit_recieved", "1") // Enable showing recieved damage
g_iEHitDealt = register_cvar("cl_show_hit_dealt", "1") // Enable showing dealt damage
g_iEShowScore = register_cvar("cl_show_score", "1") // Enable showing score for zombie and human
g_iScoreColors = register_cvar("cl_score_colors", "0 255 0")
g_iEHumanWin = register_cvar("cl_human_win", "1") // Enable human to be a winner if nobody win
g_iEHumanWinBonus = register_cvar("cl_human_win_bonus", "1") // Enable win bonus for human
g_iHumanWinEXP = register_cvar("cl_human_win_amount", "500") // EXP given to human for winning
g_iEZombieWinBonus = register_cvar("cl_zombie_win_bonus", "1") // Enable win bonus for zombie
g_iZombieWinEXP = register_cvar("cl_zombie_win_amount", "500") // EXP given to zombie for winning
g_iEZombieInfectBonus = register_cvar("cl_zombie_infect_bonus", "1") // Enable EXP bonus for zombie when infecting human
g_iInfectEXP = register_cvar("cl_zombie_infect_amount", "50") // EXP given to zombie for infecting human
g_iESurvKillBonus = register_cvar("cl_survivor_kill_bonus", "1") // Enable kill bonus when killing survivor
g_iSurKillEXP = register_cvar("cl_survivor_bonus_amount", "200") // Then amount of EXP bonus by killing survivor
g_iENemKillBonus = register_cvar("cl_nemesis_kill_bonus", "1") // Enable kill bonus when killing nemesis
g_iNemKillEXP = register_cvar("cl_nemesis_bonus_amount", "500") // Then amount of EXP bonus by killing nemesis
#if defined IM_USING_ZP50
g_iEAssistEXP = register_cvar("cl_enable_assist", "1") // Enable EXP given for assisting players
g_iAssistEXP = register_cvar("cl_level_assist_EXP", "500") // Amount of EXP gain from assisting a non-zombie killer.
g_iAssistDivide = register_cvar("cl_level_assist_divide", "5") // Amount of damage [Zombie Max health / CVAR] needed to get an assist
#endif
g_msgSayText = get_user_msgid("SayText")
#if defined CUSTOM_CHAT
register_message(g_msgSayText, "message_SayText")
#endif
// Score Inform. ;)
if(get_pcvar_num(g_iEShowScore))
{
set_task(1.0, "ShowScore", 0, _, _, "b")
}
}
public plugin_precache()
{
if(get_pcvar_num(g_iELevelIcon))
{
new szFile[35]
for(new i = 0; i < sizeof(RANKS); i++)
{
formatex(szFile, charsmax(szFile), "sprites/zombie_plague/level/%i.spr", i)
g_iSprite[i] = precache_model(szFile)
}
}
}
public plugin_cfg()
{
new sCFGdir[32]
get_configsdir(sCFGdir, charsmax(sCFGdir))
server_cmd("exec %s/cl_system.cfg", sCFGdir)
g_iVault = nvault_open(VAULTNAME)
if(g_iVault == INVALID_HANDLE)
{
new szText[128]; formatex(szText, 127, "Error opening CLeS database [%s]", VAULTNAME);
set_fail_state(szText)
}
server_print("CLeS database [%s] successfully loaded!", VAULTNAME)
#if defined DATA_EXPIRED
nvault_prune(g_iVault, 0, get_systime() - (86400 * get_pcvar_num(g_iDataExpired)))
#endif
FormatTop(TOPLEVEL)
}
public plugin_end()
{
nvault_close(g_iVault)
}
public zp_round_ended(iTeam)
{
new iPlayers[MAXPLAYERS], iPlayerCount, i, player
switch(iTeam)
{
case WIN_ZOMBIES:
{
if(get_pcvar_num(g_iEShowScore))
{
g_iZombieScore ++
}
if(get_pcvar_num(g_iEZombieWinBonus))
{
get_players(iPlayers, iPlayerCount, "ac")
for(i = 0; i < iPlayerCount; i++)
{
player = iPlayers[i]
if(zp_get_user_zombie(player))
{
g_iXP[player] += get_pcvar_num(g_iZombieWinEXP)
sChatColor(player, "^x04[CL]^x03 %L", LANG_PLAYER, "CL_ZOMBIE_WIN", get_pcvar_num(g_iZombieWinEXP))
ReviewLevel(player)
}
}
}
}
case WIN_HUMANS:
{
if(get_pcvar_num(g_iEShowScore))
{
g_iHumanScore ++
}
if(get_pcvar_num(g_iEHumanWinBonus))
{
get_players(iPlayers, iPlayerCount, "ac")
for(i = 0; i < iPlayerCount; i++)
{
player = iPlayers[i]
if(!zp_get_user_zombie(player))
{
g_iXP[player] += get_pcvar_num(g_iHumanWinEXP)
sChatColor(player, "^x04[CL]^x03 %L", LANG_PLAYER, "CL_HUMAN_WIN", get_pcvar_num(g_iHumanWinEXP))
ReviewLevel(player)
}
}
}
}
case WIN_NO_ONE:
{
if(get_pcvar_num(g_iEHumanWin))
{
g_iHumanScore ++
if(get_pcvar_num(g_iEHumanWinBonus))
{
get_players(iPlayers, iPlayerCount, "ac")
for(i = 0; i < iPlayerCount; i++)
{
player = iPlayers[i]
if(!zp_get_user_zombie(player))
{
g_iXP[player] += get_pcvar_num(g_iHumanWinEXP)
sChatColor(player, "^x04[CL]^x03 %L", LANG_PLAYER, "CL_HUMAN_SURVIVE", get_pcvar_num(g_iHumanWinEXP))
ReviewLevel(player)
}
}
}
}
}
}
}
public client_authorized(id)
{
switch(get_pcvar_num(g_iSaveType))
{
case 1:
{
get_user_authid(id, g_iSteamID[id], charsmax(g_iSteamID))
}
case 2:
{
get_user_name(id, g_sName[id], charsmax(g_sName))
}
}
}
public client_putinserver(id)
{
if(is_user_connected(id))
{
LoadData(id)
if(get_pcvar_num(g_iConnectMessage))
{
new szName[32]
get_user_name(id, szName, charsmax(szName))
sChatColor(0, "^x04[CL]^x01 %L", LANG_PLAYER, "CL_CONNECT_MESSAGE", szName, RANKS[g_iLevel[id]], g_iXP[id])
}
if(get_pcvar_num(g_iEInformHud))
{
set_task(1.0, "InfoHud", id+TASK_INFO, _, _, "b")
}
}
}
public client_disconnect(id)
{
SaveData(id)
remove_task(id+TASK_INFO)
g_iLevel[id] = 0
g_iXP[id] = 0
}
public InfoHud(id)
{
id -= TASK_INFO
new PlayerInfoHud = CreateHudSyncObj()
new iHudLocation = get_pcvar_num(g_iHudLocation)
new szColors[16]
new szRed[4], szGreen[4], szBlue[4]
new iRed, iGreen, iBlue
get_pcvar_string(g_iHudColors, szColors, charsmax(szColors))
parse(szColors, szRed, charsmax(szRed), szGreen, charsmax(szGreen), szBlue, charsmax(szBlue))
iRed = str_to_num(szRed); iGreen = str_to_num(szGreen); iBlue = str_to_num(szBlue);
if(!is_user_alive(id))
{
static iSpec; iSpec = entity_get_int(id, EV_INT_iuser2)
if(!is_user_alive(iSpec))
return
new iSpecName[32]
get_user_name(iSpec, iSpecName, charsmax(iSpecName))
switch(iHudLocation)
{
case 1:
{
if(g_iLevel[iSpec] == 100)
{
set_hudmessage(iRed, iGreen, iBlue, 0.01, 0.28, 0, 6.0, 12.0, 0.0, 0.0, -1)
ShowSyncHudMsg(id, PlayerInfoHud,"[Spectating: %s] ^n[Level: Complete] ^n[EXP: Complete]", iSpecName)
}
else
{
set_hudmessage(iRed, iGreen, iBlue, 0.01, 0.28, 0, 6.0, 12.0, 0.0, 0.0, -1)
ShowSyncHudMsg(id, PlayerInfoHud,"[Spectating: %s] ^n[Level: %s] ^n[EXP: %d/ %d]", iSpecName, RANKS[g_iLevel[iSpec]], g_iXP[iSpec], EXP[g_iLevel[iSpec] + 1])
}
}
case 2:
{
if(g_iLevel[iSpec] == 100)
{
set_hudmessage(iRed, iGreen, iBlue, 0.75, 0.28, 0, 6.0, 12.0, 0.0, 0.0, -1)
ShowSyncHudMsg(id, PlayerInfoHud,"[Spectating: %s] ^n[Level: Complete] ^n[EXP: Complete]", iSpecName)
}
else
{
set_hudmessage(iRed, iGreen, iBlue, 0.75, 0.28, 0, 6.0, 12.0, 0.0, 0.0, -1)
ShowSyncHudMsg(id, PlayerInfoHud,"[Spectating: %s] ^n[Level: %s] ^n[EXP: %d/ %d]", iSpecName, RANKS[g_iLevel[iSpec]], g_iXP[iSpec], EXP[g_iLevel[iSpec] + 1])
}
}
}
}
else
{
switch(iHudLocation)
{
case 1:
{
if(g_iLevel[id] == 100)
{
set_hudmessage(iRed, iGreen, iBlue, 0.01, 0.28, 0, 6.0, 12.0, 0.0, 0.0, -1)
ShowSyncHudMsg(id, PlayerInfoHud,"[Level: Complete] ^n[EXP: Complete]")
}
else
{
set_hudmessage(iRed, iGreen, iBlue, 0.01, 0.28, 0, 6.0, 12.0, 0.0, 0.0, -1)
ShowSyncHudMsg(id, PlayerInfoHud,"[Level: %s] ^n[EXP: %d/ %d]",RANKS[g_iLevel[id]], g_iXP[id], EXP[g_iLevel[id] + 1])
}
}
case 2:
{
if(g_iLevel[id] == 100)
{
set_hudmessage(iRed, iGreen, iBlue, 0.75, 0.28, 0, 6.0, 12.0, 0.0, 0.0, -1)
ShowSyncHudMsg(id, PlayerInfoHud,"[Level: Complete] ^n[EXP: Complete]")
}
else
{
set_hudmessage(iRed, iGreen, iBlue, 0.75, 0.28, 0, 6.0, 12.0, 0.0, 0.0, -1)
ShowSyncHudMsg(id, PlayerInfoHud,"[Level: %s] ^n[EXP: %d/ %d]",RANKS[g_iLevel[id]], g_iXP[id], EXP[g_iLevel[id] + 1])
}
}
}
}
}
public ShowScore()
{
new ScoreHud = CreateHudSyncObj()
new szColors[16]
new szRed[4], szGreen[4], szBlue[4]
new iRed, iGreen, iBlue
get_pcvar_string(g_iScoreColors, szColors, charsmax(szColors))
parse(szColors, szRed, charsmax(szRed), szGreen, charsmax(szGreen), szBlue, charsmax(szBlue))
iRed = str_to_num(szRed); iGreen = str_to_num(szGreen); iBlue = str_to_num(szBlue);
set_hudmessage(iRed, iGreen, iBlue, -1.0, 0.02, 0, 12.0, 12.0, 0.0, 0.0, -1)
ShowSyncHudMsg(0, ScoreHud, "[Zombie] - [Human]^n[%s%d] ----- [%s%d]",g_iZombieScore >= 10 ? "" : "0", g_iZombieScore, g_iHumanScore >= 10 ? "" : "0", g_iHumanScore)
}
public custom_menu(id)
{
new sMenu = menu_create("\yLevel Menu \r3.1", "custom_handler")
menu_additem(sMenu, "\wShow global top player!", "1", 0)
menu_additem(sMenu, "\wShow online top player!", "2", 0)
menu_additem(sMenu, "\wEXP for next level", "3", 0)
menu_additem(sMenu, "\wSave your EXP!", "4", 0)
menu_display(id, sMenu, 0)
}
public custom_handler(id, menu, item)
{
if(item == MENU_EXIT)
{
menu_destroy(menu)
return PLUGIN_HANDLED
}
switch(item)
{
case 0: show_global_top(id)
case 1: show_online_top(id)
case 2: show_stats(id)
case 3: save_data(id)
}
menu_destroy(menu)
return PLUGIN_HANDLED
}
#if defined CUSTOM_CHAT
public custom_say(id)
{
new szMessage[192], szName[32]
read_args(szMessage, charsmax(szMessage))
remove_quotes(szMessage)
get_user_name(id, szName, charsmax(szName))
if(equali(szMessage[0], " ") || equali(szMessage[0], "") || !is_valid_msg(szMessage))
return PLUGIN_HANDLED_MAIN
if(is_user_alive(id))
{
format(szMessage, charsmax(szMessage), "^4[%s] ^3%s : ^1%s", RANKS[g_iLevel[id]], szName, szMessage)
}
else
{
format(szMessage, charsmax(szMessage), "^1*DEAD* ^4[%s] ^3%s : ^1%s", RANKS[g_iLevel[id]], szName, szMessage)
}
new iPlayers[MAXPLAYERS], iPlayerCount, i, player
get_players(iPlayers, iPlayerCount, "ch")
for(i = 0; i < iPlayerCount; i++)
{
player = iPlayers[i]
if(is_user_alive(id) && is_user_alive(player) || !is_user_alive(id) && !is_user_alive(player))
{
message_begin(MSG_ONE, g_msgSayText, {0, 0, 0}, player)
write_byte(id)
write_string(szMessage)
message_end()
}
}
return PLUGIN_CONTINUE
}
public custom_say_team(id)
{
new szMessage[192], szName[32]
read_args(szMessage, charsmax(szMessage))
remove_quotes(szMessage)
get_user_name(id, szName, charsmax(szName))
if(equali(szMessage[0], " ") || equali(szMessage[0], "") || !is_valid_msg(szMessage))
return PLUGIN_HANDLED_MAIN
if(is_user_alive(id))
{
format(szMessage, charsmax(szMessage), "^4[%s] ^3%s : ^1%s", RANKS[g_iLevel[id]], szName, szMessage)
}
else
{
format(szMessage, charsmax(szMessage), "^1*DEAD* ^4[%s] ^3%s : ^1%s", RANKS[g_iLevel[id]], szName, szMessage)
}
new iPlayers[MAXPLAYERS], iPlayerCount, i, player
get_players(iPlayers, iPlayerCount, "ch")
for(i = 0; i < iPlayerCount; i++)
{
player = iPlayers[i]
if(is_user_alive(id) && is_user_alive(player) && get_user_team(id) == get_user_team(player) || !is_user_alive(id) && !is_user_alive(player) && get_user_team(id) == get_user_team(player))
{
message_begin(MSG_ONE, g_msgSayText, {0, 0, 0}, player)
write_byte(id)
write_string(szMessage)
message_end()
}
}
return PLUGIN_CONTINUE
}
#endif
public cl_give(id, level, cid)
{
if (!cmd_access(id, level, cid, 2))
{
return PLUGIN_HANDLED
}
new iTarget[32], iCount[32]
read_argv(1, iTarget, charsmax(iTarget))
read_argv(2, iCount, charsmax(iCount))
new target_id, iName[32], iNameID[32]
target_id = find_player("bl", iTarget)
get_user_name(target_id, iName, charsmax(iName))
get_user_name(id, iNameID, charsmax(iNameID))
if(!target_id)
{
console_print(id, "Can't find that player")
return PLUGIN_HANDLED
}
if(read_argc() != 3)
{
return PLUGIN_HANDLED
}
if(str_to_num(iCount) < (EXP[g_iLevel[target_id] + 1] - g_iXP[target_id]))
{
if(str_to_num(iCount) == 0)
{
console_print(id, "EXP for %s is %i / %i", iName, g_iXP[target_id], EXP[g_iLevel[target_id] + 1])
}
else
{
console_print(id, "%s has been given %i EXP", iName, str_to_num(iCount))
g_iXP[target_id] += str_to_num(iCount)
}
}
else
{
console_print(id, "Maximum EXP allowed for %s: %i", iName, (EXP[g_iLevel[target_id] + 1] - g_iXP[target_id]))
}
return PLUGIN_HANDLED;
}
public show_stats(id)
{
if(is_user_connected(id))
{
sChatColor(id, "^x04[CL]^x03 %L", id, "CL_SHOW_STAT", RANKS[g_iLevel[id]], (EXP[g_iLevel[id] + 1] - g_iXP[id]))
}
}
public show_online_top(id)
{
static Sort[33][2]
new szName[MAXPLAYERS+1][32]
new players[32], num, count, index
get_players(players, num)
for(new i = 0; i < num; i++)
{
index = players[i]
get_user_name(index, szName[index], charsmax(szName))
Sort[count][0] = index
Sort[count][1] = g_iXP[index]
count++
}
SortCustom2D(Sort, count, "CompareEXP")
new y = clamp(count, 0, 10)
new kindex, szMotd2[1536], len
szMotd2[0] = 0
add(szMotd2, charsmax(szMotd2),
"<html><style>\
body{background:#040404;font-family:Verdana, Arial, Sans-Serif;font-size:19pt;}\
.t{color:#808080;text-align:left; }\
#h{background: #0066CC url('http://onlyarg.com/foro/images/Amiral/thead.png') repeat-x;color:#E0E0E0;font-weight:bold;}\
#p{color:#D41313;}\
#n{color:#fff;}\
</style><body>\
<table cellspacing=0 width=100% class=t>")
add(szMotd2, charsmax(szMotd2),
"<tr><td id=h width=7%>#</td>\
<td id=h>NAME</td>\
<td id=h>LEVEL</td>\
<td id=h>EXP</td></tr>")
len = strlen(szMotd2)
for(new x = 0; x < y; x++)
{
kindex = Sort[x][0]
replace_all(szName[kindex], charsmax(szName), "<", "<")
replace_all(szName[kindex], charsmax(szName), ">", ">")
len += formatex(szMotd2[len], charsmax(szMotd2)-len,
"<tr><td id=p>%d</td>\
<td id=n>%s</td>\
<td>%d</td>\
<td>%d</td>", (x+1), szName[kindex], g_iLevel[kindex], g_iXP[kindex])
}
add(szMotd2, charsmax(szMotd2), "</table></body></html>")
show_motd(id, szMotd2, "ONLINE PLAYERS")
}
public CompareEXP(elem1[], elem2[])
{
if(elem1[1] > elem2[1]) return -1;
else if(elem1[1] < elem2[1]) return 1;
return 0;
}
public show_global_top(id)
{
show_motd(id, g_szMotd, "GLOBAL PLAYERS")
}
FormatTop(iNum)
{
enum _:sVaultData
{
VD_Key[64],
VD_Value
}
new sVault = nvault_util_open(VAULTNAME)
new Array:entries = ArrayCreate(sVaultData)
new sizeEntries;
new numEntries = nvault_util_count(sVault)
new data[sVaultData], value[128], data2[sVaultData]
for(new i = 0, pos, timestamp; i < numEntries; i++)
{
pos = nvault_util_read(sVault, pos, data[VD_Key], charsmax(data[VD_Key]), value, charsmax(value), timestamp);
data[VD_Value] = str_to_num(value)
if(sizeEntries == 0)
{
ArrayPushArray(entries, data)
sizeEntries++
}
else
{
for(timestamp = 0; timestamp <= sizeEntries; timestamp++)
{
if(timestamp == sizeEntries)
{
if(sizeEntries < iNum)
{
ArrayPushArray(entries, data)
sizeEntries++
}
break
}
ArrayGetArray(entries, timestamp, data2)
if(data[VD_Value] >= data2[VD_Value])
{
ArrayInsertArrayBefore(entries, timestamp, data)
if(sizeEntries < iNum)
{
sizeEntries++
}
else
{
ArrayDeleteItem(entries, sizeEntries);
}
break
}
}
}
}
nvault_util_close(sVault)
new iLen
new len = charsmax(g_szMotd)
iLen = formatex(g_szMotd, len, "<STYLE>body{background:#212121;color:#d1d1d1;font-family:Arial}table{width:100%%;font-size:19px}</STYLE><table cellpadding=1 cellspacing=1 border=0>")
iLen += formatex(g_szMotd[iLen], len - iLen, "<tr bgcolor=#333333><th width=1%%><align=left font color=white> %s <th width=5%%> %-22.22s <th width=5%%> %s", "#", "NAME", "LEVEL")
new i
for(i = 0; i < sizeEntries; i++)
{
ArrayGetArray(entries, i, data);
data[VD_Key][20] = 0;
replace_all(data[VD_Key], charsmax(data[VD_Key]), "<", "<")
replace_all(data[VD_Key], charsmax(data[VD_Key]), ">", ">")
iLen += formatex(g_szMotd[iLen], len - iLen, "<tr align=left%s><td align=left><font color=white> %d. <td> %-22.22s <td> %d", " bgcolor=#2b5b95",(i+1), data[VD_Key], data[VD_Value])
}
ArrayDestroy(entries);
iLen += formatex(g_szMotd[iLen], len - iLen, "</table></body>")
}
public save_data(id)
{
if(is_user_alive(id))
{
SaveData(id)
sChatColor(id, "^x04[CL]^x03 %L", LANG_PLAYER, "CL_SAVE")
}
}
public event_new_round()
{
new iPlayers[MAXPLAYERS], iPlayerCount, i, player
get_players(iPlayers, iPlayerCount, "a")
for(i = 0; i < iPlayerCount; i++)
{
player = iPlayers[i]
g_iDamage[player][player] = 0
}
}
public event_Restart()
{
if(get_pcvar_num(g_iEShowScore))
{
g_iZombieScore = 0
g_iHumanScore = 0
}
}
public event_Damage(iVictim)
{
static iAttacker; iAttacker = get_user_attacker(iVictim)
static iHit; iHit = read_data(2)
new AttackerHud = CreateHudSyncObj()
new VictimHud = CreateHudSyncObj()
if(iAttacker == iVictim || !is_user_alive(iAttacker) || !is_user_alive(iVictim))
return
if(get_pcvar_num(g_iEHitRecieved))
{
set_hudmessage(255, 0, 0, 0.45, 0.50, 2, 0.1, 4.0, 0.1, 0.1, -1)
ShowSyncHudMsg(iVictim, VictimHud, "%i^n", iHit)
}
if(get_pcvar_num(g_iEHitDealt))
{
set_hudmessage(0, 100, 200, -1.0, 0.55, 2, 0.1, 4.0, 0.02, 0.02, -1)
ShowSyncHudMsg(iAttacker, AttackerHud, "%i^n", iHit)
}
Show_spectate(iVictim, iAttacker, iHit)
if(zp_get_user_zombie(iVictim) && !zp_get_user_survivor(iAttacker))
{
g_iDamage[iAttacker][iVictim] += read_data(2)
if (get_pcvar_num(g_iEDamageEXP))
{
if(g_iDamage[iAttacker][iVictim] >= get_pcvar_num(g_iDamageAmount))
{
g_iXP[iAttacker] += get_pcvar_num(g_iDamageEXP)
sChatColor(iAttacker, "^x04[CL]^x01 %L", LANG_PLAYER, "CL_DEALT_DAMAGE", get_pcvar_num(g_iDamageEXP), get_pcvar_num(g_iDamageAmount))
g_iDamage[iAttacker][iVictim] = 0
ReviewLevel(iAttacker)
}
}
}
}
public Show_spectate(iVictim, iAttacker, iHit)
{
new AttackerSpecHud = CreateHudSyncObj()
new VictimSpecHud = CreateHudSyncObj()
new Players[MAXPLAYERS], iPlayerCount, i, id
get_players(Players, iPlayerCount, "bc")
for (i = 0; i < iPlayerCount; i++)
{
id = Players[i]
if (id != iVictim && entity_get_int(id, EV_INT_iuser2) == iVictim)
{
set_hudmessage(255, 0, 0, 0.45, 0.50, 2, 0.1, 4.0, 0.1, 0.1, -1)
ShowSyncHudMsg(id, VictimSpecHud, "%i^n", iHit)
}
if (id != iAttacker && entity_get_int(id, EV_INT_iuser2) == iAttacker)
{
set_hudmessage(0, 100, 200, -1.0, 0.55, 2, 0.1, 4.0, 0.02, 0.02, -1)
ShowSyncHudMsg(id, AttackerSpecHud, "%i^n", iHit)
}
}
}
public event_DeathMsg()
{
new iKiller; iKiller = read_data(1)
new iVictim; iVictim = read_data(2)
new iIsHeadshot; iIsHeadshot = read_data(3)
if(iVictim == iKiller || !is_user_alive(iKiller))
return
if(!zp_get_user_zombie(iKiller) || zp_get_user_survivor(iKiller))
{
if(zp_get_user_nemesis(iVictim))
{
if (get_pcvar_num(g_iESurvKillBonus))
{
g_iXP[iKiller] += get_pcvar_num(g_iNemKillEXP)
sChatColor(iKiller, "^x04[CL]^x03 %L", LANG_PLAYER, "CL_KILL_NEMESIS", get_pcvar_num(g_iNemKillEXP))
ReviewLevel(iKiller)
}
}
else
{
if(iIsHeadshot)
{
g_bKilledZombie[iKiller][iVictim] = true
g_iXP[iKiller] += get_pcvar_num(g_iHeadShotEXP)
sChatColor(iKiller, "^x04[CL]^x03 %L", LANG_PLAYER, "CL_HEADSHOT_KILL", get_pcvar_num(g_iHeadShotEXP))
}
else
{
g_bKilledZombie[iKiller][iVictim] = true
g_iXP[iKiller] += get_pcvar_num(g_iHumanEXP)
sChatColor(iKiller, "^x04[CL]^x03 %L", LANG_PLAYER, "CL_KILL", get_pcvar_num(g_iHumanEXP))
}
ReviewLevel(iKiller)
#if defined IM_USING_ZP50
if(get_pcvar_num(g_iEAssistEXP))
{
new iPlayers[MAXPLAYERS], iPlayerCount, i, id
get_players(iPlayers, iPlayerCount, "ah")
for(i = 0; i < iPlayerCount; i++)
{
id = iPlayers[i]
if(g_iDamage[id][iVictim] >= g_iMaxHealth[iVictim]/ get_pcvar_num(g_iAssistDivide))
{
if(!g_bKilledZombie[id][iVictim] && !zp_core_is_zombie(id))
{
g_iXP[id] += get_pcvar_num(g_iAssistEXP)
new szName[32]
get_user_name(iKiller, szName, charsmax(szName))
sChatColor(id, "^x04[CL]^x03 %L", LANG_PLAYER, "CL_ASSIST", get_pcvar_num(g_iAssistEXP), RANKS[g_iLevel[iKiller]], szName)
ReviewLevel(id)
g_iDamage[id][iVictim] = 0
}
else
{
g_bKilledZombie[id][iVictim] = false
}
}
}
}
#endif
}
}
else if(zp_get_user_zombie(iKiller) || zp_get_user_nemesis(iKiller))
{
if(zp_get_user_survivor(iVictim))
{
if(get_pcvar_num(g_iENemKillBonus))
{
g_iXP[iKiller] += get_pcvar_num(g_iSurKillEXP)
sChatColor(iKiller, "^x04[CL]^x03 %L", LANG_PLAYER, "CL_KILL_SURVIVOR", get_pcvar_num(g_iSurKillEXP))
ReviewLevel(iKiller)
}
}
else
{
g_iXP[iKiller] += get_pcvar_num(g_iZombieEXP)
sChatColor(iKiller, "^x04[CL]^x03 %L", LANG_PLAYER, "CL_KILL_HUMAN", get_pcvar_num(g_iZombieEXP))
ReviewLevel(iKiller)
}
}
}
public ReviewLevel(id)
{
while((g_iLevel[id] < 100 && g_iXP[id] >= EXP[g_iLevel[id] + 1]))
{
g_iLevel[id] += 1
sChatColor(id, "^x04[CL]^x03 %L", LANG_PLAYER, "CL_LEVEL_UP", RANKS[g_iLevel[id]])
if(get_pcvar_num(g_iELevelBonus))
{
g_iXP[id] += get_pcvar_num(g_iLevelEXPBonus)
sChatColor(id, "^x04[CL]^x03 %L", LANG_PLAYER, "CL_BONUS_EXP", get_pcvar_num(g_iLevelEXPBonus))
iBonus(id)
}
if(get_pcvar_num(g_iEAPRewards))
{
zp_set_user_ammo_packs(id, zp_get_user_ammo_packs(id) + get_pcvar_num(g_iLevelAPBonus))
sChatColor(id, "^x04[CL]^x03 %L", LANG_PLAYER, "CL_BONUS_AP", get_pcvar_num(g_iLevelAPBonus))
}
}
}
public event_StatusValue(id)
{
if(!get_pcvar_num(g_iELevelIcon))
return
new pid = read_data(2)
new pidlevel = g_iLevel[pid]
if(!pev_valid(pid) || !is_user_alive(pid) || zp_get_user_zombie(pid))
return
new flTime = floatround(get_pcvar_float(g_iLevelIconTime) * 10)
if (flTime > 0)
{
Create_TE_PLAYERATTACHMENT(id, pid, 55, g_iSprite[pidlevel], flTime)
}
}
public fw_PlayerRespawn(id)
{
if(is_user_alive(id))
{
if(get_pcvar_num(g_iELevelBonus))
{
set_task(5.0, "iBonus", id)
}
set_task(50.0, "iInform", id)
set_task(120.0, "iSave", id)
}
}
public iBonus(id)
{
if(is_user_alive(id) && !zp_get_user_zombie(id))
{
new iHealth = g_iLevel[id]* get_pcvar_num(g_iLevelHPBonus)
new iArmor = g_iLevel[id]* get_pcvar_num(g_iLevelArBonus)
if(get_pcvar_num(g_iEHPBonus))
{
set_user_health(id, get_user_health(id) + iHealth)
}
if(get_pcvar_num(g_iEArmorBonus))
{
set_user_armor(id, get_user_armor(id) + iArmor)
}
if(get_pcvar_num(g_iEHPBonus) && get_pcvar_num(g_iEArmorBonus))
{
sChatColor(id, "^x04[CL]^x03 %L", LANG_PLAYER, "CL_INFORM", RANKS[g_iLevel[id]], iHealth, iArmor)
}
}
}
public iInform(id)
{
if(is_user_alive(id))
{
sChatColor(id, "^x04[CL]^x03 %L", LANG_PLAYER, "CL_INFORM_2")
}
}
public iSave(id)
{
if(is_user_alive(id))
{
sChatColor(id, "^x04[CL]^x03 %L", LANG_PLAYER, "CL_INFORM_3")
}
}
#if defined CUSTOM_CHAT
public message_SayText(id)
{
return PLUGIN_HANDLED
}
#endif
#if defined IM_USING_ZP50
public zp_fw_core_infect_post(id, attacker)
{
if(zp_class_zombie_get_current(id) == ZP_INVALID_ZOMBIE_CLASS)
return;
g_iMaxHealth[id] = zp_class_zombie_get_max_health(id, zp_class_zombie_get_current(id))
if(get_pcvar_num(g_iEZombieInfectBonus))
{
if (is_user_alive(attacker) && attacker != id)
{
g_iXP[attacker] += get_pcvar_num(g_iInfectEXP)
sChatColor(attacker, "^x04[CL]^x03 %L", LANG_PLAYER, "CL_INFECT", get_pcvar_num(g_iInfectEXP))
ReviewLevel(id)
}
}
}
#else
public zp_user_infected_post(id, infector)
{
if(get_pcvar_num(g_iEZombieInfectBonus))
{
if(is_user_alive(infector) && infector != id)
{
g_iXP[infector] += get_pcvar_num(g_iInfectEXP)
sChatColor(infector, "^x04[CL]^x03 %L", LANG_PLAYER, "CL_INFECT", get_pcvar_num(g_iInfectEXP))
ReviewLevel(id)
}
}
}
#endif
#if defined CHANGE_NAME
public FwdClientUserInfoChanged( id, szBuffer )
{
if ( !is_user_connected( id ) )
return FMRES_IGNORED;
static szNewName[32];
engfunc( EngFunc_InfoKeyValue, szBuffer, "name", szNewName, charsmax(szNewName));
if(equal(szNewName, g_sName[id]))
return FMRES_IGNORED;
SaveData(id)
sChatColor(id, "^x04[CL]^x03 %L", LANG_PLAYER, "CL_CHANGE_NAME2", g_sName[id], szNewName)
sChatColor(id, "^x04[CL]^x03 %L", LANG_PLAYER, "CL_CHANGE_NAME3", szNewName)
copy(g_sName[id], charsmax(g_sName[]), szNewName)
LoadData(id)
sChatColor(id, "^x04[CL]^x03 %L", LANG_PLAYER, "CL_CHANGE_NAME4")
return FMRES_IGNORED;
}
#endif
SaveData(id)
{
new szData[32], szKey[40]
switch(get_pcvar_num(g_iSaveType))
{
case 1:
{
formatex(szKey, charsmax(szKey), "%s", g_iSteamID[id])
}
case 2:
{
formatex(szKey, charsmax(szKey), "%s", g_sName[id])
}
}
formatex(szData, charsmax(szData), "%d %d", g_iLevel[id], g_iXP[id])
nvault_set(g_iVault, szKey, szData)
}
LoadData(id)
{
new szData[32], szKey[40]
switch(get_pcvar_num(g_iSaveType))
{
case 1:
{
formatex(szKey, charsmax(szKey), "%s" , g_iSteamID[id])
}
case 2:
{
formatex(szKey, charsmax(szKey), "%s", g_sName[id])
}
}
if(nvault_get(g_iVault, szKey, szData, charsmax(szData)))
{
new iSpacePos = contain(szData, " ")
if(iSpacePos > -1)
{
new szLevel[8], szXP[32]
parse(szData, szLevel, charsmax(szLevel), szXP, charsmax(szXP))
g_iLevel[id] = str_to_num(szLevel)
g_iXP[id] = str_to_num(szXP)
}
}
}
#if defined CUSTOM_CHAT
bool:is_valid_msg(const szMessage[])
{
if(szMessage[0] == '@' || szMessage[0] == '/' || szMessage[0] == '!' || !strlen(szMessage))
return false
return true
}
#endif
stock Create_TE_PLAYERATTACHMENT(id, entity, vOffset, iSprite, life)
{
message_begin(MSG_ONE_UNRELIABLE, SVC_TEMPENTITY, _, id)
write_byte(TE_PLAYERATTACHMENT)
write_byte(entity)
write_coord(vOffset)
write_short(iSprite)
write_short(life)
message_end()
}
stock sChatColor(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, g_msgSayText, _, player)
write_byte(player)
write_string(msg)
message_end()
}
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1033\\ f0\\ fs16 \n\\ par }
*/