G4L4Xy wrote:Link'uri moarte... girlshare ma trimite pe alt site iar zippy zice sa iau legatura cu administratoru...
Am incercat sa compliez sma'urile dar se pare ca http://pastebin.com/K58eY263 , contine 13 erori si nu se poate complia... unele dintre sma au cate 2-3 warning dar asta are 13 si nici nu merge compliat
Code: Select all
#include <amxmodx>
#include <colorchat>
#include <nvault>
#include <amxmisc>
#include <hamsandwich>
#include <fun>
#include <cstrike>
#pragma semicolon 1
new gMaxPlayers, iLevels[33], iKills[33], Levels, g_msg_screenfade;
new bool:bPrefix, bool:bLogs, bool:bHud, gMenu, iKNum, iMax, bool:bFade, iLevHe, iLevSlot;
new bool:bBuy, bool:bSell, iPrice;
new const szgMenuItems[][] = { "Buy Level", "Sell Level", "\yList of Players", "\rInfo" };
new const gLogFile[] = "addons/amxmodx/configs/levels/LvlsAdmCmdsLogs.txt";
new const gDir[] = "addons/amxmodx/configs/levels/";
new const gUsersIni[] = "addons/amxmodx/configs/users.ini";
new const gSettingsFile[] = "addons/amxmodx/configs/levels/Settings.cfg";
new const gSettingsFileText[][] = {
"levels_logs ^"1^"
"levels_num_to_next ^"400^"
"levels_max_levels ^"10^"
"levels_chat_prefix ^"1^" //
"levels_hud_info ^"1^" //
"levels_fade ^"1^" //
"levels_he_lvl_num ^"5^" //
"levels_slot_lvl_num ^"10^" //
"levels_buy ^"0^" //
"levels_sell ^"1^" //
"levels_level_price ^"16000^" //
};
new const gLogFileText[][] = {
"Here you will find activity of admins",
"logs with commands: amx_setlvl, amx_addlvl and amx_resetlvl",
"====================================================================^n "
};
enum Cvars {
LOGS, KNUM, MAX, CHAT, HUD,
FADE, HE, SLOT, KUPOVINA, PRODAJA, CENA
}
new const CvarsNames[Cvars][] = {
"levels_logs", "levels_num_to_next", "levels_max_levels", "levels_chat_prefix", "levels_hud_info",
"levels_fade", "levels_he_lvl_num", "levels_slot_lvl_num", "levels_buy", "levels_sell", "levels_level_price"
};
new const CvarsAmmount[Cvars][] = {
"1", "400", "10", "1", "1",
"1", "5", "10", "0", "1", "16000"
};
new pCvars[Cvars];
public plugin_init() {
register_plugin("Levels", "1.0", "dEfuseRsBS");
Levels = nvault_open("Levels");
g_msg_screenfade = get_user_msgid("ScreenFade");
RegisterHam(Ham_Spawn, "player", "fw_PlSpawn", 1);
for(new Cvars:i = LOGS; i < Cvars; i++)
pCvars[i] = register_cvar(CvarsNames[i], CvarsAmmount[i]);
register_cvar("Levels", "1", FCVAR_SPONLY | FCVAR_SERVER);
set_task(0.5, "fw_CvarsCheck");
set_task(180.0, "fw_CvarsCheck", _, _, _, "b");
gMaxPlayers = get_maxplayers();
register_event("DeathMsg", "fw_Death", "a");
register_concmd("amx_setlvl", "fw_LvlSet", ADMIN_RCON, "<nick> <num> - set level to a player");
register_concmd("amx_addlvl", "fw_LvlAdd", ADMIN_RCON, "<nick> <num> - add level to a player");
register_concmd("amx_resetlvl", "fw_LvlReset", ADMIN_RCON, "<nick> - reset levels of a player");
register_clcmd("say /levels", "fw_LevelsCmd");
register_clcmd("buy_level", "fw_BuyLvl");
register_clcmd("sell_level", "fw_SellLvl");
register_clcmd("say", "fw_SayCmd");
gMenu = menu_create("\rLevels Menu", "h_gMenu");
for(new i = 0; i < sizeof szgMenuItems; i++)
menu_additem(gMenu, szgMenuItems[i]);
menu_addtext(gMenu, "\dCSDM MODE");
}
public plugin_precache() {
if(!dir_exists(gDir))
mkdir(gDir);
if(!file_exists(gLogFile))
for(new i = 0; i < sizeof gLogFileText; i++)
write_file(gLogFile, gLogFileText[i]);
if(!file_exists(gSettingsFile))
for(new x = 0; x < sizeof gSettingsFileText; x++)
write_file(gSettingsFile, gSettingsFileText[x]);
server_cmd("exec %s", gSettingsFile);
}
public fw_CvarsCheck() {
if(get_pcvar_num(pCvars[CHAT]) == 1)
bPrefix = true;
else bPrefix = false;
if(get_pcvar_num(pCvars[LOGS]) == 1)
bLogs = true;
else bLogs = false;
if(get_pcvar_num(pCvars[HUD]) == 1)
bHud = true;
else bHud = false;
if(get_pcvar_num(pCvars[FADE]) == 1)
bFade = true;
else bFade = false;
if(get_pcvar_num(pCvars[KUPOVINA]) == 1)
bBuy = true;
else bBuy = false;
if(get_pcvar_num(pCvars[PRODAJA]) == 1)
bSell = true;
else bSell = false;
iKNum = get_pcvar_num(pCvars[KNUM]);
iMax = get_pcvar_num(pCvars[MAX]);
iLevHe = get_pcvar_num(pCvars[HE]);
iLevSlot = get_pcvar_num(pCvars[SLOT]);
iPrice = get_pcvar_num(pCvars[CENA]);
}
public fw_BuyLvl(id) {
new szFArg[35], szText[255];
read_argv(1, szFArg, charsmax(szFArg));
new iFArg = str_to_num(szFArg);
if(iFArg <= 0)
formatex(szText, charsmax(szText), "Wrong number of input");
else {
new iUserMoney = cs_get_user_money(id);
new iCena = iPrice * iFArg;
if(iUserMoney < iCena)
formatex(szText, charsmax(szText), "You do not have enough money for^3 %i^1 level. It takes^3 %i", iFArg, iCena);
else {
iLevels[id] += iFArg;
cs_set_user_money(id, iUserMoney - iCena);
formatex(szText, charsmax(szText), "You bought^3 %i^1 level for^3 %i^1$", iFArg, iCena);
}
}
ColorChat(id, TEAM_COLOR, "^4[Levels]^1 %s", szText);
}
public fw_SellLvl(id) {
new szFArg[35], szText[255];
read_argv(1, szFArg, charsmax(szFArg));
new iFArg = str_to_num(szFArg);
if(iFArg <= 0)
formatex(szText, charsmax(szText), "Wrong number of input");
else {
if(iLevels[id] < iFArg)
formatex(szText, charsmax(szText), "You do not have enough level, you can sell maxim^3 %i^1 level", iLevels[id]);
else {
new iCena = iPrice * iFArg;
iLevels[id] -= iFArg;
cs_set_user_money(id, cs_get_user_money(id) + iCena);
formatex(szText, charsmax(szText), "You sold^3 %i^1 level for^3 %i^1$", iFArg, iCena);
}
}
ColorChat(id, TEAM_COLOR, "^4[Levels]^1 %s", szText);
}
public fw_PlSpawn(id)
if(is_user_alive(id) && (iLevels[id] >= iLevHe))
give_item(id, "weapon_hegrenade");
public fw_LevelsCmd(id)
menu_display(id, gMenu);
public h_gMenu(id, menu, item) {
switch(item) {
case MENU_EXIT: return PLUGIN_HANDLED;
case 0: {
if(!bBuy)
ColorChat(id, TEAM_COLOR, "^4[Levels]^1 This item is excluded");
else {
client_cmd(id, "messagemode KUPOVINA_LEVELA");
ColorChat(id, GREEN, "[Levels] Enter the number of levels to buy, the price of one level is: %i", iPrice);
}
}
case 1: {
if(!bSell)
ColorChat(id, TEAM_COLOR, "^4[Levels]^1 This item is excluded");
else {
client_cmd(id, "messagemode PRODAJA_LEVELA");
ColorChat(id, GREEN, "[Levels] Enter the number of levels of sales, the cost of one level is: %i", iPrice);
}
}
case 2: {
set_hudmessage(255, 0, 0, -1.0, 0.49, 0, 6.0, 12.0);
show_hudmessage(id, "View console");
new num, players[32], player;
get_players(players, num, "a");
console_print(id, "=============================================");
console_print(id, " ^nList of players on the server to their level and kills ^n ");
for(new i = 0; i < num; i++) {
player = players[i];
new szName[35];
get_user_name(player, szName, charsmax(szName));
console_print(id, "Player: %s | Levels: %i | Kills: %i", szName, iLevels[player], iKills[player]);
}
console_print(id, " ^n=============================================");
}
case 3: {
set_hudmessage(255, 0, 0, -1.0, 0.49, 0, 6.0, 12.0);
show_hudmessage(id, "View console");
console_print(id, "============================================= ^n ");
console_print(id, "Levels v1.0");
console_print(id, "After the %i kills will get higher level", iKNum);
console_print(id, "The maximum number of levels is %i", iMax);
if(bPrefix)
console_print(id, "Number of levels is printed as a prefix command say");
if(bHud)
console_print(id, "Under the radar you can view your level and kills");
if(bFade)
console_print(id, "After traversed level will briefly display the time change color");
if(iLevHe <= iMax)
console_print(id, "After traversed %i level, each round players receive a He Grenade", iLevHe);
if(iLevSlot <= iMax)
console_print(id, "After traversed %i level, the player receives a slot", iLevSlot);
console_print(id, " ");
console_print(id, "Admin comands: ^n ");
console_print(id, "amx_setlvl <nick> <num> - adjust a player level");
console_print(id, "amx_addlvl <nick> <num> - add level to a player");
console_print(id, "amx_resetlvl <nick> - reset level to a player");
console_print(id, " ^n=============================================");
}
}
return PLUGIN_HANDLED;
}
public fw_LvlSet(id, level, cid) {
if(!cmd_access(id, level, cid, 3))
return PLUGIN_HANDLED;
new szFArg[35], szSArg[16];
read_argv(1, szFArg, charsmax(szFArg));
read_argv(2, szSArg, charsmax(szSArg));
new iNum = str_to_num(szSArg);
new gTarget = cmd_target(id, szFArg, CMDTARGET_ALLOW_SELF | CMDTARGET_NO_BOTS | CMDTARGET_OBEY_IMMUNITY);
if(!is_user_connected(gTarget) || iNum > iMax)
return PLUGIN_HANDLED;
new szPlName[35], szAdmName[35];
iLevels[gTarget] = iNum;
get_user_name(id, szAdmName, charsmax(szAdmName));
get_user_name(gTarget, szPlName, charsmax(szPlName));
ColorChat(id, TEAM_COLOR, "^4[Levels]^1 You set the level of the player^3 %s^1 to^3 %s", szPlName, iNum);
ColorChat(gTarget, TEAM_COLOR, "^4[Levels]^1 Admin^3 %s^1 set the number of levels to^3 %s", szAdmName, iNum);
if(bLogs) {
new szText[250];
formatex(szText, charsmax(szText), "[amx_setlvl] Admin: %s | Player: %s | Levels: %i", szAdmName, szPlName, iNum);
write_file(gLogFile, szText);
}
return PLUGIN_HANDLED;
}
public fw_LvlAdd(id, level, cid) {
if(!cmd_access(id, level, cid, 3))
return PLUGIN_HANDLED;
new szFArg[35], szSArg[16];
read_argv(1, szFArg, charsmax(szFArg));
read_argv(2, szSArg, charsmax(szSArg));
new iNum = str_to_num(szSArg);
new gTarget = cmd_target(id, szFArg, CMDTARGET_ALLOW_SELF | CMDTARGET_NO_BOTS | CMDTARGET_OBEY_IMMUNITY);
if(!is_user_connected(gTarget) || ((iLevels[gTarget] + iNum) > iMax))
return PLUGIN_HANDLED;
new szPlName[35], szAdmName[35];
iLevels[gTarget] += iNum;
get_user_name(id, szAdmName, charsmax(szAdmName));
get_user_name(gTarget, szPlName, charsmax(szPlName));
ColorChat(id, TEAM_COLOR, "^4[Levels]^1 You added to the player^3 %s^4 %i^1 levels", szPlName, iNum);
ColorChat(gTarget, TEAM_COLOR, "^4[Levels]^1 Admin^3 %s^1 added to^3 %s^1 levels", szAdmName, iNum);
if(bLogs) {
new szText[250];
formatex(szText, charsmax(szText), "[amx_addlvl] Admin: %s | Player: %s | Levels: %i", szAdmName, szPlName, iNum);
write_file(gLogFile, szText);
}
return PLUGIN_HANDLED;
}
public fw_LvlReset(id, level, cid) {
if(!cmd_access(id, level, cid, 2))
return PLUGIN_HANDLED;
new szFArg[35];
read_argv(1, szFArg, charsmax(szFArg));
new gTarget = cmd_target(id, szFArg, CMDTARGET_ALLOW_SELF | CMDTARGET_NO_BOTS | CMDTARGET_OBEY_IMMUNITY);
if(!is_user_connected(gTarget))
return PLUGIN_HANDLED;
new szPlName[35], szAdmName[35];
iLevels[gTarget] = 0;
get_user_name(id, szAdmName, charsmax(szAdmName));
get_user_name(gTarget, szPlName, charsmax(szPlName));
ColorChat(id, TEAM_COLOR, "^4[Levels]^1 You have reseted player^3 %s^1 levels", szPlName);
ColorChat(gTarget, TEAM_COLOR, "^4[Levels]^1 Admin^3 %s^1 has reseted levels", szAdmName);
if(bLogs) {
new szText[250];
formatex(szText, charsmax(szText), "[amx_resetlvl] Admin: %s | Player: %s", szAdmName, szPlName);
write_file(gLogFile, szText);
}
return PLUGIN_HANDLED;
}
public client_putinserver(id) {
new szAuthID[35], szNum[55], leveli[30], kilovi[30], szIp[25];
get_user_ip(id, szIp, charsmax(szIp));
get_user_authid(id, szAuthID, charsmax(szAuthID));
if(equal(szAuthID, "VALVE_ID_LAN"))
nvault_get(Levels, szIp, szNum, 101);
else nvault_get(Levels, szAuthID, szNum, 101);
parse(szNum, leveli, charsmax(leveli), kilovi, charsmax(kilovi));
iLevels[id] = str_to_num(leveli);
iKills[id] = str_to_num(kilovi);
set_task(3.0, "fw_HudInfo", id);
if(iLevels[id] >= iLevSlot) {
new szText[225];
if(!equal(szAuthID, "VALVE_ID_LAN"))
formatex(szText, charsmax(szText), "^"%s^" ^"^" ^"b^" ^"ce^"", szAuthID);
else formatex(szText, charsmax(szText), "^"%s^" ^"^" ^"b^" ^"de^"", szIp);
write_file(gUsersIni, szText);
ColorChat(id, TEAM_COLOR, "^4[Levels]^1 Congratulations, you have a free slot for^3 %i^1 levels", iLevSlot);
}
set_task(3.5, "fw_Add", id);
}
public fw_Add(id) {
if(is_user_connected(id)) {
set_hudmessage(0, 170, 255, -1.0, 0.0, 0, 6.0, 12.0);
show_hudmessage(id, "This server is runing ^nLevels Plugin");
}
}
public fw_HudInfo(id) {
if(is_user_connected(id) && bHud) {
set_hudmessage(51, 102, 153, 0.02, 0.17, 0, 6.0, 12.0);
show_hudmessage(id, "[ Level: %i ] ^n[ Kills: %i / %i]", iLevels[id], iKills[id], iKNum);
set_task(5.0, "fw_HudInfo", id);
}
}
public client_disconnect(id) {
new szAuthID[35], szNum[55];
get_user_authid(id, szAuthID, charsmax(szAuthID));
formatex(szNum, charsmax(szNum), "%i %i", iLevels[id], iKills[id]);
if(equal(szAuthID, "VALVE_ID_LAN")) {
new szIp[25];
get_user_ip(id, szIp, charsmax(szIp));
nvault_set(Levels, szIp, szNum);
}
else nvault_set(Levels, szAuthID, szNum);
}
public fw_Death() {
new id = read_data(1);
if(id <= gMaxPlayers) {
if(is_user_connected(id)) {
iKills[id]++;
if(iLevels[id] >= iMax)
return;
set_hudmessage(255, 0, 0, -1.0, 0.62, 0, 6.0, 12.0);
if(iKills[id] == iKNum) {
iLevels[id]++;
iKills[id] = 0;
show_hudmessage(id, "[ You are now level %i ]", iLevels[id]);
if(bFade)
set_user_fade(id);
}
else show_hudmessage(id, "[ %i / %i Kills ]", iKills[id], iKNum);
}
}
}
public fw_SayCmd(id) {
if(bPrefix) {
new szName[33], szArgs[192], szPrefix[16];
get_user_name(id, szName, charsmax(szName));
read_args(szArgs, charsmax(szArgs));
remove_quotes(szArgs);
if(!is_user_alive(id))
szPrefix = "*DEAD* ";
ColorChat(0, TEAM_COLOR, "^1%s^4[ Level: %i ]^3 %s^1 : %s", szPrefix, iLevels[id], szName, szArgs);
return PLUGIN_HANDLED;
}
return PLUGIN_CONTINUE;
}
stock set_user_fade(index) {
message_begin(MSG_ONE_UNRELIABLE, g_msg_screenfade, _, index);
write_short((1 << 12) * 1);
write_short(floatround((1 << 12) * 0.1));
write_short(0x0000);
write_byte(0);
write_byte(255);
write_byte(255);
write_byte(150);
message_end();
}