Guest User

By tito

a guest
Dec 29th, 2012
1,589
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 18.31 KB | None | 0 0
  1. /******************************************************************************
  2. *
  3. *
  4. * Sistema de registro com codigo de ativacao via email
  5. * Creditos a mau.tito
  6. *
  7. *
  8. *******************************************************************************/
  9. #include a_samp
  10. #include DOF2
  11. #include a_http
  12. #include zcmd
  13. #include sscanf2
  14.  
  15. #define USERS "Contas/%s.ini"
  16.  
  17. #define MAILER_URL \
  18. "geradoresjfs.site90.net/mailer.php"
  19. #define Destinatario \
  20.  
  21. #define DIALOG_MENU 10
  22. #define DIALOG_REGISTRO 1
  23. #define DIALOG_LOGIN 2
  24. #define DIALOG_EMAIL 3
  25. #define DIALOG_ATIVACAO 4
  26. #define DIALOG_RECUPERACAO 5
  27.  
  28. #define INICIOC 1
  29. #define INICIOM 10000
  30.  
  31. #define Random_Maiuscula() (random(25) + 65)
  32. #define Random_Minuscula() (random(25) + 97)
  33. #define Random_Numero() (random(9) + 48)
  34.  
  35. #define CallBack::%0(%1) forward %0(%1); \
  36. public %0(%1)
  37. new Nome[MAX_PLAYER_NAME],
  38. Mortes[MAX_PLAYERS],
  39. Matou[MAX_PLAYERS],
  40. Dia[MAX_PLAYERS],
  41. Mes[MAX_PLAYERS],
  42. Ano[MAX_PLAYERS],
  43. Horas[MAX_PLAYERS],
  44. Minutos[MAX_PLAYERS],
  45. TrocarN[MAX_PLAYERS];
  46.  
  47. enum pInfo
  48. {
  49. pLevel,
  50. pGrana,
  51. TotalVezesLogado,
  52. pAdmin,
  53. Float:X,
  54. Float:Y,
  55. Float:Z
  56. }
  57. new PlayerInfo[MAX_PLAYERS][pInfo];
  58.  
  59. public OnFilterScriptInit()
  60. {
  61. print("\n Sistema de registro by mau tito");
  62. return 1;
  63. }
  64. public OnFilterScriptExit()
  65. {
  66. DOF2::Exit();
  67. return 1;
  68. }
  69.  
  70. public OnPlayerConnect(playerid)
  71. {
  72. new str[30];
  73. GetPlayerName(playerid, Nome, sizeof(Nome));
  74. format(str, sizeof(str), "Contas/%s.ini", Nome);
  75. if(!DOF2_GetBool(str, "ContaAtivado"))
  76. {
  77. ShowPlayerDialog(playerid, DIALOG_ATIVACAO, DIALOG_STYLE_INPUT, "Email", "Bote o codigo de ativar da conta !", "Continuar", "");
  78. }
  79. ShowPlayerDialog(playerid, DIALOG_MENU, DIALOG_STYLE_LIST, "Menu-Iniciar", "Registrar\nLogar\nEsqueci a Senha", "Selecionar", "");
  80. return 1;
  81. }
  82. public OnPlayerDisconnect(playerid, reason)
  83. {
  84. new file[40];
  85. GetPlayerName(playerid, Nome, sizeof(Nome));
  86. GetPlayerPos(playerid, PlayerInfo[playerid][X], PlayerInfo[playerid][Y], PlayerInfo[playerid][Z]);
  87. format(file, sizeof(file), USERS, Nome);
  88. DOF2_SetFloat(file, "PosX", PlayerInfo[playerid][X]);
  89. DOF2_SetFloat(file, "PosY", PlayerInfo[playerid][Y]);
  90. DOF2_SetFloat(file, "PosZ", PlayerInfo[playerid][Z]);
  91. SalvarConta(playerid);
  92. return 1;
  93. }
  94.  
  95.  
  96. public OnPlayerSpawn(playerid)
  97. {
  98. new file[60];
  99. GetPlayerName(playerid, Nome,sizeof(Nome));
  100. format(file, sizeof(file), USERS, Nome);
  101. PlayerInfo[playerid][X] = DOF2_GetFloat(file, "PosX");
  102. PlayerInfo[playerid][Y] = DOF2_GetFloat(file, "PosY");
  103. PlayerInfo[playerid][Z] = DOF2_GetFloat(file, "PosZ");
  104. return 1;
  105. }
  106.  
  107. public OnPlayerDeath(playerid, killerid, reason)
  108. {
  109. Matou[killerid] ++;
  110. Mortes[playerid] ++;
  111. return 1;
  112. }
  113. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  114. {
  115. if(dialogid == DIALOG_REGISTRO)
  116. {
  117. if(response)
  118. {
  119. new str[100];
  120. GetPlayerName(playerid, Nome, sizeof(Nome));
  121. format(str, sizeof(str), USERS, Nome);
  122.  
  123. DOF2_CreateFile(str);
  124. DOF2_SetString(str, "Senha", inputtext);
  125.  
  126. SendClientMessage(playerid, -1, "Registrado corretamente preencha os dados pedidos adiante");
  127.  
  128. DOF2_SetString(str, "Email", "SemEmail");
  129. DOF2_SetBool(str, "ContaAtivado", false);
  130. DOF2_SetInt(str, "Skin", 21);
  131. DOF2_SetInt(str, "Mortes", 0);
  132. DOF2_SetInt(str, "Matou", 0);
  133. DOF2_SetInt(str, "pAdmin", 0);
  134. DOF2_SetInt(str, "Dia", 0);
  135. DOF2_SetInt(str, "Mes", 0);
  136. DOF2_SetInt(str, "Ano", 0);
  137. DOF2_SetInt(str, "Horas", 0);
  138. DOF2_SetInt(str, "Minutos", 0);
  139. GivePlayerMoney(playerid, INICIOM);
  140. SetPlayerScore(playerid, INICIOC);
  141.  
  142. new var[90];
  143. format(var, sizeof var, "%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c\
  144. ", Random_Maiuscula(), Random_Minuscula(), Random_Numero(), Random_Numero(),Random_Maiuscula(), Random_Minuscula(), Random_Numero(), Random_Numero(),Random_Maiuscula(), Random_Minuscula(), Random_Numero(), Random_Numero(),Random_Maiuscula(), Random_Minuscula(), Random_Numero(), Random_Numero());
  145. DOF2_SetString(str, "CodeAtivacao", var);
  146.  
  147. new tito[90];
  148. format(tito, sizeof tito, "%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c\
  149. ", Random_Maiuscula(), Random_Minuscula(), Random_Numero(), Random_Numero(),Random_Maiuscula(), Random_Minuscula(), Random_Numero(), Random_Numero(),Random_Maiuscula(), Random_Minuscula(), Random_Numero(), Random_Numero(),Random_Maiuscula(), Random_Minuscula(), Random_Numero(), Random_Numero());
  150. DOF2_SetString(str, "CodigoRecuperacao", tito);
  151.  
  152. ShowPlayerDialog(playerid, DIALOG_EMAIL, DIALOG_STYLE_INPUT, "Email", "Bote um email valido para ser mandado codigo de ativaçao da conta!", "Continuar", "");
  153. DOF2_SaveFile();
  154. }
  155. else
  156. {
  157. SendClientMessage(playerid, 0xFF0000AA, "Voce Foi Kickado pelo bot");
  158. Kick(playerid);
  159. }
  160. }
  161. if(dialogid == DIALOG_LOGIN)
  162. {
  163. if(response)
  164. {
  165. if(!strlen(inputtext))
  166. {
  167. GetPlayerName(playerid, Nome, sizeof(Nome));
  168. SendClientMessage(playerid,-1 ,"Senha Incorreta !");
  169. ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "login", "Voce ja possue um registro em nosso servidor \n bote sua senha para poder logar corretamente.", "Logar", "Cancelar");
  170. return 0;
  171. }
  172. new str[100];
  173. GetPlayerName(playerid, Nome, sizeof(Nome));
  174. format(str, sizeof(str), USERS, Nome);
  175. if(!strcmp(inputtext,DOF2_GetString(str,"Senha"),false))
  176. {
  177. PlayerInfo[playerid][TotalVezesLogado]++;
  178. CarregarConta(playerid);
  179. }
  180. else
  181. {
  182. SendClientMessage(playerid,0x00FF00AA,"Senha incorreta digite-a novamente");
  183. ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "login", "Voce ja possue um registro em nosso servidor \n bote sua senha para poder logar corretamente.", "Logar", "Cancelar");
  184. }
  185. }
  186. else
  187. {
  188. SendClientMessage(playerid, 0xFF0000AA, "Voce Foi Kickado .");
  189. Kick(playerid);
  190. }
  191. }
  192. if(dialogid == DIALOG_EMAIL)
  193. {
  194. if(response)
  195. {
  196. new str[60], tito[320];
  197. GetPlayerName( playerid , Nome, sizeof( Nome ) ) ;
  198. format(str, sizeof(str), USERS, Nome);
  199. DOF2_SetString(str,"Email", inputtext);
  200.  
  201. format(tito, sizeof(tito), "Bem vindo ao servidor \n\n Acabamos de detectar que voce acaba de registrar em nosso servido\
  202. \n Seja bem vindo !\n Para voce poder logar voce tem que ativar sua conta para poder jogar coretamente!\n\n\n\
  203. Codigo de ativaçao: %0.16s", DOF2_GetString(str, "CodeAtivacao"));
  204.  
  205. EnviarEmail(DOF2_GetString(str, "Email"),Destinatario, "Ativaçao da Conta Sa-mp", "TT Ativacao da conta", tito);
  206. ShowPlayerDialog(playerid, DIALOG_ATIVACAO, DIALOG_STYLE_INPUT, "Email", "Bote o codigo de ativar da conta !", "Continuar", "");
  207. DOF2_SaveFile();
  208. }
  209. }
  210. if(dialogid == DIALOG_ATIVACAO)
  211. {
  212. if(response)
  213. {
  214. if(!strlen(inputtext))
  215. {
  216. ShowPlayerDialog(playerid, DIALOG_ATIVACAO, DIALOG_STYLE_INPUT, "Email", "Este nao e seu codigo de ativar!\n Bote o codigo de ativacao correto .", "Continuar", "");
  217. return 0;
  218. }
  219. new str[60];
  220. GetPlayerName( playerid , Nome, sizeof( Nome ) ) ;
  221. format(str, sizeof(str), USERS, Nome ) ;
  222. if(!strcmp(inputtext, DOF2_GetString(str,"CodeAtivacao"),false))
  223. {
  224. SendClientMessage(playerid, -1, "Sua conta foi ativada(o) com o codigo de ativaçao mandado em seu e-mail .");
  225. DOF2_SetBool(str, "ContaAtivado", true);
  226. DOF2_SaveFile();
  227. }
  228. else
  229. {
  230. ShowPlayerDialog(playerid, DIALOG_ATIVACAO, DIALOG_STYLE_INPUT, "Email", "Este nao e seu codigo de ativar!\n Bote o codigo de ativacao correto .", "Continuar", "");
  231. }
  232. }
  233. }
  234. if(dialogid == DIALOG_MENU)
  235. {
  236. if(response)
  237. {
  238. if(listitem == 0)
  239. {
  240. new str[60];
  241. GetPlayerName( playerid , Nome, sizeof( Nome ) ) ;
  242. format(str, sizeof(str), USERS, Nome ) ;
  243. if(!DOF2_FileExists(str))
  244. {
  245. ShowPlayerDialog(playerid, DIALOG_REGISTRO, DIALOG_STYLE_PASSWORD, "Registro", "Bem vindo ao servidor voce nao possue registro \n bote uma senha para pode se registrar.", "Registrar", "Cancelar");
  246. }
  247. else { SendClientMessage(playerid, -1,"Voce, ja possue conta aqui !"); }
  248. }
  249. else if(listitem == 1)
  250. {
  251. new str[60];
  252. GetPlayerName( playerid , Nome, sizeof( Nome ) ) ;
  253. format(str, sizeof(str), USERS, Nome ) ;
  254. if(DOF2_FileExists(str))
  255. {
  256. ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "login", "Voce ja possue um registro em nosso servidor \n bote sua senha para poder logar corretamente.", "Logar", "Cancelar");
  257. }
  258. else ShowPlayerDialog(playerid, DIALOG_REGISTRO, DIALOG_STYLE_PASSWORD, "Registro", "Bem vindo ao servidor voce nao possue registro \n bote uma senha para pode se registrar.", "Registrar", "Cancelar");
  259. }
  260. else if(listitem == 2)
  261. {
  262. new str[170], file[50];
  263. GetPlayerName( playerid , Nome, sizeof( Nome ) ) ;
  264. format(file, sizeof(file), USERS, Nome ) ;
  265. format(str, sizeof(str), "Ola Voce clicou em recuperaçao de conta \n Automaticamente foi enviado um email com um codigo para recuperar sua conta.\n\
  266. Enviado para e-mail %s .", DOF2_GetString(file, "Email"));
  267. ShowPlayerDialog(playerid, DIALOG_RECUPERACAO, DIALOG_STYLE_INPUT, "Recuperacao da conta", str, "Codigo", "");
  268.  
  269. new tito[200];
  270. format(tito, sizeof(tito), " Bem Voce esqueceu sua senha e ativou o codigo auxiliar para recuperaçao da sua acc\n \
  271. Ficamos felizes que voce nao desistiu de nosso servido\n\n Codigo de recuperacao: %0.16s", DOF2_GetString(file, "CodigoRecuperacao"));
  272. EnviarEmail(DOF2_GetString(file, "Email"),Destinatario, "Recuperaçao da sua conta", "Recuperaçao da sua conta", tito);
  273. }
  274. }
  275. }
  276. if(dialogid == DIALOG_RECUPERACAO)
  277. {
  278. if(response)
  279. {
  280. if(!strlen(inputtext))
  281. {
  282. new str[170];
  283. format(str, sizeof(str), "Ola Voce clicou em recuperaçao de conta \n Automaticamente foi enviado um email com um codigo para recuperar sua conta.\n\
  284. Enviado para e-mail %s .", DOF2_GetString(str, "Email"));
  285. ShowPlayerDialog(playerid, DIALOG_RECUPERACAO, DIALOG_STYLE_INPUT, "Recuperacao da conta", str, "Codigo", "");
  286. return 0;
  287. }
  288. new str[170];
  289. GetPlayerName( playerid , Nome, sizeof( Nome ) ) ;
  290. format(str, sizeof(str), USERS, Nome ) ;
  291. if(!strcmp(inputtext, DOF2_GetString(str,"CodigoRecuperacao"),false))
  292. {
  293. SendClientMessage(playerid, -1, " Sua Conta foi recuperada com sucesso ! Use o cmd /trocarsenha");
  294. TrocarN[playerid] = 1;
  295. }
  296. else
  297. {
  298. format(str, sizeof(str), "Ola Voce clicou em recuperaçao de conta \n Automaticamente foi enviado um email com um codigo para recuperar sua conta.\n\
  299. Enviado para e-mail %s .", DOF2_GetString(str, "Email"));
  300. ShowPlayerDialog(playerid, DIALOG_RECUPERACAO, DIALOG_STYLE_INPUT, "Recuperacao da conta", str, "Codigo", "");
  301.  
  302. }
  303. }
  304. }
  305. return 1;
  306. }
  307. CMD:trocarsenha(playerid, params[])
  308. {
  309. new novasenha[60], str[60];
  310. GetPlayerName( playerid , Nome, sizeof( Nome ) ) ;
  311. format(str, sizeof(str), USERS, Nome ) ;
  312. if(TrocarN[playerid] == 0) return SendClientMessage(playerid, -1, "Voce nao pode trocar a senha sem autorizacao");
  313. if(sscanf(params,"d[60]", novasenha))return SendClientMessage(playerid, -1, "CMD: /trocarsenha -> Nova Senha <-");
  314. SendClientMessage(playerid, -1, "Senha alterado com sucesso !");
  315. DOF2_SetString(str, "Senha", novasenha);
  316. TrocarN[playerid] = 0;
  317. DOF2_SaveFile();
  318. return 1;
  319. }
  320. CMD:trocaremail(playerid, params[])
  321. {
  322. new email[30], str[60];
  323. if(sscanf(params, "d[30]", email)) return SendClientMessage(playerid, -1,"CMD / : trocaremail [Novo Email]");
  324.  
  325. GetPlayerName( playerid , Nome, sizeof( Nome ) ) ;
  326. format(str, sizeof(str), USERS, Nome ) ;
  327.  
  328. DOF2_SetString(str,"Email", email);
  329. SendClientMessage(playerid, -1," E-mail Alterado Com sucesso !");
  330. DOF2_SaveFile();
  331. return 1;
  332.  
  333. }
  334.  
  335. CMD:infocontaemail(playerid)
  336. {
  337. new tito[400], str[50];
  338. GetPlayerName( playerid , Nome, sizeof( Nome ) ) ;
  339. format(str, sizeof(str), USERS, Nome ) ;
  340.  
  341. format(tito, sizeof(tito), "Ola Senhor Voce pediu informaçoes do seu char \n\nInformaçoes:\n \
  342. Personagem : %s \n Senha: %d \nLevel: %i\n Grana: %i \nSkin: %i \nMatou: %i\nMorreu: %i\nUtimo Login: %i:%i:%i %i:%i\n\nA Administracao do servidor agradeçe sua preferencia e deseja boas festas para voce.\n\n \n \
  343. Att administraçao & mau.tito\\"
  344. ,Nome, DOF2_GetString(str, "Senha"), GetPlayerScore(playerid), GetPlayerMoney(playerid), GetPlayerSkin(playerid), Matou[playerid],Mortes[playerid],Dia[playerid],Mes[playerid],Ano[playerid],Horas[playerid],Minutos[playerid]);
  345.  
  346. EnviarEmail(DOF2_GetString(str, "Email"),Destinatario, "Informacoes da conta", "Informacao da Conta", tito);
  347. return 1;
  348. }
  349. CallBack::SalvarConta(playerid)
  350. {
  351. new file[40];
  352. gettime(Horas[playerid], Minutos[playerid]);
  353. getdate(Ano[playerid], Mes[playerid], Dia[playerid]);
  354. GetPlayerName(playerid, Nome, sizeof(Nome));
  355. format(file, sizeof(file), USERS, Nome);
  356. DOF2_SetInt(file, "Level", GetPlayerMoney(playerid));
  357. DOF2_SetInt(file, "Dinheiro", GetPlayerScore(playerid));
  358. DOF2_SetInt(file, "VezesLogou", PlayerInfo[playerid][TotalVezesLogado]);
  359. DOF2_SetInt(file, "Skin", GetPlayerSkin(playerid));
  360. DOF2_SetInt(file, "pAdmin", PlayerInfo[playerid][pAdmin]);
  361. DOF2_SetInt(file, "Matou", Matou[playerid]);
  362. DOF2_SetInt(file, "Mortes", Mortes[playerid]);
  363. DOF2_SetInt(file, "Dia", Dia[playerid]);
  364. DOF2_SetInt(file, "Mes", Mes[playerid]);
  365. DOF2_SetInt(file, "Ano", Ano[playerid]);
  366. DOF2_SetInt(file, "Horas", Horas[playerid]);
  367. DOF2_SetInt(file, "Minutos", Minutos[playerid]);
  368. DOF2_SetFloat(file, "PosX", PlayerInfo[playerid][X]);
  369. DOF2_SetFloat(file, "PosY", PlayerInfo[playerid][Y]);
  370. DOF2_SetFloat(file, "PosZ", PlayerInfo[playerid][Z]);
  371. DOF2_SaveFile();
  372. return 1;
  373. }
  374. CallBack::CarregarConta(playerid)
  375. {
  376. new file[40];
  377. GetPlayerName(playerid, Nome, sizeof(Nome));
  378. format(file, sizeof(file), USERS, Nome);
  379. GivePlayerMoney(playerid, DOF2_GetInt(file, "Level"));
  380. SetPlayerScore(playerid, DOF2_GetInt(file, "Dinheiro"));
  381. PlayerInfo[playerid][TotalVezesLogado] = DOF2_GetInt(file, "VezesLogou");
  382. SetPlayerSkin(playerid, DOF2_GetInt(file, "Skin"));
  383. PlayerInfo[playerid][pAdmin] = DOF2_GetInt(file, "pAdmin");
  384. Matou[playerid] = DOF2_GetInt(file, "Matou");
  385. Mortes[playerid] = DOF2_GetInt(file, "Mortes");
  386. Dia[playerid] = DOF2_GetInt(file, "Dia");
  387. Mes[playerid] = DOF2_GetInt(file, "Mes");
  388. Ano[playerid] = DOF2_GetInt(file, "Ano");
  389. Horas[playerid] = DOF2_GetInt(file, "Horas");
  390. Minutos[playerid] = DOF2_GetInt(file, "Minutos");
  391. DOF2_SaveFile();
  392. return 1;
  393. }
  394. /* Include mailer By Sliceo */
  395.  
  396. #if ( !defined MAILER_MAX_MAIL_SIZE )
  397. #define MAILER_MAX_MAIL_SIZE (1024)
  398. #endif
  399.  
  400. #if ( !defined MAILER_URL )
  401. #error Please define MAILER_URL before including the mailer include.
  402. #endif
  403.  
  404. stock EnviarEmail( const szReceiver[ ], const szSenderMail[ ], const szSenderName[ ], const szSubject[ ], const szMessage[ ] )
  405. {
  406. new
  407. szBuffer[ MAILER_MAX_MAIL_SIZE ] = "t=",
  408. iPos = strlen( szBuffer ),
  409. iLength = strlen( szReceiver )
  410. ;
  411.  
  412. memcpy( szBuffer, szReceiver, iPos * 4, ( iLength + 1 ) * 4 );
  413.  
  414. StringURLEncode( szBuffer[ iPos ], 1024 - iPos );
  415.  
  416. strcat( szBuffer, "&f=" );
  417.  
  418. iPos = strlen( szBuffer );
  419. iLength = strlen( szSenderName );
  420.  
  421. memcpy( szBuffer, szSenderName, iPos * 4, ( iLength + 1 ) * 4 );
  422.  
  423. StringURLEncode( szBuffer[ iPos ], 1024 - iPos );
  424.  
  425. strcat( szBuffer, "&n=" );
  426.  
  427. iPos = strlen( szBuffer );
  428. iLength = strlen( szSenderMail );
  429.  
  430. memcpy( szBuffer, szSenderMail, iPos * 4, ( iLength + 1 ) * 4 );
  431.  
  432. StringURLEncode( szBuffer[ iPos ], 1024 - iPos );
  433.  
  434. strcat( szBuffer, "&s=" );
  435.  
  436. iPos = strlen( szBuffer );
  437. iLength = strlen( szSubject );
  438.  
  439. memcpy( szBuffer, szSubject, iPos * 4, ( iLength + 1 ) * 4 );
  440.  
  441. StringURLEncode( szBuffer[ iPos ], 1024 - iPos );
  442.  
  443. strcat( szBuffer, "&m=" );
  444.  
  445. iPos = strlen( szBuffer );
  446. iLength = strlen( szMessage );
  447.  
  448. memcpy( szBuffer, szMessage, iPos * 4, ( iLength + 1 ) * 4 );
  449.  
  450. StringURLEncode( szBuffer[ iPos ], 1024 - iPos );
  451.  
  452. HTTP( 0xD00D, HTTP_POST, MAILER_URL, szBuffer, "OnMailScriptResponse" );
  453. }
  454.  
  455. forward OnMailScriptResponse( iIndex, iResponseCode, const szData[ ] );
  456. public OnMailScriptResponse( iIndex, iResponseCode, const szData[ ] )
  457. {
  458. if ( szData[ 0 ] )
  459. printf( "Mailer script says: %s", szData );
  460. }
  461.  
  462. stock StringURLEncode( szString[ ], iSize = sizeof( szString ) )
  463. {
  464. for ( new i = 0, l = strlen( szString ); i < l; i++ )
  465. {
  466. switch ( szString[ i ] )
  467. {
  468. case '!', '(', ')', '\'', '*',
  469. '0' .. '9',
  470. 'A' .. 'Z',
  471. 'a' .. 'z':
  472. {
  473. continue;
  474. }
  475.  
  476. case ' ':
  477. {
  478. szString[ i ] = '+';
  479.  
  480. continue;
  481. }
  482. }
  483.  
  484. new
  485. s_szHex[ 8 ]
  486. ;
  487.  
  488. if ( i + 3 >= iSize )
  489. {
  490. szString[ i ] = EOS;
  491.  
  492. break;
  493. }
  494.  
  495. if ( l + 3 >= iSize )
  496. szString[ iSize - 3 ] = EOS;
  497.  
  498. format( s_szHex, sizeof( s_szHex ), "%02h", szString[ i ] );
  499.  
  500. szString[ i ] = '%';
  501.  
  502. strins( szString, s_szHex, i + 1, iSize );
  503.  
  504. l += 2;
  505. i += 2;
  506.  
  507. if ( l > iSize - 1 )
  508. l = iSize - 1;
  509. }
  510. }
Advertisement
Add Comment
Please, Sign In to add comment