Advertisement
Guest User

RegLog

a guest
Jun 22nd, 2014
1,542
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ////////////////////////////INCLUDE///////////////////////////////////////
  2. #include <a_samp>
  3. #include <YSI\y_ini>
  4. #include <zcmd>
  5. #include <sscanf2>
  6. #include <foreach>
  7. ///////////////////////////DIALOG////////////////////////////////////////////
  8. #define DIALOG_REGISTER 1
  9. #define DIALOG_LOGIN 2
  10. #define DIALOG_AGE 3
  11. #define DIALOG_SEX 4
  12. #define DIALOG_LOCATION 5
  13. /////////////////////////PATH///////////////////////////////////////////
  14. #define PATH "/Users/%s.ini"
  15. ///////////////////////////////COLORS/////////////////////////////////////////
  16. #define COL_WHITE "{FFFFFF}"
  17. #define COL_RED "{F81414}"
  18. #define COL_GREEN "{00FF22}"
  19. #define COL_LIGHTBLUE "{00CED1}"
  20. #define COLOR_GREY 0xADADADFF
  21. #define COLOR_RED 0xFF3D3DFF
  22. #define COLOR_LIGHTRED 0xFF6347FF
  23. #define COLOR_PURPLE 0xFF2E6DFF
  24. #define COLOR_PINK 0xFF66FFA
  25. #define COLOR_GREEN 0x33AA33AA
  26. #define COLOR_BLUE 0x0000BBAA
  27. #define COLOR_WHITE 0xFFFFFFAA
  28. #define COLOR_BLACK 0x000000AA
  29. #define COLOR_YELLOW 0xFFFF00AA
  30. #define COLOR_INDIGO 0x4B00B0AA
  31. #define COLOR_DARKYELLOW 0xE5E52BAA
  32. #define COLOR_GREEN 0x33AA33AA
  33. ////////////////////////////////ENUM////////////////////////////////////////
  34. enum pInfo
  35. {
  36. pPass,
  37. pCash,
  38. pAdmin,
  39. pSex,
  40. pSkin,
  41. pLocation,
  42. pAge
  43. }
  44. new PlayerInfo[MAX_PLAYERS][pInfo];
  45.  
  46. forward LoadUser_data(playerid,name[],value[]);
  47. public LoadUser_data(playerid,name[],value[])
  48. {
  49. INI_Int("Password",PlayerInfo[playerid][pPass]);
  50. INI_Int("Cash",PlayerInfo[playerid][pCash]);
  51. INI_Int("Admin",PlayerInfo[playerid][pAdmin]);
  52. INI_Int("Sex", PlayerInfo[playerid][pSex]);
  53. INI_Int("Age",PlayerInfo[playerid][pAge]);
  54. INI_Int("Skin", PlayerInfo[playerid][pSkin]);
  55. INI_Int("Location", PlayerInfo[playerid][pLocation]);
  56. return 1;
  57. }
  58. //////////////////////////LOG/REG TEXTDRAW////////////////////////////////////////
  59. new Text:Textdraw0;
  60. new Text:Textdraw1;
  61. new Text:Textdraw2;
  62. new Text:Textdraw3;
  63. new Text:Textdraw4;
  64. new Text:Textdraw5;
  65. new Text:Textdraw6;
  66. new Text:Textdraw7;
  67. ////////////////////////////////////////////////////////////////////////////////
  68. public OnGameModeInit()
  69. {
  70. SetGameModeText("Blank Script");
  71. AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
  72. Textdraw0 = TextDrawCreate(-0.000000, -0.175000, "LD_SPAC:white");
  73. TextDrawLetterSize(Textdraw0, 0.000000, 0.000000);
  74. TextDrawTextSize(Textdraw0, 639.500000, 136.062500);
  75. TextDrawAlignment(Textdraw0, 1);
  76. TextDrawColor(Textdraw0, -16776961);
  77. TextDrawSetShadow(Textdraw0, 0);
  78. TextDrawSetOutline(Textdraw0, 0);
  79. TextDrawFont(Textdraw0, 4);
  80.  
  81. Textdraw1 = TextDrawCreate(0.000000, 318.500000, "LD_SPAC:white");
  82. TextDrawLetterSize(Textdraw1, 0.000000, 0.000000);
  83. TextDrawTextSize(Textdraw1, 640.000000, 129.500000);
  84. TextDrawAlignment(Textdraw1, 1);
  85. TextDrawColor(Textdraw1, -16776961);
  86. TextDrawSetShadow(Textdraw1, 0);
  87. TextDrawSetOutline(Textdraw1, 0);
  88. TextDrawFont(Textdraw1, 4);
  89.  
  90. Textdraw2 = TextDrawCreate(0.000000, 315.437500, "LD_SPAC:white");
  91. TextDrawLetterSize(Textdraw2, 0.000000, 0.000000);
  92. TextDrawTextSize(Textdraw2, 640.000000, 3.062500);
  93. TextDrawAlignment(Textdraw2, 1);
  94. TextDrawColor(Textdraw2, -1);
  95. TextDrawSetShadow(Textdraw2, 0);
  96. TextDrawSetOutline(Textdraw2, 0);
  97. TextDrawFont(Textdraw2, 4);
  98.  
  99. Textdraw3 = TextDrawCreate(0.000000, 138.250000, "LD_SPAC:white");
  100. TextDrawLetterSize(Textdraw3, 0.000000, 0.000000);
  101. TextDrawTextSize(Textdraw3, 640.000000, -3.062500);
  102. TextDrawAlignment(Textdraw3, 1);
  103. TextDrawColor(Textdraw3, -1);
  104. TextDrawSetShadow(Textdraw3, 0);
  105. TextDrawSetOutline(Textdraw3, 0);
  106. TextDrawFont(Textdraw3, 4);
  107.  
  108. Textdraw4 = TextDrawCreate(177.500000, 207.375000, "REGISTER");
  109. TextDrawLetterSize(Textdraw4, 0.547499, 2.146874);
  110. TextDrawAlignment(Textdraw4, 1);
  111. TextDrawColor(Textdraw4, -1);
  112. TextDrawSetShadow(Textdraw4, 1);
  113. TextDrawSetOutline(Textdraw4, 0);
  114. TextDrawBackgroundColor(Textdraw4, 51);
  115. TextDrawFont(Textdraw4, 2);
  116. TextDrawSetProportional(Textdraw4, 1);
  117. TextDrawSetSelectable(Textdraw4, true);
  118.  
  119. Textdraw5 = TextDrawCreate(361.000000, 206.062500, "LOGIN");
  120. TextDrawLetterSize(Textdraw5, 0.572499, 2.124999);
  121. TextDrawAlignment(Textdraw5, 1);
  122. TextDrawColor(Textdraw5, -1);
  123. TextDrawSetShadow(Textdraw5, 1);
  124. TextDrawSetOutline(Textdraw5, 0);
  125. TextDrawBackgroundColor(Textdraw5, 51);
  126. TextDrawFont(Textdraw5, 2);
  127. TextDrawSetProportional(Textdraw5, 1);
  128. TextDrawSetSelectable(Textdraw5, true);
  129.  
  130. Textdraw6 = TextDrawCreate(183.500000, 88.812500, "BASIC ROLE PLAY");
  131. TextDrawLetterSize(Textdraw6, 0.667000, 2.229999);
  132. TextDrawAlignment(Textdraw6, 1);
  133. TextDrawColor(Textdraw6, -1);
  134. TextDrawSetShadow(Textdraw6, 1);
  135. TextDrawSetOutline(Textdraw6, 0);
  136. TextDrawBackgroundColor(Textdraw6, 51);
  137. TextDrawFont(Textdraw6, 2);
  138. TextDrawSetProportional(Textdraw6, 1);
  139.  
  140. Textdraw7 = TextDrawCreate(597.549926, 299.731323, "QUIT");
  141. TextDrawLetterSize(Textdraw7, 0.449999, 1.600000);
  142. TextDrawAlignment(Textdraw7, 1);
  143. TextDrawColor(Textdraw7, -1);
  144. TextDrawSetShadow(Textdraw7, 1);
  145. TextDrawSetOutline(Textdraw7, 0);
  146. TextDrawBackgroundColor(Textdraw7, 51);
  147. TextDrawFont(Textdraw7, 2);
  148. TextDrawSetProportional(Textdraw7, 1);
  149. TextDrawSetSelectable(Textdraw7, true);
  150. return 1;
  151. }
  152. ////////////////////////////////////////////////////////////////////////////////
  153. public OnGameModeExit()
  154. {
  155. return 1;
  156. }
  157. ////////////////////////////////////////////////////////////////////////////////
  158. public OnPlayerRequestClass(playerid, classid)
  159. {
  160. SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
  161. SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
  162. SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
  163. return 1;
  164. }
  165. ////////////////////////////////////////////////////////////////////////////////
  166. public OnPlayerConnect(playerid)
  167. {
  168. TextDrawShowForPlayer(playerid, Textdraw0);
  169. TextDrawShowForPlayer(playerid, Textdraw1);
  170. TextDrawShowForPlayer(playerid, Textdraw2);
  171. TextDrawShowForPlayer(playerid, Textdraw3);
  172. TextDrawShowForPlayer(playerid, Textdraw4);
  173. TextDrawShowForPlayer(playerid, Textdraw5);
  174. TextDrawShowForPlayer(playerid, Textdraw6);
  175. TextDrawShowForPlayer(playerid, Textdraw7);
  176. SelectTextDraw(playerid, 0xFF4040AA);
  177. new name[MAX_PLAYER_NAME+1];
  178. GetPlayerName(playerid, name, sizeof(name));
  179.  
  180. SetPlayerCameraPos(playerid, 1061.1375, -1348.5317, 72.5953);
  181. SetPlayerCameraLookAt(playerid, 1062.0928, -1348.8217, 72.5754);
  182.  
  183. if(IsPlayerNPC(playerid)) return 1;
  184. new str[24+MAX_PLAYER_NAME+1];
  185. GetPlayerName(playerid, name, sizeof(name));
  186. if(strfind(name, "0", true) != -1 || strfind(name, "1", true) != -1 || strfind(name, "2", true) != -1 || strfind(name, "3", true) != -1 || strfind(name, "4", true) != -1 || strfind(name, "5", true) != -1
  187. || strfind(name, "6", true) != -1 || strfind(name, "7", true) != -1 || strfind(name, "8", true) != -1 || strfind(name, "9", true) != -1 || strfind(name, "[", true) != -1 || strfind(name, "]", true) != -1)
  188. {
  189. SendClientMessage(playerid, 0xFF3D3DFF, "SERVER: {FFFFFF}Due to being a roleplay name we require a roleplay-ing name, like Firstname_Lastname.");
  190. SendClientMessage(playerid, 0xFF3D3DFF, "SERVER: {FFFFFF}If you either user numbers on your name, please remove them also.");
  191. GetPlayerName(playerid, name, sizeof(name));
  192. format(str, sizeof(str), "%s has been kicked from the server for having a Non-RP name.", name);
  193. SendClientMessageToAll(0xC4C4C4FF, str);
  194. Kick(playerid);
  195. }
  196. if(strfind( name, "_", true) == -1)
  197. {
  198. SendClientMessage(playerid, 0xFF3D3DFF, "SERVER: {FFFFFF}Due to being a roleplay name we require a roleplay-ing name, like Firstname_Lastname.");
  199. format(str, sizeof(str), "%s has been kicked from the server for having a Non-RP name.", name);
  200. SendClientMessageToAll(0xC4C4C4FF, str);
  201. Kick(playerid);
  202. }
  203. return 1;
  204. }
  205. ////////////////////////////////////////////////////////////////////////////////
  206. public OnPlayerClickTextDraw(playerid, Text:clickedid)
  207. {
  208. if(clickedid == Textdraw4)
  209. {
  210. ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD,"{FFFFFF}Basic RolePlay-{FF0000}Register","\n{FF0000}___________________________________\n{FFFFFF}Welcome to {FF0000}Basic Roleplay\n{FFFFFF}You don't have {FF0000}Account\n{FFFFFF}Forum {FF0000}www.site.com\n{FFFFFF}Please type your password to {FF0000}Register.\n{FFFFFF}Have a nice {FF0000}Day!\n{FF0000}___________________________________","Register","Quit");
  211. TextDrawHideForPlayer(playerid, Textdraw0);
  212. TextDrawHideForPlayer(playerid, Textdraw1);
  213. TextDrawHideForPlayer(playerid, Textdraw2);
  214. TextDrawHideForPlayer(playerid, Textdraw3);
  215. TextDrawHideForPlayer(playerid, Textdraw4);
  216. TextDrawHideForPlayer(playerid, Textdraw5);
  217. TextDrawHideForPlayer(playerid, Textdraw6);
  218. TextDrawHideForPlayer(playerid, Textdraw7);
  219. }
  220. if(clickedid== Textdraw5)
  221. {
  222. INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
  223. ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD,"{FFFFFF}Basic RolePlay-{FF0000}Login","\n{FF0000}___________________________________\n{FFFFFF}Welcome to {FF0000}Basic Roleplay\n{FFFFFF}You have {FF0000}Account\n{FFFFFF}Forum {FF0000}www.site.com\n{FFFFFF}Please type your password to {FF0000}Login\n{FFFFFF}Have a nice {FF0000}Day!\n{FF0000}___________________________________","Login","Quit");
  224. TextDrawHideForPlayer(playerid, Textdraw0);
  225. TextDrawHideForPlayer(playerid, Textdraw1);
  226. TextDrawHideForPlayer(playerid, Textdraw2);
  227. TextDrawHideForPlayer(playerid, Textdraw3);
  228. TextDrawHideForPlayer(playerid, Textdraw4);
  229. TextDrawHideForPlayer(playerid, Textdraw5);
  230. TextDrawHideForPlayer(playerid, Textdraw6);
  231. TextDrawHideForPlayer(playerid, Textdraw7);
  232. }
  233. return 1;
  234. }
  235. ////////////////////////////////////////////////////////////////////////////////
  236. public OnPlayerDisconnect(playerid, reason)
  237. {
  238. new INI:File = INI_Open(UserPath(playerid));
  239. INI_SetTag(File,"data");
  240. INI_WriteInt(File,"Cash",GetPlayerMoney(playerid));
  241. INI_WriteInt(File,"Admin",PlayerInfo[playerid][pAdmin]);
  242. INI_WriteInt(File,"Age",PlayerInfo[playerid][pAge]);
  243. INI_WriteInt(File,"Sex", PlayerInfo[playerid][pSex]);
  244. INI_WriteInt(File,"Skin", PlayerInfo[playerid][pSkin]);
  245. INI_WriteInt(File,"Location", PlayerInfo[playerid][pLocation]);
  246. INI_Close(File);
  247. return 1;
  248. }
  249.  
  250. public OnPlayerSpawn(playerid)
  251. {
  252. SetPlayerSkin(playerid, PlayerInfo[playerid][pSkin]);
  253. return 1;
  254. }
  255. ////////////////////////////////////////////////////////////////////////////////
  256. public OnPlayerDeath(playerid, killerid, reason)
  257. {
  258. return 1;
  259. }
  260. ////////////////////////////////////////////////////////////////////////////////
  261. public OnVehicleSpawn(vehicleid)
  262. {
  263. return 1;
  264. }
  265. ////////////////////////////////////////////////////////////////////////////////
  266. public OnVehicleDeath(vehicleid, killerid)
  267. {
  268. return 1;
  269. }
  270. ////////////////////////////////////////////////////////////////////////////////
  271. public OnPlayerText(playerid, text[])
  272. {
  273. return 1;
  274. }
  275. ////////////////////////////////////////////////////////////////////////////////
  276. public OnPlayerCommandText(playerid, cmdtext[])
  277. {
  278. if (strcmp("/mycommand", cmdtext, true, 10) == 0)
  279. {
  280. // Do something here
  281. return 1;
  282. }
  283. return 0;
  284. }
  285. ////////////////////////////////////////////////////////////////////////////////
  286. public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
  287. {
  288. return 1;
  289. }
  290. ////////////////////////////////////////////////////////////////////////////////
  291. public OnPlayerExitVehicle(playerid, vehicleid)
  292. {
  293. return 1;
  294. }
  295. ////////////////////////////////////////////////////////////////////////////////
  296. public OnPlayerStateChange(playerid, newstate, oldstate)
  297. {
  298. return 1;
  299. }
  300. ////////////////////////////////////////////////////////////////////////////////
  301. public OnPlayerEnterCheckpoint(playerid)
  302. {
  303. return 1;
  304. }
  305. ////////////////////////////////////////////////////////////////////////////////
  306. public OnPlayerLeaveCheckpoint(playerid)
  307. {
  308. return 1;
  309. }
  310. ////////////////////////////////////////////////////////////////////////////////
  311. public OnPlayerEnterRaceCheckpoint(playerid)
  312. {
  313. return 1;
  314. }
  315. ////////////////////////////////////////////////////////////////////////////////
  316. public OnPlayerLeaveRaceCheckpoint(playerid)
  317. {
  318. return 1;
  319. }
  320. ////////////////////////////////////////////////////////////////////////////////
  321. public OnRconCommand(cmd[])
  322. {
  323. return 1;
  324. }
  325. ////////////////////////////////////////////////////////////////////////////////
  326. public OnPlayerRequestSpawn(playerid)
  327. {
  328. return 1;
  329. }
  330. ////////////////////////////////////////////////////////////////////////////////
  331. public OnObjectMoved(objectid)
  332. {
  333. return 1;
  334. }
  335. ////////////////////////////////////////////////////////////////////////////////
  336. public OnPlayerObjectMoved(playerid, objectid)
  337. {
  338. return 1;
  339. }
  340. ////////////////////////////////////////////////////////////////////////////////
  341. public OnPlayerPickUpPickup(playerid, pickupid)
  342. {
  343. return 1;
  344. }
  345. ////////////////////////////////////////////////////////////////////////////////
  346. public OnVehicleMod(playerid, vehicleid, componentid)
  347. {
  348. return 1;
  349. }
  350. ////////////////////////////////////////////////////////////////////////////////
  351. public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
  352. {
  353. return 1;
  354. }
  355. ////////////////////////////////////////////////////////////////////////////////
  356. public OnVehicleRespray(playerid, vehicleid, color1, color2)
  357. {
  358. return 1;
  359. }
  360. ////////////////////////////////////////////////////////////////////////////////
  361. public OnPlayerSelectedMenuRow(playerid, row)
  362. {
  363. return 1;
  364. }
  365. ////////////////////////////////////////////////////////////////////////////////
  366. public OnPlayerExitedMenu(playerid)
  367. {
  368. return 1;
  369. }
  370. ////////////////////////////////////////////////////////////////////////////////
  371. public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
  372. {
  373. return 1;
  374. }
  375. ////////////////////////////////////////////////////////////////////////////////
  376. public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
  377. {
  378. return 1;
  379. }
  380. ////////////////////////////////////////////////////////////////////////////////
  381. public OnRconLoginAttempt(ip[], password[], success)
  382. {
  383. return 1;
  384. }
  385. ////////////////////////////////////////////////////////////////////////////////
  386. public OnPlayerUpdate(playerid)
  387. {
  388. return 1;
  389. }
  390. ////////////////////////////////////////////////////////////////////////////////
  391. public OnPlayerStreamIn(playerid, forplayerid)
  392. {
  393. return 1;
  394. }
  395. ////////////////////////////////////////////////////////////////////////////////
  396. public OnPlayerStreamOut(playerid, forplayerid)
  397. {
  398. return 1;
  399. }
  400. ////////////////////////////////////////////////////////////////////////////////
  401. public OnVehicleStreamIn(vehicleid, forplayerid)
  402. {
  403. return 1;
  404. }
  405. ////////////////////////////////////////////////////////////////////////////////
  406. public OnVehicleStreamOut(vehicleid, forplayerid)
  407. {
  408. return 1;
  409. }
  410. ////////////////////////////////////////////////////////////////////////////////
  411. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  412. {
  413. switch( dialogid )
  414. {
  415. case DIALOG_REGISTER:
  416. {
  417. if (!response) return Kick(playerid);
  418. if(response)
  419. {
  420. if(!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, ""COL_WHITE"Registering...",""COL_RED"You have entered an invalid password.\n"COL_WHITE"Type your password below to register a new account.","Register","Quit");
  421. new INI:File = INI_Open(UserPath(playerid));
  422. INI_SetTag(File,"data");
  423. INI_WriteInt(File,"Password",udb_hash(inputtext));
  424. INI_WriteInt(File,"Cash",0);
  425. INI_WriteInt(File,"Admin",0);
  426. INI_WriteInt(File,"Age",0);
  427. INI_WriteInt(File,"Sex",2);
  428. INI_WriteInt(File,"Skin",0);
  429. INI_WriteInt(File,"Location",0);
  430. INI_Close(File);
  431.  
  432. ShowPlayerDialog(playerid, DIALOG_AGE, DIALOG_STYLE_INPUT,"{FF0000}Age","\n{FF0000}___________________________________\n{FFFFFF}Please put your age to {FF0000}process.\n{FF0000}___________________________________","Ok","");
  433. }
  434. }
  435. case DIALOG_AGE:
  436. {
  437. if(!response) return Kick(playerid);
  438. if(response)
  439. {
  440. new age, message[64];
  441.  
  442. age = strval(inputtext);
  443. if(age < 13 || age > 70)
  444. {
  445. ShowPlayerDialog(playerid, DIALOG_AGE, DIALOG_STYLE_INPUT,"{FF0000}Age","{FFFFFF}Please put your age to {FF0000}process.","Ok","");
  446. SendClientMessage(playerid, 0xFFFFFFFF, "You need to be older than 13");
  447. }
  448. else
  449. {
  450. PlayerInfo[playerid][pAge] = age;
  451. format(message, sizeof(message), "So you are: %d. years old ?", age);
  452. SendClientMessage(playerid, 0xFFFFFFFF, message);
  453. ShowPlayerDialog(playerid, DIALOG_SEX, DIALOG_STYLE_LIST,"{FF0000}Sex","Male\nFemale","Ok","");
  454. }
  455. }
  456. }
  457. case DIALOG_SEX:
  458. {
  459. if(response)
  460. {
  461. new message[64];
  462. if(listitem == 0)
  463. {
  464. PlayerInfo[playerid][pSex] = 0;
  465. format(message, sizeof(message), "Okay you are {FF0000}Male");
  466. SendClientMessage(playerid, 0xFFFFFFFF, message);
  467. PlayerInfo[playerid][pSkin] = 20;
  468. printf("Skin has been set to 20");
  469. ShowPlayerDialog(playerid, DIALOG_LOCATION, DIALOG_STYLE_LIST,"{FF0000}Chose spawn","Los Santos\nSan Fierro\nLas Venturas","Ok","");
  470. }
  471. if(listitem == 1)
  472. {
  473. PlayerInfo[playerid][pSex] = 1;
  474. format(message, sizeof(message), "Okay you are {FF0000}Female");
  475. SendClientMessage(playerid, 0xFFFFFFFF, message);
  476. PlayerInfo[playerid][pSkin] = 12;
  477. printf("Skin has been set to 12");
  478. ShowPlayerDialog(playerid, DIALOG_LOCATION, DIALOG_STYLE_LIST,"{FF0000}Chose spawn","Los Santos\nSan Fierro\nLas Venturas","Ok","");
  479. }
  480. }
  481. }
  482. case DIALOG_LOCATION:
  483. {
  484. if(!response) return Kick(playerid);
  485. if(response)
  486. {
  487. new message[64];
  488. if(listitem == 0)
  489. {
  490. PlayerInfo[playerid][pLocation] = 0;
  491. format(message, sizeof(message), "Ok you are form {FF0000}Los Santos");
  492. SendClientMessage(playerid, 0xFFFFFFFF, message);
  493. SetSpawnInfo(playerid, 0, PlayerInfo[playerid][pSkin], 1713.6101,-1912.2190,13.5669,85.9081, 0, 0, 0, 0, 0, 0);
  494. SpawnPlayer(playerid);
  495. }
  496. if(listitem == 1)
  497. {
  498. PlayerInfo[playerid][pLocation] = 1;
  499. format(message, sizeof(message), "Ok you are form {FF0000}San Fierro");
  500. SendClientMessage(playerid, 0xFFFFFFFF, message);
  501. SetSpawnInfo(playerid, 0, PlayerInfo[playerid][pSkin], 1642.1584, -2334.1926, -2.6797, 359.7559, 0, 0, 0, 0, 0, 0);
  502. SpawnPlayer(playerid);
  503. }
  504. if(listitem == 2)
  505. {
  506. PlayerInfo[playerid][pLocation] = 2;
  507. format(message, sizeof(message), "Ok you are form {FF0000}Venturas");
  508. SendClientMessage(playerid, 0xFFFFFFFF, message);
  509. SetSpawnInfo(playerid, 0, PlayerInfo[playerid][pSkin], 1642.1584, -2334.1926, -2.6797, 359.7559, 0, 0, 0, 0, 0, 0);
  510. SpawnPlayer(playerid);
  511. }
  512. }
  513. }
  514. case DIALOG_LOGIN:
  515. {
  516. if ( !response ) return Kick ( playerid );
  517. if( response )
  518. {
  519. if(udb_hash(inputtext) == PlayerInfo[playerid][pPass])
  520. {
  521. INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
  522. GivePlayerMoney(playerid, PlayerInfo[playerid][pCash]);
  523. SetSpawnInfo(playerid, 0, PlayerInfo[playerid][pSkin], 1642.1584, -2334.1926, -2.6797, 359.7559, 0, 0, 0, 0, 0, 0);
  524. SpawnPlayer(playerid);
  525. }
  526. else
  527. {
  528. Kick(playerid);
  529. }
  530. return 1;
  531. }
  532. }
  533. }
  534. return 1;
  535. }
  536. ////////////////////////////////////////////////////////////////////////////////
  537. public OnPlayerClickPlayer(playerid, clickedplayerid, source)
  538. {
  539. return 1;
  540. }
  541. ////////////////////////////////////////////////////////////////////////////////
  542. stock UserPath(playerid)
  543. {
  544. new string[128],playername[MAX_PLAYER_NAME];
  545. GetPlayerName(playerid,playername,sizeof(playername));
  546. format(string,sizeof(string),PATH,playername);
  547. return string;
  548. }
  549. ////////////////////////////////////////////////////////////////////////////////
  550. stock udb_hash(buf[]) {
  551. new length=strlen(buf);
  552. new s1 = 1;
  553. new s2 = 0;
  554. new n;
  555. for (n=0; n<length; n++)
  556. {
  557. s1 = (s1 + buf[n]) % 65521;
  558. s2 = (s2 + s1) % 65521;
  559. }
  560. return (s2 << 16) + s1;
  561. }
  562. ////////////////////////////////////////////////////////////////////////////////
  563. stock PlayerName(playerid)
  564. {
  565. new pName[25];
  566. GetPlayerName(playerid, pName, sizeof(pName));
  567. return pName;
  568. }
  569. ////////////////////////////////////////////////////////////////////////////////
  570. stock ProxDetector(Float:radi, playerid, string[],color)
  571. {
  572. new Float:x,Float:y,Float:z;
  573. GetPlayerPos(playerid,x,y,z);
  574. foreach(Player,i)
  575. {
  576. if(IsPlayerInRangeOfPoint(i,radi,x,y,z))
  577. {
  578. SendClientMessage(i,color,string);
  579. }
  580. }
  581. }
  582. ////////////////////////////////////////////////////////////////////////////////
  583. stock strreplace(string[], find, replace)
  584. {
  585. for(new i=0; string[i]; i++)
  586. {
  587. if(string[i] == find)
  588. {
  589. string[i] = replace;
  590. }
  591. }
  592. }
Advertisement
Advertisement
Advertisement
RAW Paste Data Copied
Advertisement