hlmod.hu

Magyar Half-Life Mód közösség!
Pontos idő: 2025.06.16. 17:23



Jelenlévő felhasználók

Jelenleg 372 felhasználó van jelen :: 1 regisztrált, 0 rejtett és 371 vendég

A legtöbb felhasználó (2761 fő) 2025.01.09. 20:06-kor tartózkodott itt.

Regisztrált felhasználók: Bing [Bot]az elmúlt 5 percben aktív felhasználók alapján

Utoljára aktív
Ahhoz hogy lásd ki volt utoljára aktív, be kell jelentkezned.



Az oldal teljeskörű
használatához regisztrálj.

Regisztráció

Kereső


Új téma nyitása Hozzászólás a témához  [2 hozzászólás ] 
Szerző Üzenet
 Hozzászólás témája: Bank hiba
HozzászólásElküldve:2014.06.13. 12:24 
Offline
Senior Tag
Avatar

Csatlakozott:2013.11.20. 15:40
Hozzászólások:259
Megköszönt másnak: 7 alkalommal
Megköszönték neki: 25 alkalommal
Sziasztok ezt a plugint akkarom leforditani, de nem engedi

[ZP5.0] Lőszercsomag Bank [ AUTOMATIKUS ]

Hiba: Welcome to the AMX Mod X 1.76-300 Compiler.
Copyright (c) 1997-2006 ITB CompuPhase, AMX Mod X Team

Error: Undefined symbol "CHATCOLOR_GREY" on line 256
Warning: Expression has no effect on line 256
Warning: Expression has no effect on line 256
Warning: Expression has no effect on line 256
Error: Expected token: ";", but found ")" on line 256
Error: Invalid expression, assumed zero on line 256
Error: Too many error messages on one line on line 256

Compilation aborted.
4 Errors.
.

_________________
rwT* Szerverek!

Különleges játékélmény különleges szerverektől.
Bővebb információkért nézz az alábbi tartalmak után.

( FaceBook ) ( YouTube ) ( Web ) ( GameTracker )


Hozzászólás jelentése
Vissza a tetejére
   
 Hozzászólás témája: Re: Bank hiba
HozzászólásElküldve:2014.06.13. 12:43 
Offline
Félisten
Avatar

Csatlakozott:2013.12.30. 12:26
Hozzászólások:987
Megköszönt másnak: 34 alkalommal
Megköszönték neki: 133 alkalommal
SMA Forráskód: [ Mindet kijelol ]
  1. #include <amxmodx>
  2. #include <amxmisc>
  3. #include <fakemeta>
  4. #include <sqlx>
  5. #if defined _zombieplague_included
  6. #endinput
  7. #endif
  8. #define _zombieplague_included
  9.  
  10. #define ZP_TEAM_ZOMBIE (1<<0)
  11. #define ZP_TEAM_HUMAN (1<<1)
  12. #define ZP_TEAM_NEMESIS (1<<2)
  13. #define ZP_TEAM_SURVIVOR (1<<3)
  14.  
  15. enum
  16. {
  17. MODE_INFECTION = 1,
  18. MODE_NEMESIS,
  19. MODE_SURVIVOR,
  20. MODE_SWARM,
  21. MODE_MULTI,
  22. MODE_PLAGUE
  23. }
  24.  
  25. enum
  26. {
  27. WIN_NO_ONE = 0,
  28. WIN_ZOMBIES,
  29. WIN_HUMANS
  30. }
  31.  
  32. #define ZP_PLUGIN_HANDLED 97
  33.  
  34. native zp_get_user_zombie(id)
  35. native zp_get_user_nemesis(id)
  36. native zp_get_user_survivor(id)
  37. native zp_get_user_first_zombie(id)
  38. native zp_get_user_last_zombie(id)
  39. native zp_get_user_last_human(id)
  40. native zp_get_user_zombie_class(id)
  41. native zp_get_user_next_class(id)
  42. native zp_set_user_zombie_class(id, classid)
  43. native zp_get_user_ammo_packs(id)
  44. native zp_set_user_ammo_packs(id, amount)
  45. native zp_get_zombie_maxhealth(id)
  46. native zp_get_user_batteries(id)
  47. native zp_set_user_batteries(id, charge)
  48. native zp_get_user_nightvision(id)
  49. native zp_set_user_nightvision(id, set)
  50. native zp_infect_user(id, infector = 0, silent = 0, rewards = 0)
  51. native zp_disinfect_user(id, silent = 0)
  52. native zp_make_user_nemesis(id)
  53. native zp_make_user_survivor(id)
  54. native zp_respawn_user(id, team)
  55. native zp_force_buy_extra_item(id, itemid, ignorecost = 0)
  56. native zp_override_user_model(id, const newmodel[], modelindex = 0)
  57. native zp_has_round_started()
  58. native zp_is_nemesis_round()
  59. native zp_is_survivor_round()
  60. native zp_is_swarm_round()
  61. native zp_is_plague_round()
  62. native zp_get_zombie_count()
  63. native zp_get_human_count()
  64. native zp_get_nemesis_count()
  65. native zp_get_survivor_count()
  66. native zp_register_extra_item(const name[], cost, teams)
  67. native zp_register_zombie_class(const name[], const info[], const model[], const clawmodel[], hp, speed, Float:gravity, Float:knockback)
  68. native zp_get_extra_item_id(const name[])
  69. native zp_get_zombie_class_id(const name[])
  70. native zp_get_zombie_class_info(classid, info[], len)
  71. forward zp_round_started(gamemode, id)
  72. forward zp_round_ended(winteam)
  73. forward zp_user_infected_pre(id, infector, nemesis)
  74. forward zp_user_infected_post(id, infector, nemesis)
  75. forward zp_user_humanized_pre(id, survivor)
  76. forward zp_user_humanized_post(id, survivor)
  77. forward zp_user_infect_attempt(id, infector, nemesis)
  78. forward zp_user_humanize_attempt(id, survivor)
  79. forward zp_extra_item_selected(id, itemid)
  80. forward zp_user_unfrozen(id)
  81. forward zp_user_last_zombie(id)
  82. forward zp_user_last_human(id)
  83.  
  84. #define ZP_TEAM_ANY 0
  85. #define ZP_TEAM_NO_ONE 0
  86.  
  87. enum Color
  88. {
  89. NORMAL = 1, // clients scr_concolor cvar color
  90. GREEN, // Green Color
  91. TEAM_COLOR, // Red, grey, blue
  92. GREY, // grey
  93. RED, // Red
  94. BLUE, // Blue
  95. }
  96.  
  97. new TeamName[][] =
  98. {
  99. "",
  100. "TERRORIST",
  101. "CT",
  102. "SPECTATOR"
  103. }
  104.  
  105. ColorChat(id, Color:type, const msg[], {Float,Sql,Result,_}:...)
  106. {
  107. static message[256];
  108.  
  109. switch(type)
  110. {
  111. case NORMAL: // clients scr_concolor cvar color
  112. {
  113. message[0] = 0x01;
  114. }
  115. case GREEN: // Green
  116. {
  117. message[0] = 0x04;
  118. }
  119. default: // White, Red, Blue
  120. {
  121. message[0] = 0x03;
  122. }
  123. }
  124.  
  125. vformat(message[1], 251, msg, 4);
  126. message[192] = '^0';
  127.  
  128. static team, ColorChange, index, MSG_Type;
  129.  
  130. if(id)
  131. {
  132. MSG_Type = MSG_ONE;
  133. index = id;
  134. } else {
  135. index = FindPlayer();
  136. MSG_Type = MSG_ALL;
  137. }
  138.  
  139. team = get_user_team(index);
  140. ColorChange = ColorSelection(index, MSG_Type, type);
  141.  
  142. ShowColorMessage(index, MSG_Type, message);
  143.  
  144. if(ColorChange)
  145. {
  146. Team_Info(index, MSG_Type, TeamName[team]);
  147. }
  148. }
  149.  
  150. ShowColorMessage(id, type, message[])
  151. {
  152. message_begin(type, get_user_msgid("SayText"), _, id);
  153. write_byte(id)
  154. write_string(message);
  155. message_end();
  156. }
  157.  
  158. Team_Info(id, type, team[])
  159. {
  160. message_begin(type, get_user_msgid("TeamInfo"), _, id);
  161. write_byte(id);
  162. write_string(team);
  163. message_end();
  164.  
  165. return 1;
  166. }
  167.  
  168. ColorSelection(index, type, Color:Type)
  169. {
  170. switch(Type)
  171. {
  172. case RED:
  173. {
  174. return Team_Info(index, type, TeamName[1]);
  175. }
  176. case BLUE:
  177. {
  178. return Team_Info(index, type, TeamName[2]);
  179. }
  180. case GREY:
  181. {
  182. return Team_Info(index, type, TeamName[0]);
  183. }
  184. }
  185.  
  186. return 0;
  187. }
  188.  
  189. FindPlayer()
  190. {
  191. static i;
  192. i = -1;
  193.  
  194. while(i <= get_maxplayers())
  195. {
  196. if(is_user_connected(++i))
  197. {
  198. return i;
  199. }
  200. }
  201.  
  202. return -1;
  203. }
  204.  
  205.  
  206. #pragma semicolon 1
  207.  
  208. #if !defined MAX_PLAYERS
  209. #define MAX_PLAYERS 32
  210. #endif
  211.  
  212. new PLUGIN_NAME[] = "[ZP]Addons: Bank SQL";
  213. new PLUGIN_VERSION[] = "0.9.2";
  214. new PLUGIN_AUTHOR[] = "Epmak";
  215. new PLUGIN_PREFIX[] = "[ZP][Bank]";
  216.  
  217. enum vars_struct {
  218. mode=0,
  219. annonce,
  220.  
  221. save_limit,
  222. save_days,
  223. save_type,
  224.  
  225. block_cname,
  226. startedammo,
  227. allow_passwd,
  228. allow_donate,
  229.  
  230. bool:round_end,
  231.  
  232. _pw_str[32],
  233. table[32],
  234. config_dir[128]
  235. };
  236.  
  237. enum bank_struct {
  238. bool:ingame,
  239. bool:async,
  240. bool:loggin,
  241. auth[36],
  242. passwd[32],
  243. amount
  244. }
  245.  
  246. new g_vars[vars_struct];
  247. new g_Bank[MAX_PLAYERS+1][bank_struct];
  248. new Handle:g_Sql = Empty_Handle,Handle:g_SqlTuple = Empty_Handle;
  249.  
  250. public plugin_init()
  251. {
  252. register_plugin(PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR);
  253. register_cvar("zp_bank_sql", PLUGIN_VERSION, FCVAR_SERVER);
  254.  
  255. register_dictionary("zp_bank.txt");
  256. register_dictionary("common.txt");
  257.  
  258. register_clcmd("say", "handle_say");
  259. register_clcmd("say_team", "handle_say");
  260.  
  261. register_concmd("zp_bank_show", "cmdBankShow", ADMIN_ADMIN);
  262. register_concmd("zp_bank_set", "cmdBankSet", ADMIN_RCON, "<name or #userid> <+ or ->amount");
  263.  
  264. g_vars[startedammo] = get_cvar_pointer("zp_starting_ammo_packs");
  265.  
  266. register_srvcmd("zp_bank_connect", "db_connect");
  267.  
  268. register_forward(FM_ClientUserInfoChanged, "fwClientUserInfoChanged");
  269.  
  270. server_cmd("zp_bank_connect");
  271. }
  272.  
  273. public plugin_precache()
  274. {
  275. get_configsdir(g_vars[config_dir], 127);
  276.  
  277. g_vars[mode] = register_cvar("zp_bank", "1");
  278. g_vars[annonce] = register_cvar("zp_bank_annonce", "360.0");
  279. g_vars[save_limit] = register_cvar("zp_bank_save_limit", "1000");
  280. g_vars[save_days] = register_cvar("zp_bank_save_days", "24");
  281. g_vars[save_type] = register_cvar("zp_bank_save_type", "2");
  282. g_vars[block_cname] = register_cvar("zp_bank_block_name_change", "1");
  283. g_vars[allow_passwd] = register_cvar("zp_bank_allow_passwd", "1");
  284. g_vars[allow_donate] = register_cvar("zp_bank_allow_donate", "1");
  285.  
  286. register_cvar("zp_bank_host", "127.0.0.1");
  287. register_cvar("zp_bank_user", "root");
  288. register_cvar("zp_bank_pass", "");
  289. register_cvar("zp_bank_db", "amxx");
  290. register_cvar("zp_bank_type", "mysql");
  291. register_cvar("zp_bank_table", "zp_bank");
  292. register_cvar("zp_bank_pw_str", "_bpw");
  293.  
  294. server_cmd("exec %s/zp_bank.cfg", g_vars[config_dir]);
  295. server_exec();
  296. }
  297.  
  298. public plugin_cfg()
  299. {
  300. g_vars[mode] = get_pcvar_num(g_vars[mode]);
  301. g_vars[save_limit] = get_pcvar_num(g_vars[save_limit]);
  302. g_vars[save_days] = get_pcvar_num(g_vars[save_days]);
  303. g_vars[save_type] = get_pcvar_num(g_vars[save_type]);
  304. g_vars[block_cname] = get_pcvar_num(g_vars[block_cname]);
  305. g_vars[allow_passwd] = get_pcvar_num(g_vars[allow_passwd]);
  306. g_vars[allow_donate] = get_pcvar_num(g_vars[allow_donate]);
  307.  
  308. if(g_vars[save_limit] < 0) g_vars[save_limit] = 0;
  309.  
  310. if(get_pcvar_num(g_vars[annonce]))
  311. set_task(get_pcvar_float(g_vars[annonce]), "print_annonce",_,_,_,"b");
  312.  
  313. get_cvar_string("zp_bank_pw_str", g_vars[_pw_str], 31);
  314. }
  315.  
  316. public plugin_end()
  317. {
  318. if(g_Sql != Empty_Handle) SQL_FreeHandle(g_Sql);
  319. if(g_SqlTuple != Empty_Handle) SQL_FreeHandle(g_SqlTuple);
  320. }
  321.  
  322. public zp_round_started(gamemode, id)
  323. {
  324. g_vars[round_end] = false;
  325. }
  326.  
  327. public zp_round_ended(winteam)
  328. {
  329. if (!g_vars[mode] || g_Sql == Empty_Handle)
  330. return ;
  331.  
  332. static i;
  333. for(i=1;i<=MAX_PLAYERS;i++)
  334. {
  335. if(!g_Bank[i][ingame] || !g_Bank[i][loggin] || !g_Bank[i][async])
  336. continue;
  337.  
  338. SaveClientBank(i);
  339. }
  340.  
  341. g_vars[round_end] = true;
  342. }
  343.  
  344. public client_connect(id)
  345. {
  346. if (!g_vars[mode])
  347. return ;
  348.  
  349. GetAuthId(id, g_Bank[id][auth],35);
  350.  
  351. g_Bank[id][amount] = 0;
  352. g_Bank[id][async] = false;
  353. g_Bank[id][loggin] = false;
  354.  
  355. if(g_vars[mode] == 2)
  356. zp_set_user_ammo_packs(id, get_pcvar_num(g_vars[startedammo]));
  357.  
  358. LoadClientBank(id);
  359. }
  360.  
  361. public client_putinserver(id)
  362. {
  363. g_Bank[id][ingame] = true;
  364.  
  365. if(g_Bank[id][async] == true && g_Bank[id][loggin] == true)
  366. SetAmmoBank(id, g_Bank[id][amount]);
  367. }
  368.  
  369. public client_disconnect(id)
  370. {
  371. if (!g_vars[mode] || g_Sql == Empty_Handle)
  372. return ;
  373.  
  374. if(g_vars[round_end] == false && g_Bank[id][async] == true && g_Bank[id][loggin] == true)
  375. SaveClientBank(id);
  376.  
  377. g_Bank[id][ingame] = false;
  378. g_Bank[id][auth][0] = '^0';
  379. g_Bank[id][passwd][0] = '^0';
  380. }
  381.  
  382. public cmdBankShow(id, level, cid)
  383. {
  384. if (!cmd_access(id, level, cid, 1))
  385. return PLUGIN_HANDLED;
  386.  
  387. static pl_name[32], pl_amount[11], i;
  388. console_print(id, "%33s amount","name");
  389. for(i=1;i<=MAX_PLAYERS;i++)
  390. {
  391. if(!g_Bank[i][ingame]) continue;
  392.  
  393. get_user_name(i,pl_name,31);
  394.  
  395. if(!g_Bank[i][async])
  396. pl_amount = "not loaded";
  397. else if(!g_Bank[i][loggin])
  398. pl_amount = "not loggin";
  399. else
  400. num_to_str(GetAmmoBank(i),pl_amount,10);
  401.  
  402. console_print(id, "%33s %s", pl_name, pl_amount);
  403. }
  404.  
  405. return PLUGIN_HANDLED;
  406. }
  407.  
  408. public cmdBankSet(id, level, cid)
  409. {
  410. if (!cmd_access(id, level, cid, 3))
  411. return PLUGIN_HANDLED;
  412.  
  413. static s_player[32], player, s_amount[12], i_amount;
  414. read_argv(1, s_player, 31);
  415. player = cmd_target(id, s_player, CMDTARGET_ALLOW_SELF);
  416.  
  417. if (!player)
  418. return PLUGIN_HANDLED;
  419.  
  420. get_user_name(player,s_player,31);
  421. if(!g_Bank[player][async])
  422. {
  423. console_print(id,"The player '%s' has not loaded bank", s_player);
  424. return PLUGIN_HANDLED;
  425. }
  426. else if(!g_Bank[player][loggin])
  427. {
  428. console_print(id,"The player '%s' has not loggin bank", s_player);
  429. return PLUGIN_HANDLED;
  430. }
  431.  
  432. read_argv(2, s_amount, 11);
  433. remove_quotes(s_amount);
  434. i_amount = str_to_num(s_amount);
  435.  
  436. switch(s_amount[0])
  437. {
  438. case '+':
  439. SetAmmoBank(player, GetAmmoBank(player)+i_amount);
  440. case '-':
  441. SetAmmoBank(player, GetAmmoBank(player)-(0-i_amount));
  442. default:
  443. SetAmmoBank(player,i_amount);
  444. }
  445.  
  446. return PLUGIN_HANDLED;
  447. }
  448.  
  449. public print_annonce()
  450. {
  451. if (!g_vars[mode] || g_Sql == Empty_Handle)
  452. return ;
  453.  
  454. ColorChat(0, GREY, "%L", LANG_PLAYER, "BANK_ANNOUNCE1");
  455. if(g_vars[mode] == 1)
  456. {
  457. ColorChat(0, GREY, "%L", LANG_PLAYER, "BANK_ANNOUNCE2");
  458. ColorChat(0, GREY, "%L", LANG_PLAYER, "BANK_ANNOUNCE3");
  459. }
  460. else
  461. {
  462. ColorChat(0, GREY, "%L", LANG_PLAYER, "BANK_ANNOUNCE4");
  463. }
  464. }
  465.  
  466. public db_loadcurrent()
  467. {
  468. for(new i=1;i<=MAX_PLAYERS;i++)
  469. {
  470. if(g_Bank[i][async] || !g_Bank[i][ingame]) continue;
  471.  
  472. LoadClientBank(i);
  473. }
  474. }
  475.  
  476. public db_connect(count)
  477. {
  478. if(!g_vars[mode])
  479. return ;
  480.  
  481. new host[64], user[32], pass[32], db[128];
  482. new get_type[13], set_type[12];
  483. new error[128], errno;
  484.  
  485. get_cvar_string("zp_bank_host", host, 63);
  486. get_cvar_string("zp_bank_user", user, 31);
  487. get_cvar_string("zp_bank_pass", pass, 31);
  488. get_cvar_string("zp_bank_type", set_type, 11);
  489. get_cvar_string("zp_bank_db", db, 127);
  490. get_cvar_string("zp_bank_table", g_vars[table], 31);
  491.  
  492. if(is_module_loaded(set_type) == -1)
  493. {
  494. server_print("^r^n%s error: module '%s' not loaded.^r^n%s Add line %s to %s/modules.ini and restart server^r^n", PLUGIN_PREFIX, set_type, PLUGIN_PREFIX, set_type, g_vars[config_dir]);
  495. return ;
  496. }
  497.  
  498. SQL_GetAffinity(get_type, 12);
  499.  
  500. if (!equali(get_type, set_type))
  501. if (!SQL_SetAffinity(set_type))
  502. log_amx("Failed to set affinity from %s to %s.", get_type, set_type);
  503.  
  504. g_SqlTuple = SQL_MakeDbTuple(host, user, pass, db);
  505.  
  506. g_Sql = SQL_Connect(g_SqlTuple, errno, error, 127);
  507.  
  508. if (g_Sql == Empty_Handle)
  509. {
  510. server_print("%s SQL Error #%d - %s", PLUGIN_PREFIX, errno, error);
  511.  
  512. count += 1;
  513. set_task(10.0, "db_connect", count);
  514.  
  515. return ;
  516. }
  517.  
  518. SQL_QueryAndIgnore(g_Sql, "SET NAMES utf8");
  519.  
  520. if (equali(set_type, "sqlite") && !sqlite_TableExists(g_Sql, g_vars[table])) SQL_QueryAndIgnore(g_Sql, "CREATE TABLE %s (auth VARCHAR(36) PRIMARY KEY, password VARCHAR(32) NOT NULL DEFAULT '', amount INTEGER DEFAULT 0, timestamp INTEGER NOT NULL DEFAULT 0)",g_vars[table]);
  521. else if (equali(set_type, "mysql")) SQL_QueryAndIgnore(g_Sql,"CREATE TABLE IF NOT EXISTS `%s` (`auth` VARCHAR(36) NOT NULL, `password` VARCHAR(32) NOT NULL DEFAULT '', `amount` INT(10) NOT NULL DEFAULT 0, `timestamp` INT(10) NOT NULL DEFAULT 0, PRIMARY KEY (`auth`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8;", g_vars[table]);
  522.  
  523. CleanDataBase();
  524. if(count > 1)
  525. db_loadcurrent();
  526.  
  527. server_print("%s connected to: '%s://%s:****@%s/%s/%s'",PLUGIN_PREFIX, set_type, user, host, db, g_vars[table]);
  528. }
  529.  
  530. public CleanDataBase()
  531. {
  532. SQL_QueryAndIgnore(g_Sql, "DELETE FROM %s WHERE amount='0' AND password = '';", g_vars[table]);
  533.  
  534. if (!g_vars[save_days]) return ;
  535.  
  536. new curTime = get_systime();
  537. curTime -= ((g_vars[save_days] * 24) * 3600);
  538.  
  539. SQL_QueryAndIgnore(g_Sql,"DELETE FROM %s WHERE timestamp < '%d';", g_vars[table], curTime);
  540. }
  541.  
  542. public fwClientUserInfoChanged(id, buffer)
  543. {
  544. if (!g_vars[mode] || !is_user_connected(id))
  545. return FMRES_IGNORED;
  546.  
  547. new name[32], val[32], name_1[] = "name";
  548. get_user_name(id, name, 31);
  549. engfunc(EngFunc_InfoKeyValue, buffer, name_1, val, 31);
  550. if (equal(val, name))
  551. return FMRES_IGNORED;
  552.  
  553. if(g_vars[block_cname])
  554. {
  555. engfunc(EngFunc_SetClientKeyValue, id, buffer, name_1, name);
  556. client_cmd(id, "name ^"%s^"; setinfo name ^"%s^"", name, name);
  557. console_print(id, "%L", id ,"NO_NAME_CHANGE");
  558. }
  559. else
  560. {
  561. GetAuthId(id,g_Bank[id][auth],35);
  562. return FMRES_IGNORED;
  563. }
  564.  
  565. return FMRES_SUPERCEDE;
  566. }
  567.  
  568. public handle_say(id)
  569. {
  570. if(!g_vars[mode])
  571. {
  572. ColorChat(id, GREY, "$g%s$t %L", PLUGIN_PREFIX, LANG_PLAYER, "BANK_DISABLED");
  573.  
  574. return PLUGIN_CONTINUE;
  575. }
  576. else if(g_Sql == Empty_Handle)
  577. {
  578. ColorChat(id, GREY, "$g%s$t %L", PLUGIN_PREFIX, LANG_PLAYER, "BANK_ERR");
  579.  
  580. return PLUGIN_CONTINUE;
  581. }
  582. else if (!g_Bank[id][async])
  583. return PLUGIN_CONTINUE;
  584.  
  585. new text[60], command[16], command2[32], password[32], set_packs;
  586. read_args(text, 59);
  587. remove_quotes(text);
  588.  
  589. command[0] = '^0';
  590. command2[0] = '^0';
  591. password[0] = '^0';
  592. parse(text, command, 15, command2, 31, password, 31);
  593.  
  594. if (equali(command, "/", 1))
  595. format(command, 15, command[1]);
  596.  
  597. if (g_vars[allow_donate] && equali(command, "kuldes", 6))
  598. {
  599. donate(id, command2, str_to_num(password));
  600. }
  601. else if (equali(command, "mybank", 6) || equali(command, "bank", 4))
  602. {
  603. if(g_vars[save_type] == 2 && g_vars[allow_passwd])
  604. {
  605. if(equali(command2, "login", 5))
  606. {
  607. if(g_Bank[id][loggin]) {
  608. ColorChat(id, GREY, "$g%s$t %L", PLUGIN_PREFIX, LANG_PLAYER, "BANK_LOGIN_ALREADY");
  609. return PLUGIN_HANDLED;
  610. }
  611.  
  612. if(g_Bank[id][passwd][0] && equal(password, g_Bank[id][passwd]))
  613. {
  614. g_Bank[id][loggin] = true;
  615. SetAmmoBank(id, g_Bank[id][amount]);
  616. client_cmd(id, "setinfo %s ^"%s^"", g_vars[_pw_str], password);
  617. ColorChat(id, GREY, "$g%s$t %L", PLUGIN_PREFIX, LANG_PLAYER, "BANK_LOGIN_SUCCESS");
  618. }
  619. else
  620. {
  621. ColorChat(id, GREY, "$g%s$t %L", PLUGIN_PREFIX, LANG_PLAYER, "BANK_LOGIN_BAD");
  622. }
  623.  
  624. return PLUGIN_HANDLED;
  625. }
  626. else if(!g_Bank[id][loggin])
  627. {
  628. ColorChat(id, GREY, "$g%s$t %L", PLUGIN_PREFIX, LANG_PLAYER, "BANK_LOGIN");
  629. return PLUGIN_HANDLED;
  630. }
  631. else if(equali(command2, "password", 8))
  632. {
  633. if(password[0])
  634. {
  635. g_Bank[id][passwd] = password;
  636. client_cmd(id, "setinfo %s ^"%s^"", g_vars[_pw_str], password);
  637. ColorChat(id, GREY, "$g%s$t %L", PLUGIN_PREFIX, LANG_PLAYER, "BANK_LOGIN_PASSWORD_SET", g_Bank[id][passwd]);
  638. }
  639. else
  640. {
  641. ColorChat(id, GREY, "$g%s$t %L", PLUGIN_PREFIX, LANG_PLAYER, "BANK_LOGIN_PASSWORD", g_Bank[id][passwd]);
  642. }
  643. return PLUGIN_HANDLED;
  644. }
  645. else if(!g_Bank[id][passwd][0])
  646. ColorChat(id, GREY, "$g%s$t %L", PLUGIN_PREFIX, LANG_PLAYER, "BANK_LOGIN_PASSWORD_SETHELP");
  647. }
  648.  
  649. if(g_vars[mode] == 2)
  650. {
  651. ColorChat(id, GREY, "%L", LANG_PLAYER, "BANK_ANNOUNCE4");
  652. return PLUGIN_CONTINUE;
  653. }
  654.  
  655. ColorChat(id, GREY, "$g%s$t %L", PLUGIN_PREFIX, LANG_PLAYER, "BANK", g_Bank[id][amount]);
  656. ColorChat(id, GREY, "$g%s$t %L", PLUGIN_PREFIX, LANG_PLAYER, "BANK_ANNOUNCE2");
  657. ColorChat(id, GREY, "$g%s$t %L", PLUGIN_PREFIX, LANG_PLAYER, "BANK_ANNOUNCE3");
  658. }
  659. else if (g_vars[mode] == 2)
  660. return PLUGIN_CONTINUE;
  661. else if (equali(command, "deposit", 7) || equali(command, "send", 4) || equali(command, "store", 5))
  662. {
  663. new user_ammo_packs = zp_get_user_ammo_packs(id);
  664.  
  665. if (equali(command2, "all")) set_packs = user_ammo_packs;
  666. else set_packs = str_to_num(command2);
  667.  
  668. new limit_exceeded=false;
  669.  
  670. if (g_vars[save_limit] && set_packs > 0 && g_Bank[id][amount] + set_packs > g_vars[save_limit])
  671. {
  672. new overflow = g_Bank[id][amount] + set_packs - g_vars[save_limit];
  673. set_packs -= overflow;
  674.  
  675. ColorChat(id, GREY, "$g%s$t %L", PLUGIN_PREFIX, LANG_PLAYER, "DEPOSIT_MAX", g_vars[save_limit]);
  676.  
  677. limit_exceeded = true;
  678. }
  679.  
  680. if (set_packs > 0)
  681. {
  682. if (user_ammo_packs >= set_packs)
  683. {
  684. g_Bank[id][amount] += set_packs;
  685. zp_set_user_ammo_packs(id, user_ammo_packs - set_packs);
  686. ColorChat(id, GREY, "$g%s$t %L", PLUGIN_PREFIX, LANG_PLAYER, "DEPOSIT", set_packs, g_Bank[id][amount]);
  687. }
  688. else
  689. ColorChat(id, GREY, "$g%s$t %L", PLUGIN_PREFIX, LANG_PLAYER, "DEPOSIT_ERR", set_packs, user_ammo_packs);
  690.  
  691. return PLUGIN_HANDLED;
  692. }
  693. else if(!limit_exceeded)
  694. ColorChat(id, GREY, "$g%s$t %L", PLUGIN_PREFIX, LANG_PLAYER, "BANK_ANNOUNCE2");
  695. }
  696. else if (equali(command, "withdraw", 8) || equali(command, "take", 4) || equali(command, "retrieve", 8) || equali(command, "wd", 2))
  697. {
  698. new user_ammo_packs = zp_get_user_ammo_packs(id);
  699.  
  700. if (equali(command2, "all")) set_packs = g_Bank[id][amount];
  701. else set_packs = str_to_num(command2);
  702.  
  703. if (set_packs > 0)
  704. {
  705. if (g_Bank[id][amount] >= set_packs)
  706. {
  707. zp_set_user_ammo_packs(id, user_ammo_packs + set_packs);
  708. g_Bank[id][amount] -= set_packs;
  709. ColorChat(id, GREY, "$g%s$t %L", PLUGIN_PREFIX, LANG_PLAYER, "WITHDRAW", set_packs, g_Bank[id][amount]);
  710. }
  711. else
  712. ColorChat(id, GREY, "$g%s$t %L", PLUGIN_PREFIX, LANG_PLAYER, "WITHDRAW_ERR", set_packs, g_Bank[id][amount]);
  713.  
  714. return PLUGIN_HANDLED;
  715. }
  716. else
  717. ColorChat(id, GREY, "$g%s$t %L", PLUGIN_PREFIX, LANG_PLAYER, "BANK_ANNOUNCE3");
  718. }
  719.  
  720. return PLUGIN_CONTINUE;
  721. }
  722.  
  723. public donate(donater, const reciever_name[], ammo)
  724. {
  725. if(!reciever_name[0] || ammo <= 0 || zp_get_user_ammo_packs(donater) < ammo)
  726. {
  727. ColorChat(donater, GREY, "$g%s$t %L", PLUGIN_PREFIX, LANG_PLAYER, "BANK_DONATE_USAGE");
  728. return ;
  729. }
  730.  
  731. new reciever = cmd_target(donater, reciever_name, CMDTARGET_ALLOW_SELF);
  732. if (!reciever || reciever == donater)
  733. {
  734. ColorChat(donater, GREY, "$g%s$t %L", PLUGIN_PREFIX, LANG_PLAYER, "CL_NOT_FOUND");
  735. return ;
  736. }
  737.  
  738. zp_set_user_ammo_packs(donater, zp_get_user_ammo_packs(donater)-ammo);
  739. zp_set_user_ammo_packs(reciever, zp_get_user_ammo_packs(reciever)+ammo);
  740. }
  741.  
  742. public LoadClientBank(id)
  743. {
  744. if (g_SqlTuple == Empty_Handle || g_Sql == Empty_Handle || g_Bank[id][async] == true)
  745. return ;
  746.  
  747. new szQuery[120];
  748. format(szQuery, 119,"SELECT amount,password FROM %s WHERE auth='%s';", g_vars[table], g_Bank[id][auth]);
  749.  
  750. new szData[2];
  751. szData[0] = id;
  752. szData[1] = get_user_userid(id);
  753.  
  754. SQL_ThreadQuery(g_SqlTuple, "LoadClient_QueryHandler", szQuery, szData, 2);
  755. }
  756.  
  757. public LoadClient_QueryHandler(iFailState, Handle:hQuery, szError[], iErrnum, szData[], iSize, Float:fQueueTime)
  758. {
  759. if(iFailState != TQUERY_SUCCESS)
  760. {
  761. log_amx("%s SQL Error #%d - %s", PLUGIN_PREFIX, iErrnum, szError);
  762. return ;
  763. }
  764.  
  765. new id = szData[0];
  766.  
  767. if (szData[1] != get_user_userid(id))
  768. return ;
  769.  
  770. new packs=0,info_pw[32];
  771.  
  772. if(g_vars[mode] == 2)
  773. packs = get_pcvar_num(g_vars[startedammo]);
  774.  
  775. if(SQL_NumResults(hQuery))
  776. {
  777. packs = SQL_ReadResult(hQuery, SQL_FieldNameToNum(hQuery, "amount"));
  778. SQL_ReadResult(hQuery, SQL_FieldNameToNum(hQuery, "password"), g_Bank[id][passwd], 31);
  779. }
  780.  
  781. g_Bank[id][amount] = CheckLimit(packs);
  782. if(g_vars[allow_passwd] && g_Bank[id][passwd][0])
  783. {
  784. get_user_info(id,g_vars[_pw_str],info_pw,31);
  785. if(equal(info_pw, g_Bank[id][passwd]))
  786. {
  787. g_Bank[id][loggin] = true;
  788. }
  789. }
  790. else
  791. g_Bank[id][loggin] = true;
  792.  
  793. if(g_Bank[id][ingame] == true && g_Bank[id][loggin] == true)
  794. {
  795. SetAmmoBank(id, g_Bank[id][amount]);
  796. }
  797. g_Bank[id][async] = true;
  798. }
  799.  
  800. public SaveClientBank(id)
  801. {
  802. if (g_Sql == Empty_Handle)
  803. return ;
  804.  
  805. new packs = GetAmmoBank(id);
  806. packs = CheckLimit(packs);
  807.  
  808. SQL_QuoteString(g_Sql, g_Bank[id][passwd], 31, g_Bank[id][passwd]);
  809. SQL_QueryAndIgnore(g_Sql, "REPLACE INTO %s (auth,password,amount,timestamp) VALUES('%s', '%s', %d, %d);", g_vars[table], g_Bank[id][auth], g_Bank[id][passwd], packs, get_systime());
  810. }
  811.  
  812. stock GetAuthId(id, Buffer[]="", BufferSize=0)
  813. {
  814. switch(g_vars[save_type])
  815. {
  816. case 1: get_user_authid(id,Buffer,BufferSize);
  817. case 2:
  818. {
  819. new name[32];
  820. get_user_name(id,name,31);
  821. SQL_QuoteString(g_Sql, Buffer, BufferSize, name);
  822. }
  823. case 3: get_user_ip(id,Buffer,BufferSize,true);
  824. }
  825. }
  826.  
  827. public CheckLimit(packs)
  828. {
  829. if(g_vars[save_limit] && packs > g_vars[save_limit])
  830. {
  831. packs = g_vars[save_limit];
  832. }
  833. return packs;
  834. }
  835.  
  836. public SetAmmoBank(id, packs)
  837. {
  838. if(g_vars[mode] == 2)
  839. zp_set_user_ammo_packs(id,packs);
  840. else
  841. g_Bank[id][amount] = packs;
  842. }
  843.  
  844. public GetAmmoBank(id)
  845. {
  846. if(g_vars[mode] == 2)
  847. return zp_get_user_ammo_packs(id);
  848.  
  849. return g_Bank[id][amount];
  850. }
  851.  

_________________
Kép
Pár pluginom:
LCAW Frag Bolt
S E C R E T (78%...)
KépKép


Hozzászólás jelentése
Vissza a tetejére
   
Hozzászólások megjelenítése: Rendezés 
Új téma nyitása Hozzászólás a témához  [2 hozzászólás ] 


Ki van itt

Jelenlévő fórumozók: nincs regisztrált felhasználó valamint 35 vendég


Nyithatsz új témákat ebben a fórumban.
Válaszolhatsz egy témára ebben a fórumban.
Nem szerkesztheted a hozzászólásaidat ebben a fórumban.
Nem törölheted a hozzászólásaidat ebben a fórumban.
Nem küldhetsz csatolmányokat ebben a fórumban.

Keresés:
Ugrás:  
Powered by phpBB® Forum Software © phpBB Limited
Magyar fordítás © Magyar phpBB Közösség
Portal: Kiss Portal Extension © Michael O'Toole