Guest User

Untitled

a guest
Apr 3rd, 2012
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 22.44 KB | None | 0 0
  1. // =============================================================================
  2. // =============================================================================
  3. // ------------------------- Scripter : Pawno ----------------------------------
  4. // =============================================================================
  5. // =============================================================================
  6.  
  7. // ------------------------------- Biblioteci ----------------------------------
  8.  
  9. #include <a_samp>
  10. #include <dutils>
  11. #include <dini>
  12.  
  13. // =============================================================================
  14.  
  15. // ------------------------------- Definitii -----------------------------------
  16.  
  17. #define dcmd(%1,%2,%3) if ((strcmp((%3)[1], #%1, true, (%2)) == 0) && ((((%3)[(%2) + 1] == 0) && (dcmd_%1(playerid, "")))||(((%3)[(%2) + 1] == 32) && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1
  18. #define Fisier_Banca "Banca/%s.ini";
  19.  
  20. // =============================================================================
  21.  
  22. // -------------------------------- Creatii ------------------------------------
  23.  
  24. new Banca;
  25.  
  26. new Float:Spawn_Aleatoriu [][] =
  27. {
  28. {1742.5667, -1860.1587, 13.5791, 359.4921}, // Gara.
  29. {1642.2238, -2332.9924, 13.5469, 359.0938}, // Aeroport.
  30. {820.9525, -1341.7852, 13.5209, 91.0803} // Metro.
  31. };
  32.  
  33. new Float:Bancomat [][] =
  34. {
  35. {1553.2744, -1668.3151, 13.5569, 266.7286},
  36. {1929.2637, -1786.0145, 13.5469, 88.5060},
  37. {1750.7115, -1862.8801, 13.5758, 181.6880},
  38. {1172.0929, -1319.5659 ,15.3947, 358.0941}
  39. };
  40.  
  41. // =============================================================================
  42.  
  43. // -------------------------------- Pragma -------------------------------------
  44.  
  45. #pragma unused ret_memcpy
  46. #pragma unused strtok
  47. #pragma tabsize 0
  48.  
  49. // =============================================================================
  50.  
  51. // ------------------------------ Enumeratii -----------------------------------
  52.  
  53. enum pInfo
  54. {
  55. pAdmin,
  56. pLevel,
  57. pMoney,
  58. pPassword,
  59. pBalance,
  60. pBank,
  61. }
  62. new PlayerInfo[MAX_PLAYERS][pInfo];
  63. new BankInfo[MAX_PLAYERS][pInfo];
  64.  
  65. // =============================================================================
  66.  
  67. // ------------------------ Deschiderea Gamemode-ului --------------------------
  68.  
  69. public OnGameModeInit()
  70. {
  71. print("===============================");
  72. print("===============================");
  73. print("--- Gamemode-ul se incarca. ---");
  74. print("-- Gamemode-ul s-a incarcat. --");
  75. print("===============================");
  76. print("===============================");
  77. CreateObject(2942, 1553.8000488281, -1667.6999511719, 13.199999809265, 0, 0, 270); // Bancomat.
  78. CreateObject(2942, 1928.5999755859, -1785.8000488281, 13.199999809265, 0, 0, 92); // Bancomat.
  79. CreateObject(2942, 1750.6999511719, -1863.5999755859, 13.199999809265, 0, 0, 180); // Bancomat.
  80. CreateObject(2942, 1172.3000488281, -1318.9000244141, 15, 0, 0, 0); // Bancomat.
  81. return 1;
  82. }
  83.  
  84. // =============================================================================
  85.  
  86. // ------------------------ Conectarea jucatorului -----------------------------
  87.  
  88. public OnPlayerConnect(playerid)
  89. {
  90. new Nume[MAX_PLAYER_NAME];
  91. new Fisier[128];
  92. GetPlayerName(playerid, Nume, MAX_PLAYER_NAME);
  93. format(Fisier, sizeof(Fisier), ".../Conturi/%s.ini", Nume);
  94. if (!fexist(Fisier))
  95. {
  96. SendClientMessage(playerid, 0xFFFFFF, "{CC66CC}*** {3366CC}[Informatie] {FFCC99}Acest cont nu este inregistrat in baza noastra de date. {CC66CC}***");
  97. ShowPlayerDialog(playerid, 1, DIALOG_STYLE_INPUT, "Fereastra de inregistrare", "Bun venit pe serverul Define Roleplay. /nAcest cont nu este inregistrat in baza noastra de date. /nIntrodu parola dorita in casuta de mai jos pentru a inregistra contul in baza noastra de date.", "Ok", "Renunta");
  98. }
  99. else
  100. {
  101. new Mesaj[128];
  102. GetPlayerName(playerid, Nume, MAX_PLAYER_NAME);
  103. format(Mesaj, sizeof(Mesaj), "{CC66CC}*** {3366CC}[Informatie] {FFCC99}Bine ai revenit pe Define Roleplay, %s. {CC66CC}***", Nume);
  104. SendClientMessage(playerid, 0xFFFFFF, Mesaj);
  105. ShowPlayerDialog(playerid, 2, DIALOG_STYLE_INPUT, "Fereastra de logare", "Bine ai revenit pe serverul Define Roleplay. /nAcest cont este inregistrat in baza noastra de date. /nIntrodu parola contului in casuta de mai jos pentru a te conecta.", "Ok", "Renunta");
  106. }
  107. Banca = CreatePickup(1242, 2, 595.5361, -1250.6130, 18.2915, -1);
  108. new Nume2[24];
  109. new Fisier2[128];
  110. GetPlayerName(playerid, Nume2, 24);
  111. if(!fexist(Fisier2))
  112. {
  113. dini_Create(Fisier2);
  114. dini_IntSet(Fisier2, "pBalance", 0);
  115. dini_IntSet(Fisier2, "pBank", 0);
  116. }
  117. else
  118. {
  119. BankInfo[playerid][pBalance] = dini_IntSet(Fisier2, "pBalance");
  120. BankInfo[playerid][pBank] = dini_IntSet(Fisier2, "pBank");
  121. }
  122. return 1;
  123. }
  124.  
  125. // =============================================================================
  126.  
  127. // ----------------------- Spawn-ul jucatorilor --------------------------------
  128.  
  129. public OnPlayerSpawn(playerid)
  130. {
  131. new Aleatoriu = random(sizeof(Spawn_Aleatoriu));
  132. SetPlayerPos(playerid, Spawn_Aleatoriu [Aleatoriu][0], Spawn_Aleatoriu [Aleatoriu][1], Spawn_Aleatoriu [Aleatoriu][2]);
  133. SetPlayerFacingAngle(playerid, Spawn_Aleatoriu [Aleatoriu][3]);
  134. return 1;
  135. }
  136.  
  137. // =============================================================================
  138.  
  139. // -------------------- Deconectarea jucatorului -------------------------------
  140.  
  141. public OnPlayerDisconnect(playerid, reason)
  142. {
  143. new Fisier[128];
  144. new Nume[MAX_PLAYER_NAME];
  145. GetPlayerName(playerid, Nume, MAX_PLAYER_NAME);
  146. format(Fisier, sizeof(Fisier), ".../Conturi/%s.ini", Nume);
  147. if (dini_Exists(Fisier))
  148. {
  149. dini_IntSet(Fisier, "pAdmin", PlayerInfo[playerid][pAdmin]);
  150. dini_IntSet(Fisier, "pLevel", PlayerInfo[playerid][pLevel]);
  151. dini_IntSet(Fisier, "pMoney", PlayerInfo[playerid][pMoney]);
  152. dini_IntSet(Fisier, "pPassword", PlayerInfo[playerid][pPassword]);
  153. }
  154. BankInfo[playerid][pBank] = 0;
  155. new Nume2[24];
  156. new Fisier2[128];
  157. GetPlayerName(playerid, Nume2, 24);
  158. dini_IntSet(Fisier2, "pBalance", BankInfo[playerid][pBalance]);
  159. dini_IntSet(Fisier2, "pBank", BankInfo[playerid][pBank]);
  160. return 1;
  161. }
  162.  
  163. // =============================================================================
  164.  
  165. // ----------------------- Comanda jucatorului ---------------------------------
  166.  
  167. public OnPlayerCommandText(playerid, cmdtext[])
  168. {
  169. dcmd(bankhelp, 8, cmdtext);
  170. dcmd(withdraw, 8, cmdtext);
  171. dcmd(deposit, 7, cmdtext);
  172. dmcd(transfer, 5, cmdtext);
  173. dcmd(balance, 7, cmdtext);
  174. return 1;
  175. }
  176.  
  177. // =============================================================================
  178.  
  179. // ---------------------------- Comenzile --------------------------------------
  180.  
  181. dcmd_bankhelp (playerid, params[])
  182. {
  183. #pragma unused params
  184. SendClientMessage(playerid, 0xFFFFFF, "{CC66CC}*** {3366CC}[Informatie] {FFCC99}Comenzile disponibile sunt : /withdraw, /deposit, /transfer, /balance. {CC66CC}***");
  185. return 1;
  186. }
  187.  
  188. dcmd_withdraw (playerid, params[])
  189. {
  190. new Suma;
  191. if (sscanf(params, "d", Suma)
  192. {
  193. return SendClientMessage(playerid, 0xFFFFFF, "{CC66CC}*** {3366CC}[Informatie] {FFCC99}Forma corecta este '/withdraw [Suma]'. {CC66CC}***");
  194. }
  195. else if (Suma > BankInfo[playerid][pBalance])
  196. {
  197. return SendClientMessage(playerid, 0xFFFFFF, "{CC66CC}*** {CC0000}[Eroare] {FFCC99}Nu ai asa de multi bani in cont. {CC66CC}***");
  198. }
  199. else if (BankInfo[playerid][pBank] == 0)
  200. {
  201. if (IsPlayerInRangeOfPoint(playerid, 5.0, Bancomat [0][0], Bancomat [0][1], Bancomat [0][2])
  202. {
  203. BankInfo[playerid][pBalance] -= Suma;
  204. GivePlayerMoney(playerid, Suma);
  205. new Mesaj[256];
  206. format(Mesaj, sizeof(Mesaj), "{CC66CC}*** {3366CC}[Informatie] {FFCC99}Ai extras din cont %d $. Mai ai in cont %d $. {CC66CC}***", Suma, BankInfo[playerid][pBalance]);
  207. SendClientMessage(playerid, 0xFFFFFF, Mesaj);
  208. }
  209. if (IsPlayerInRangeOfPoint(playerid, 5.0, Bancomat [1][0], Bancomat [1][1], Bancomat [1][2])
  210. {
  211. BankInfo[playerid][pBalance] -= Suma;
  212. GivePlayerMoney(playerid, Suma);
  213. new Mesaj[256];
  214. format(Mesaj, sizeof(Mesaj), "{CC66CC}*** {3366CC}[Informatie] {FFCC99}Ai extras din cont %d $. Mai ai in cont %d $. {CC66CC}***", Suma, BankInfo[playerid][pBalance]);
  215. SendClientMessage(playerid, 0xFFFFFF, Mesaj);
  216. }
  217. if (IsPlayerInRangeOfPoint(playerid, 5.0, Bancomat [2][0], Bancomat [2][1], Bancomat [2][2])
  218. {
  219. BankInfo[playerid][pBalance] -= Suma;
  220. GivePlayerMoney(playerid, Suma);
  221. new Mesaj[256];
  222. format(Mesaj, sizeof(Mesaj), "{CC66CC}*** {3366CC}[Informatie] {FFCC99}Ai extras din cont %d $. Mai ai in cont %d $. {CC66CC}***", Suma, BankInfo[playerid][pBalance]);
  223. SendClientMessage(playerid, 0xFFFFFF, Mesaj);
  224. }
  225. if (IsPlayerInRangeOfPoint(playerid, 5.0, Bancomat [3][0], Bancomat [3][1], Bancomat [3][2])
  226. {
  227. BankInfo[playerid][pBalance] -= Suma;
  228. GivePlayerMoney(playerid, Suma);
  229. new Mesaj[256];
  230. format(Mesaj, sizeof(Mesaj), "{CC66CC}*** {3366CC}[Informatie] {FFCC99}Ai extras din cont %d $. Mai ai in cont %d $. {CC66CC}***", Suma, BankInfo[playerid][pBalance]);
  231. SendClientMessage(playerid, 0xFFFFFF, Mesaj);
  232. }
  233. else
  234. {
  235. SendClientMessage(playerid, 0xFFFFFF, "{CC66CC}*** {3366CC}[Informatie] {FFCC99}Trebuie sa fii la banca sau la unul dintre bancomate sa poti folosi aceasta comanda. {CC66CC}***");
  236. }
  237. }
  238. else if (BankInfo[playerid][pBalance] < 0)
  239. {
  240. BankInfo[playerid][pBalance] -= Suma;
  241. GivePlayerMoney(playerid, Suma);
  242. new Mesaj[256];
  243. format(Mesaj, sizeof(Mesaj), "{CC66CC]*** {3366CC}[Informatie] {FFCC99}Ai extras din cont %d $. Mai ai in cont %d $. {CC66CC}***", Suma, BankInfo[playerid][pBalance]);
  244. SendClientMessage(playerid, 0xFFFFFF, Mesaj);
  245. }
  246. return 1;
  247. }
  248.  
  249. dcmd_deposit (playerid, params[])
  250. {
  251. new Suma;
  252. new Bani;
  253. Bani = GetPlayerMoney(playerid);
  254. if (sscanf(params, "d", Suma)
  255. {
  256. return SendClientMessage(playerid, 0xFFFFFF, "{CC66CC}*** {3366CC}[Informatie] {FFCC99}Forma corecta este '/deposit [Suma]'. {CC66CC]***");
  257. }
  258. else if (GetPlayerMoney(playerid) < Suma)
  259. {
  260. SendClientMessage(playerid, 0xFFFFFF, "{CC66CC}*** {3366CC}[Informatie] {FFCC99}Nu ai suficienti bani in cont. {CC66CC}***");
  261. }
  262. else if (BankInfo[playerid][pBank] == 0)
  263. {
  264. IsPlayerInRangeOfPoint(playerid, 5.0, Bancomat [0][0], Bancomat [0][1], Bancomat [0][2])
  265. {
  266. BankInfo[playerid][pBalance] += Suma;
  267. GivePlayerMoney(playerid, -Suma);
  268. new Mesaj[256];
  269. format(Mesaj, sizeof(Mesaj), "{CC66CC}*** {3366CC}[Informatie] {FFCC99}Ai extras din cont %d $. Mai ai in cont %d $. {CC66CC}***", Suma, BankInfo[playerid][pBalance]);
  270. SendClientMessage(playerid, 0xFFFFFF, Mesaj);
  271. }
  272. IsPlayerInRangeOfPoint(playerid, 5.0, Bancomat [1][0], Bancomat [1][1], Bancomat [1][2])
  273. {
  274. BankInfo[playerid][pBalance] += Suma;
  275. GivePlayerMoney(playerid, -Suma);
  276. new Mesaj[256];
  277. format(Mesaj, sizeof(Mesaj), "{CC66CC}*** {3366CC}[Informatie] {FFCC99}Ai extras din cont %d $. Mai ai in cont %d $. {CC66CC}***", Suma, BankInfo[playerid][pBalance]);
  278. SendClientMessage(playerid, 0xFFFFFF, Mesaj);
  279. }
  280. IsPlayerInRangeOfPoint(playerid, 5.0, Bancomat [2][0], Bancomat [2][1], Bancomat [2][2])
  281. {
  282. BankInfo[playerid][pBalance] += Suma;
  283. GivePlayerMoney(playerid, -Suma);
  284. new Mesaj[256];
  285. format(Mesaj, sizeof(Mesaj), "{CC66CC}*** {3366CC}[Informatie] {FFCC99}Ai extras din cont %d $. Mai ai in cont %d $. {CC66CC}***", Suma, BankInfo[playerid][pBalance]);
  286. SendClientMessage(playerid, 0xFFFFFF, Mesaj);
  287. }
  288. IsPlayerInRangeOfPoint(playerid, 5.0, Bancomat [3][0], Bancomat [3][1], Bancomat [3][2])
  289. {
  290. BankInfo[playerid][pBalance] += Suma;
  291. GivePlayerMoney(playerid, -Suma);
  292. new Mesaj[256];
  293. format(Mesaj, sizeof(Mesaj), "{CC66CC}*** {3366CC}[Informatie] {FFCC99}Ai extras din cont %d $. Mai ai in cont %d $. {CC66CC}***", Suma, BankInfo[playerid][pBalance]);
  294. SendClientMessage(playerid, 0xFFFFFF, Mesaj);
  295. }
  296. else
  297. {
  298. SendClientMessage(playerid, 0xFFFFFF, "{CC66CC}*** {3366CC}[Informatie] {FFCC99}Trebuie sa fii la banca sau la unul dintre bancomate sa poti folosi aceasta comanda. {CC66CC}***");
  299. }
  300. }
  301. else
  302. {
  303. BankInfo[playerid][pBalance] += Suma;
  304. GivePlayerMoney(playerid, -Suma);
  305. new Mesaj[256];
  306. format(Mesaj, sizeof(Mesaj), "{CC66CC}*** {3366CC}[Informatie] {FFCC99}Ai extras din cont %d $. Mai ai in cont %d $. {CC66CC}***", Suma, BankInfo[playerid][pBalance]);
  307. SendClientMessage(playerid, 0xFFFFFF, Mesaj);
  308. }
  309. return 1;
  310. }
  311.  
  312. dcmd_transfer (playerid, params[])
  313. {
  314. new id;
  315. new Suma;
  316. if (sscanf(params, "dd", id, Suma)
  317. {
  318. return SendClientMessage(playerid, 0xFFFFFF, "{CC66CC}*** {3366CC}[Informatie] {FFCC99}Forma corecta este '/transfer [ID jucator]'. {CC66CC}***");
  319. }
  320. else if (!IsPlayerConnected(id))
  321. {
  322. return SendClientMessage(playerid, 0xFFFFFF, "{CC66CC}*** {3366CC}[Informatie] [FFCC99}Acest jucator nu este conectat. {CC66CC}***");
  323. }
  324. else if (Suma > BankInfo[playerid][pBalance])
  325. {
  326. return SendClientMessage(playerid, 0xFFFFFF, "{CC66CC}*** {3366CC}[Informatie] {FFCC99}Nu ai suficienti bani in cont. {CC66CC}***");
  327. }
  328. else if (BankInfo[playerid][pBank] == 0)
  329. {
  330. IsPlayerInRangeOfPoint(playerid, 5.0, Bancomat [0][0], Bancomat [0][1], Bancomat [0][2])
  331. {
  332. BankInfo[playerid][pBalance] -= Suma;
  333. BankInfo[id][pBalance] += Suma;
  334. new Mesaj[256];
  335. format(Mesaj, sizeof(Mesaj), "{CC66CC}*** {3366CC}[Informatie] {FFCC99}I-ai transferat %i $ jucatorului cu ID-ul %i. Mai ai in cont %i $. {CC66CC}***", Suma, id, BankInfo[playerid][pBalance]);
  336. SendClientMessage(playerid, 0xFFFFFF, Mesaj);
  337. }
  338. IsPlayerInRangeOfPoint(playerid, 5.0, Bancomat [1][0], Bancomat [1][1], Bancomat [1][2])
  339. {
  340. BankInfo[playerid][pBalance] -= Suma;
  341. BankInfo[id][pBalance] += Suma;
  342. new Mesaj[256];
  343. format(Mesaj, sizeof(Mesaj), "{CC66CC}*** {3366CC}[Informatie] {FFCC99}I-ai transferat %i $ jucatorului cu ID-ul %i. Mai ai in cont %i $. {CC66CC}***", Suma, id, BankInfo[playerid][pBalance]);
  344. SendClientMessage(playerid, 0xFFFFFF, Mesaj);
  345. }
  346. IsPlayerInRangeOfPoint(playerid, 5.0, Bancomat [2][0], Bancomat [2][1], Bancomat [2][2])
  347. {
  348. BankInfo[playerid][pBalance] -= Suma;
  349. BankInfo[id][pBalance] += Suma;
  350. new Mesaj[256];
  351. format(Mesaj, sizeof{Mesaj), "{CC66CC}*** {3366CC}[Informatie] {FFCC99}I-ai transferat %i $ jucatorului cu ID-ul %i. Mai ai in cont %i $. {CC66CC}***", Suma, id, BankInfo[playerid][pBalance]);
  352. SendClientMessage(playerid, 0xFFFFFF, Mesaj);
  353. }
  354. IsPlayerInRangeOfPoint(playerid, 5.0, Bancomat [3][0], Bancomat [3][1], Bancomat [3][2])
  355. {
  356. BankInfo[playerid][pBalance] -= Suma;
  357. BankInfo[id][pBalance] += Suma;
  358. new Mesaj[256];
  359. format(Mesaj, sizeof(Mesaj), "{CC66CC}*** {3366CC}[Informatie] {FFCC99}I-ai transferat %i $ jucatorului cu ID-ul %i. Mai ai in cont %i $. {CC66CC}***", Suma, id, BankInfo[playerod][pBalance]);
  360. SendClientMessage(playerid, 0xFFFFFF, Mesaj);
  361. }
  362. }
  363. else
  364. {
  365. SendClientMessage(playerid, 0xFFFFFF, "{CC66CC}*** {3366CC}[Informatie] {FFCC99}Trebuie sa fii la banca sau la unul dintre bancomate sa poti folosi aceasta comanda. {CC66CC}***");
  366. }
  367. return 1;
  368. }
  369.  
  370. dcmd_balance (playerid, params[])
  371. {
  372. #pragma unused params
  373. new Nume[256];
  374. new Mesaj[256];
  375. new Balance;
  376. GetPlayerName(playerid, Nume, sizeof(Nume));
  377. Balance = BankInfo[playerid][pBalance];
  378. format(Mesaj, sizeof(Mesaj), "{CC66CC}*** {3366CC}[Informatie] {FFCC99}Bun venit %d. Ai %d $ in contul tau bancar. {CC66CC}***", Nume, Balance);
  379. SendClientMessage(playerid, 0xFFFFFF, Mesaj);
  380. return 1;
  381. }
  382.  
  383. dcmd_exit (playerid, params[])
  384. {
  385. #pragma unused params
  386. if (BankInfo[playerid][pBank] == 1)
  387. {
  388. SetPlayerInterior(playerid, 0);
  389. SetPlayerPosiiton(palyerid, );
  390. BankInfo[playerid][pBank] = 0;
  391. }
  392. return 1;
  393. }
  394.  
  395. // =============================================================================
  396.  
  397. // ----------------------- Pick-up jucatorului ---------------------------------
  398.  
  399. public OnPlayerPickup(playerid, pickupid)
  400. {
  401. if (pickupid == Banca)
  402. {
  403. SetPlayerInterior(playerid, 10);
  404. SetPlayerPosition(playerid, 6.091180, -29.271898, 1003.549988);
  405. GameTextForPlayer(playerid, "Foloseste comanda /exit pentru a parasi banca.", 5000, 3);
  406. BankInfo[playerid][pBank] = 1;
  407. }
  408. return 1;
  409. }
  410.  
  411. // =============================================================================
  412.  
  413. // ----------------------- Dialogul jucatorului --------------------------------
  414.  
  415. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  416. {
  417. if (dialogid == 1)
  418. {
  419. new Fisier[128];
  420. new Mesaj[128];
  421. new Nume[MAX_PLAYER_NAME];
  422. GetPlayerName(playerid, Nume, MAX_PLAYER_NAME);
  423. format(Fisier, sizeof(Fisier), ".../Conturi/%s.ini", Nume);
  424. if (response)
  425. {
  426. if (strlen(inputtext))
  427. {
  428. dini_Create(Fisier);
  429. dini_IntSet(Fisier, "pAdmin", PlayerInfo[playerid][pAdmin]);
  430. dini_IntSet(Fisier, "pLevel", PlayerInfo[playerid][pLevel]);
  431. dini_IntSet(Fisier, "pMoney", PlayerInfo[playerid][pMoney]);
  432. dini_IntSet(Fisier, "pPassword", num_hash(inputtext));
  433. format(Mesaj, sizeof(Mesaj), "{CC66CC}*** {3366CC}[Informatie] {FFCC99}Bine ai revenit. Esti conectat pe server cu contul %s. Parola contului este %s. {CC66CC}***", Nume, inputtext);
  434. SendClientMessage(playerid, 0xFFFFFF, Mesaj);
  435. PlayerInfo[playerid][pAdmin] = dini_Int(Fisier, "pAdmin");
  436. PlayerInfo[playerid][pLevel] = dini_Int(Fisier, "pLevel");
  437. PlayerInfo[playerid][pMoney] = dini_Int(Fisier, "pMoney");
  438. }
  439. }
  440. else
  441. {
  442. Kick(playerid);
  443. }
  444. }
  445. if (dialogid == 2)
  446. {
  447. new Fisier[128];
  448. new Nume[MAX_PLAYER_NAME];
  449. GetPlayerName(playerid, Nume, MAX_PLAYER_NAME);
  450. format(Fisier, sizeof(Fisier), ".../Conturi/%s.ini", Nume);
  451. if (response)
  452. {
  453. if (strlen(inputtext))
  454. {
  455. if (num_hash(inputtext) != dini_Int(Fisier, "pPassword"))
  456. {
  457. SendClientMessage(playerid, 0xFFFFFF, "{CC66CC}*** {3366CC}[Informatie] {FFCC99}Parola introdusa este incorecta. Pentru a te conecta pe server, trebuie sa introduci parola corecta in casuta de mai jos. {CC66CC}***");
  458. ShowPlayerDialog(playerid, 2, DIALOG_STYLE_INPUT, "Fereastra de logare", "Bine ai venit pe serverul Define Roleplay. /nAcest cont este inregistrat in baza noastra de date. /nIntrodu parola corecta in casuta de mai jos pentru a te conecta pe server.", "Ok", "Renunta");
  459. }
  460. else
  461. {
  462. SendClientMessage(playerid, 0xFFFFFF, "{CC66CC}*** {3366CC][Informatie] {FFCC99}Te-ai conectat cu succes pe server. Iti dorim o distractie placuta. {CC66CC}***");
  463. PlayerInfo[playerid][pAdmin] = dini_Int(Fisier, "pAdmin");
  464. PlayerInfo[playerid][pLevel] = dini_Int(Fisier, "pLevel");
  465. PlayerInfo[playerid][pMoney] = dini_Int(Fisier, "pMoney");
  466. GivePlayerMoney(playerid, dini_Int(Fisier, "pMoney"));
  467. }
  468. }
  469. }
  470. else
  471. {
  472. Kick(playerid);
  473. }
  474. }
  475. return 1;
  476. }
  477.  
  478. // =============================================================================
  479.  
  480. // ---------------------------- Stockuri ---------------------------------------
  481.  
  482. stock sscanf(string[], format[], {Float,_}:...)
  483. {
  484. new formatPos = 0;
  485. new stringPos = 0;
  486. new paramPos = 2;
  487. new paramCount = numargs();
  488. while (paramPos < paramCount && string[stringPos])
  489. {
  490. switch (format[formatPos++])
  491. {
  492. case '\0':
  493. {
  494. return 0;
  495. }
  496. case 'i', 'd':
  497. {
  498. new neg = 1;
  499. new num = 0;
  500. new ch = string[stringPos];
  501. if (ch == '-')
  502. {
  503. neg = -1;
  504. ch = string[++stringPos];
  505. }
  506. do
  507. {
  508. stringPos++;
  509. if (ch >= '0' && ch <= '9')
  510. {
  511. num = (num * 10) + (ch - '0');
  512. }
  513. else
  514. {
  515. return 1;
  516. }
  517. }
  518. while ((ch = string[stringPos]) && ch != ' ');
  519. setarg(paramPos, 0, num * neg);
  520. }
  521. case 'h', 'x':
  522. {
  523. new ch;
  524. new num = 0;
  525. while ((ch = string[stringPos++]))
  526. {
  527. switch (ch)
  528. {
  529. case 'x', 'X':
  530. {
  531. num = 0;
  532. continue;
  533. }
  534. case '0' .. '9':
  535. {
  536. num = (num << 4) | (ch - '0');
  537. }
  538. case 'a' .. 'f':
  539. {
  540. num = (num << 4) | (ch - ('a' - 10));
  541. }
  542. case 'A' .. 'F':
  543. {
  544. num = (num << 4) | (ch - ('A' - 10));
  545. }
  546. case ' ':
  547. {
  548. break;
  549. }
  550. default:
  551. {
  552. return 1;
  553. }
  554. }
  555. }
  556. setarg(paramPos, 0, num);
  557. }
  558. case 'c':
  559. {
  560. setarg(paramPos, 0, string[stringPos++]);
  561. }
  562. case 'f':
  563. {
  564. new tmp[25];
  565. strmid(tmp, string, stringPos, stringPos+sizeof(tmp)-2);
  566. setarg(paramPos, 0, _:floatstr(tmp));
  567. }
  568. case 's', 'z':
  569. {
  570. new i = 0;
  571. new ch;
  572. if (format[formatPos])
  573. {
  574. while ((ch = string[stringPos++]) && ch != ' ')
  575. {
  576. setarg(paramPos, i++, ch);
  577. }
  578. if (!i)
  579. {
  580. return 1;
  581. }
  582. }
  583. else
  584. {
  585. while ((ch = string[stringPos++]))
  586. {
  587. setarg(paramPos, i++, ch);
  588. }
  589. }
  590. stringPos--;
  591. setarg(paramPos, i, '\0');
  592. }
  593. default:
  594. {
  595. continue;
  596. }
  597. }
  598. while (string[stringPos] && string[stringPos] != ' ')
  599. {
  600. stringPos++;
  601. }
  602. while (string[stringPos] == ' ')
  603. {
  604. stringPos++;
  605. }
  606. paramPos++;
  607. }
  608. while (format[formatPos] == 'z') formatPos++;
  609. return format[formatPos];
  610. }
  611.  
  612. // =============================================================================
Advertisement
Add Comment
Please, Sign In to add comment