| Ray Brown |
05-31-2018 13:22 |
Case and Keys problem (need make save)
1 Attachment(s)
Good day, guys ! Need your help
In general, this is the problem: i found a plugin on the Internet and in this plugin there are still keys for opening cases and the essence of something is that after leaving the server, these keys are reset to 0, and I need to save or after logging out of the server and change the card
It is possible to make saving this information about player and how many keys he have in .txt file in folder "data" ?
PHP Code:
#pragma tabsize 0
#include <amxmodx> #include <fakemeta> #include <cstrike>
#define Get_User_Admin(%0) (get_user_flags(%0) & ADMIN_IMMUNITY)
new Bilet[33] new const serverIP[] = "178.170.189.218:27031";
public plugin_init() {
new szIp[33]; get_user_ip( 0, szIp, charsmax(szIp)); if(!equal(szIp, serverIP)) { server_print("IP false"); set_fail_state("This plugin is private. Buy plugin vk.com/ray.brown"); } server_print("The plugin was successfully activated"); register_logevent("RoundStart", 2, "1=Round_Start"); register_menucmd(register_menuid("PL_HackedMenu"), (1<<0|1<<1|1<<2|1<<3|1<<9), "Handle_HackedMenu") register_menucmd(register_menuid("PL_BuyBilet"), (1<<0|1<<1|1<<9), "Handle_BuyBilet") register_menucmd(register_menuid("PL_BiletMenu"), (1<<0|1<<1|1<<2|1<<3|1<<4|1<<9), "Handle_BiletMenu") }
public plugin_natives() { register_native("open_menucaseserver", "menu_caseserver", 1) }
public client_putinserver(id) Bilet[id] = 1
public RoundStart() { for(new id = 1; id <= get_maxplayers(); id++) { if(Get_User_Admin(id)) { Bilet[id] = Bilet[id] + 1 ChatColor(id, "!y[!gАльфа!y] !tВы получили !g1 !tключ за донат") } else Bilet[id] = Bilet[id] + 1 } }
public menu_caseserver(id) return PL_HackedMenu(id)
PL_HackedMenu(id) { new menu[1024] new iKeys = (1<<2|1<<9) new len = formatex(menu, charsmax(menu), "\d~ \rWARGLORY \d| \wАльфа \d~^n\yГруппа\d: \rvk.com/warglory^n\r~ \d| \wВаши ключи\d: \y%d^n^n", Bilet[id]) if(Bilet[id] >= 20) { len += formatex(menu[len], charsmax(menu) - len, "\r1. \wКейс Прорыв \d- \r20 \wключей \d| \wПриз\d: \yПатруль^n") iKeys |= (1<<0); } else len += formatex(menu[len], charsmax(menu) - len, "\r1. \dКейс Прорыв - 20 ключей | Приз: Патруль^n") if(Bilet[id] >= 10) { len += formatex(menu[len], charsmax(menu) - len, "\r2. \wКейс Феникс \d- \r10 \wключей \d| \wПриз\d: \yЗвание+Скины^n^n") iKeys |= (1<<1); } else len += formatex(menu[len], charsmax(menu) - len, "\r2. \dКейс Феникс - 10 ключей | Приз: Звание+Скины^n^n") len += formatex(menu[len], charsmax(menu) - len, "\r3. \wКупить ключи^n") if(Get_User_Admin(id)) { len += formatex(menu[len], charsmax(menu) - len, "\r4. \wМеню ключей \d| \rПатруль^n^n") iKeys |= (1<<3) } else len += formatex(menu[len], charsmax(menu) - len, "\r4. \dМеню ключей | Патруль^n^n") formatex(menu[len], charsmax(menu) - len, "\r0. \wЗакрыть") return show_menu(id, iKeys, menu, -1, "PL_HackedMenu") }
public Handle_HackedMenu(id, iKey) { switch(iKey) { case 0: { new iHackedGo = random_num( 1, 4 ) switch(iHackedGo) { case 1: ChatColor(id, "!y[!gАльфа!y] !tНеудачно!y, !tвам нечего не выпало из кейса!y: !gПрорыв") case 2: ChatColor(id, "!y[!gАльфа!y] !tНеудачно!y, !tвам нечего не выпало из кейса!y: !gПрорыв") case 3: ChatColor(id, "!y[!gАльфа!y] !tНеудачно!y, !tвам нечего не выпало из кейса!y: !gПрорыв") case 4: ChatColor(id, "!y[!gАльфа!y] !tНеудачно!y, !tвам нечего не выпало из кейса!y: !gПрорыв") } Bilet[id] = Bilet[id] - 20 } case 1: { new iHackedGo = random_num( 1, 4 ) switch(iHackedGo) { case 1: ChatColor(id, "!y[!gАльфа!y] !tНеудачно!y, !tвам нечего не выпало из кейса!y: !gФеникс") case 2: ChatColor(id, "!y[!gАльфа!y] !tНеудачно!y, !tвам нечего не выпало из кейса!y: !gФеникс") case 3: ChatColor(id, "!y[!gАльфа!y] !tНеудачно!y, !tвам нечего не выпало из кейса!y: !gФеникс") case 4: ChatColor(id, "!y[!gАльфа!y] !tНеудачно!y, !tвам нечего не выпало из кейса!y: !gФеникс") } Bilet[id] = Bilet[id] - 10 } case 2: return PL_BuyBilet(id) case 3: return PL_BiletMenu(id) } return PLUGIN_HANDLED; }
PL_BuyBilet(id) { new menu[1024] new iKeys = (1<<2|1<<8|1<<9) new len = formatex(menu, charsmax(menu), "\d~ \rWARGLORY \d| \wАльфа \d~^n\yГруппа\d: \rvk.com/warglory^n\r~ \d| \wВаши деньги\d: \y%d^n^n", cs_get_user_money(id)) if(cs_get_user_money(id) >= 10000) { len += formatex(menu[len], charsmax(menu) - len, "\r1. \wКупить \r1 \wключ \d| \y10000\d$^n") iKeys |= (1<<0); } else len += formatex(menu[len], charsmax(menu) - len, "\r1. \dКупить 1 ключ | 10000$^n") if(cs_get_user_money(id) >= 16000) { len += formatex(menu[len], charsmax(menu) - len, "\r2. \wКупить \r3 \wключа \d| \y16000\d$^n^n") iKeys |= (1<<1); } else len += formatex(menu[len], charsmax(menu) - len, "\r2. \dКупить 3 ключа | 16000$^n^n") formatex(menu[len], charsmax(menu) - len, "\r0. \wЗакрыть") return show_menu(id, iKeys, menu, -1, "PL_BuyBilet") }
public Handle_BuyBilet(id, iKey) { switch(iKey) { case 0: { cs_set_user_money(id, cs_get_user_money(id) - 10000, 1) Bilet[id] = Bilet[id] + 1 ChatColor(id, "!y[!gАльфа!y] !tВы успешно купили !g1 !tключ") } case 1: { cs_set_user_money(id, cs_get_user_money(id) - 16000, 1) Bilet[id] = Bilet[id] + 3 ChatColor(id, "!y[!gАльфа!y] !tВы успешно купили !g3 !tключа") } case 8: return PL_HackedMenu(id) case 9: return PLUGIN_HANDLED } return PL_HackedMenu(id) }
PL_BiletMenu(id) { new menu[1024] new iKeys = (1<<0|1<<1|1<<2|1<<3|1<<8|1<<9) new len = formatex(menu, charsmax(menu), "\d~ \rWARGLORY \d| \wАльфа \d~^n\yГруппа\d: \rvk.com/warglory^n^n") len += formatex(menu[len], charsmax(menu) - len, "\r1. \wВзять \r1 \wключ^n") len += formatex(menu[len], charsmax(menu) - len, "\r2. \wВзять \r5 \wключей^n") len += formatex(menu[len], charsmax(menu) - len, "\r3. \wВзять \r10 \wключей^n") len += formatex(menu[len], charsmax(menu) - len, "\r4. \wВзять \r20 \wключей^n^n") formatex(menu[len], charsmax(menu) - len, "\r0. \wЗакрыть") return show_menu(id, iKeys, menu, -1, "PL_BiletMenu") }
public Handle_BiletMenu(id, iKey) { switch(iKey) { case 0: { Bilet[id] = Bilet[id] + 1 ChatColor(id, "!y[!gАльфа!y] !tВы успешно взяли !g1 !tключ") } case 1: { Bilet[id] = Bilet[id] + 5 ChatColor(id, "!y[!gАльфа!y] !!tВы успешно взяли !g5 !tключей") } case 2: { Bilet[id] = Bilet[id] + 10 ChatColor(id, "!y[!gАльфа!y] !tВы успешно взяли !g10 !tключей") } case 3: { Bilet[id] = Bilet[id] + 20 ChatColor(id, "!y[!gАльфа!y] !tВы успешно взяли !g20 !tключей") } case 8: return PL_HackedMenu(id) case 9: return PLUGIN_HANDLED } return PL_BiletMenu(id) }
stock ChatColor(const id, const input[], any:...) { new count = 1, players[32] static msg[191] 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) players[0] = id; else get_players(players, count, "ch") { for (new i = 0; i < count; i++) { if (is_user_connected(players[i])) { message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("SayText"), _, players[i]) write_byte(players[i]); write_string(msg); message_end(); } } } }
|