Advertisement
Guest User

Untitled

a guest
May 20th, 2016
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 30.82 KB | None | 0 0
  1. //----------------------------------------------------------------------------//
  2. /****************************************************************************/
  3. // Inludes //
  4. /****************************************************************************/
  5. //----------------------------------------------------------------------------//
  6. #include <a_samp>
  7. #include <zcmd>
  8. #include <YSI\y_ini>
  9. #include <filemanager>
  10. #include <dialogs>
  11. //----------------------------------------------------------------------------//
  12. /****************************************************************************/
  13. //----------------------------------------------------------------------------//
  14.  
  15. //----------------------------------------------------------------------------//
  16. /****************************************************************************/
  17. // Colors //
  18. /****************************************************************************/
  19. //----------------------------------------------------------------------------//
  20. #define C_Default 0xD3D3D3FF
  21. #define C_T_Default "{D3D3D3}"
  22. #define C_Error 0xB32E2EFF
  23. #define C_T_Error "{B32E2E}"
  24. #define C_T_DialogTitle "{348FAD}"
  25. //----------------------------------------------------------------------------//
  26. /****************************************************************************/
  27. //----------------------------------------------------------------------------//
  28.  
  29. //----------------------------------------------------------------------------//
  30. /****************************************************************************/
  31. // Dialogs //
  32. /****************************************************************************/
  33. //----------------------------------------------------------------------------//
  34. #define D_Username 100
  35. #define D_Login 200
  36. #define D_R_Password 300
  37. #define D_R_Mail 301
  38. #define D_R_C_Age 302
  39. #define D_R_C_Gender 303
  40. #define D_R_C_Origin 304
  41. #define D_R_C_Accent 305
  42. //----------------------------------------------------------------------------//
  43. /****************************************************************************/
  44. //----------------------------------------------------------------------------//
  45.  
  46. //----------------------------------------------------------------------------//
  47. /****************************************************************************/
  48. // Fix for gm //
  49. /****************************************************************************/
  50. //----------------------------------------------------------------------------//
  51. main()
  52. {
  53. //EMPTY
  54. }
  55.  
  56. #if !defined isnull
  57. #define isnull(%1) ((!(%1[0])) || (((%1[0]) == '\1') && (!(%1[1]))))
  58. #endif
  59.  
  60. //----------------------------------------------------------------------------//
  61. /****************************************************************************/
  62. //----------------------------------------------------------------------------//
  63.  
  64. //----------------------------------------------------------------------------//
  65. /****************************************************************************/
  66. // Public //
  67. /****************************************************************************/
  68. //----------------------------------------------------------------------------//
  69. public OnGameModeInit()
  70. {
  71. SetGameModeText("NCRP - V 1.00.0");
  72. WriteLog("log_server.txt", "Initialize NCRP Gamemode Version 1.00.0");
  73. return 1;
  74. }
  75.  
  76. public OnGameModeExit()
  77. {
  78. WriteLog("log_server.txt", "Shutting down the GameMode.");
  79. return 1;
  80. }
  81.  
  82. public OnPlayerConnect(playerid)
  83. {
  84. TogglePlayerSpectating(playerid, 1);
  85. switch(random(5))
  86. {
  87. case 0:
  88. {
  89. InterpolateCameraPos(playerid,1006.8538, 282.1343, 85.7583, 1006.8538, 282.1343, 85.7583, 1000, CAMERA_CUT);
  90. InterpolateCameraLookAt(playerid, 1007.8502, 282.1040, 85.5879, 1007.8502, 282.1040, 85.5879, 1000, CAMERA_CUT);
  91. }
  92. case 1:
  93. {
  94. InterpolateCameraPos(playerid,646.6002, -594.4451, 15.9723, 646.6002, -594.4451, 15.9723, 1000, CAMERA_CUT);
  95. InterpolateCameraLookAt(playerid,646.9472, -593.6812, 16.1468, 645.9472, -593.6812, 16.1468, 1000, CAMERA_CUT);
  96. }
  97. case 2:
  98. {
  99. InterpolateCameraPos(playerid, 651.7802, -494.6155, 30.2279, 651.7802, -494.6155, 30.2279, 1000, CAMERA_CUT);
  100. InterpolateCameraLookAt(playerid, 652.5730, -493.9993, 29.9173, 652.5730, -493.9993, 29.9173, 1000, CAMERA_CUT);
  101. }
  102. case 3:
  103. {
  104. InterpolateCameraPos(playerid, 187.5941, -217.7278, 1.9320, 187.5941, -217.7278, 1.9320, 1000, CAMERA_CUT);
  105. InterpolateCameraLookAt(playerid, 188.3079, -217.0226, 2.0968, 188.3079, -217.0226, 2.0968, 1000, CAMERA_CUT);
  106. }
  107. default:
  108. {
  109. InterpolateCameraPos(playerid, 94.6793, -215.7012, 3.1615, 94.6793, -215.7012, 3.1615, 1000, CAMERA_CUT);
  110. InterpolateCameraLookAt(playerid, 94.1885, -216.5767, 3.2614, 94.1885, -216.5767, 3.2614, 1000, CAMERA_CUT);
  111. }
  112. }
  113. lr_OnPlayerConnect(playerid);
  114. return 1;
  115. }
  116.  
  117. public OnPlayerDisconnect(playerid, reason)
  118. {
  119. new logfile[255], logtext[255], username[24], dreason[3][] = { "Unknown(Timeout or crash)", "Manual Exit", "Admin Kick" };
  120. GetPlayerName(playerid, username, sizeof(username));
  121. format(logfile, 255, "%s/log.txt", username);
  122. format(logtext, 255, "%s disconnected from the server for %s.", username, dreason[reason]);
  123. WriteLog(logfile, logtext);
  124. return 1;
  125. }
  126.  
  127. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  128. {
  129. switch(dialogid)
  130. {
  131. case D_Login:
  132. {
  133. lr_D_Login(playerid, response, inputtext);
  134. }
  135.  
  136. case D_R_Password:
  137. {
  138. lr_D_R_Password(playerid, response, inputtext);
  139. }
  140.  
  141. case D_R_Mail:
  142. {
  143. lr_D_R_Mail(playerid, response, inputtext);
  144. }
  145.  
  146. case D_R_C_Age:
  147. {
  148. lr_D_R_C_Age(playerid, response, inputtext);
  149. }
  150.  
  151. case D_R_C_Gender:
  152. {
  153. lr_D_R_C_Gender(playerid, response);
  154. }
  155.  
  156. case D_R_C_Origin:
  157. {
  158. lr_D_R_C_Origin(playerid, response, inputtext);
  159. }
  160.  
  161. case D_R_C_Accent:
  162. {
  163. lr_D_R_C_Age(playerid, response, inputtext);
  164. }
  165. }
  166. return 1;
  167. }
  168. //----------------------------------------------------------------------------//
  169. /****************************************************************************/
  170. //----------------------------------------------------------------------------//
  171.  
  172. //----------------------------------------------------------------------------//
  173. /****************************************************************************/
  174. // PlayerName //
  175. /****************************************************************************/
  176. //----------------------------------------------------------------------------//
  177. playername(playerid)
  178. {
  179. new pnn[MAX_PLAYER_NAME];
  180. GetPlayerName(playerid, pnn, sizeof(pnn));
  181. return pnn;
  182. }
  183. //----------------------------------------------------------------------------//
  184. /****************************************************************************/
  185. //----------------------------------------------------------------------------//
  186.  
  187. //----------------------------------------------------------------------------//
  188. /****************************************************************************/
  189. // NumbersInString //
  190. /****************************************************************************/
  191. //----------------------------------------------------------------------------//
  192. stock NumbersInString(const _str_[])
  193. {
  194. for (new i, j = strlen(_str_); i != j; i++)
  195. {
  196. if ('0' <= _str_[i] <= '9') return 1;
  197. }
  198. return 0;
  199. }
  200. //----------------------------------------------------------------------------//
  201. /****************************************************************************/
  202. //----------------------------------------------------------------------------//
  203.  
  204. //----------------------------------------------------------------------------//
  205. /****************************************************************************/
  206. // Login & Reg //
  207. /****************************************************************************/
  208. //----------------------------------------------------------------------------//
  209. enum pInformation
  210. {
  211. pPassword[255],
  212. pMail[255],
  213. pIP_Reg[255],
  214. pIP_Last[255],
  215. pStaff[255],
  216. pAge,
  217. pGender[255],
  218. pOrigin[255],
  219. pAccent[255],
  220. Float:pPositionX,
  221. Float:pPositionY,
  222. Float:pPositionZ,
  223. Float:pAngle,
  224. Float:pHealth,
  225. Float:pArmour,
  226. pInterior,
  227. pVirtualWorld,
  228. pJob,
  229. pFaction,
  230. pMoney,
  231. pLevel
  232. }
  233.  
  234. new Player[MAX_PLAYERS][pInformation],
  235. PlayerText:Background,
  236. PlayerText:Loading,
  237. PlayerText:NewCity,
  238. PlayerText:Roleplay,
  239. passwordattemptsleft[MAX_PLAYERS] = 3;
  240.  
  241. forward LoadUser_data(playerid,name[],value[]);
  242.  
  243. public LoadUser_data(playerid,name[],value[])
  244. {
  245. INI_String("Password", Player[playerid][pPassword], 255);
  246. INI_String("Mail", Player[playerid][pMail], 255);
  247. INI_String("IP_Reg", Player[playerid][pIP_Reg], 255);
  248. INI_String("IP_Last", Player[playerid][pIP_Last], 255);
  249. INI_String("Staff", Player[playerid][pStaff], 255);
  250. INI_Int("Age", Player[playerid][pAge]);
  251. INI_String("Gender", Player[playerid][pGender], 255);
  252. INI_String("Origin", Player[playerid][pOrigin], 255);
  253. INI_String("Accent", Player[playerid][pAccent], 255);
  254. INI_Float("PositionX", Player[playerid][pPositionX]);
  255. INI_Float("PositionY", Player[playerid][pPositionY]);
  256. INI_Float("PositionZ", Player[playerid][pPositionZ]);
  257. INI_Float("Angle", Player[playerid][pAngle]);
  258. INI_Float("Health", Player[playerid][pHealth]);
  259. INI_Float("Armour", Player[playerid][pArmour]);
  260. INI_Int("Interior", Player[playerid][pInterior]);
  261. INI_Int("VirtualWorld", Player[playerid][pVirtualWorld]);
  262. INI_Int("Job", Player[playerid][pJob]);
  263. INI_Int("Faction", Player[playerid][pFaction]);
  264. INI_Int("Money", Player[playerid][pMoney]);
  265. INI_Int("Level", Player[playerid][pLevel]);
  266. return 1;
  267. }
  268.  
  269. stock UserPath(playerid)
  270. {
  271. new string[128], pn[MAX_PLAYER_NAME];
  272. GetPlayerName(playerid, pn, sizeof(pn));
  273. format(string, sizeof(string), "%s/account.ini", pn);
  274. return string;
  275. }
  276.  
  277. stock lr_OnPlayerConnect(playerid)
  278. {
  279. passwordattemptsleft[playerid] = 3;
  280. Background = CreatePlayerTextDraw(playerid,0.000000, 0.000000, "BACKGROUND");
  281. PlayerTextDrawBackgroundColor(playerid,Background, 255);
  282. PlayerTextDrawFont(playerid,Background, 1);
  283. PlayerTextDrawLetterSize(playerid,Background, 5.599997, 52.099998);
  284. PlayerTextDrawColor(playerid,Background, 255);
  285. PlayerTextDrawSetOutline(playerid,Background, 0);
  286. PlayerTextDrawSetProportional(playerid,Background, 1);
  287. PlayerTextDrawSetShadow(playerid,Background, 1);
  288. PlayerTextDrawUseBox(playerid,Background, 1);
  289. PlayerTextDrawBoxColor(playerid,Background, 255);
  290. PlayerTextDrawTextSize(playerid,Background, 642.000000, 212.000000);
  291. PlayerTextDrawSetSelectable(playerid,Background, 0);
  292.  
  293. Loading = CreatePlayerTextDraw(playerid,261.000000, 260.000000, "Loading..");
  294. PlayerTextDrawBackgroundColor(playerid,Loading, 255);
  295. PlayerTextDrawFont(playerid,Loading, 1);
  296. PlayerTextDrawLetterSize(playerid,Loading, 0.700000, 3.000000);
  297. PlayerTextDrawColor(playerid,Loading, -1);
  298. PlayerTextDrawSetOutline(playerid,Loading, 0);
  299. PlayerTextDrawSetProportional(playerid,Loading, 1);
  300. PlayerTextDrawSetShadow(playerid,Loading, 1);
  301. PlayerTextDrawSetSelectable(playerid,Loading, 0);
  302.  
  303. NewCity = CreatePlayerTextDraw(playerid,238.000000, 219.000000, "New City");
  304. PlayerTextDrawAlignment(playerid,NewCity, 2);
  305. PlayerTextDrawBackgroundColor(playerid,NewCity, 255);
  306. PlayerTextDrawFont(playerid,NewCity, 1);
  307. PlayerTextDrawLetterSize(playerid,NewCity, 1.010000, 4.000000);
  308. PlayerTextDrawColor(playerid,NewCity, 881831423);
  309. PlayerTextDrawSetOutline(playerid,NewCity, 0);
  310. PlayerTextDrawSetProportional(playerid,NewCity, 1);
  311. PlayerTextDrawSetShadow(playerid,NewCity, 1);
  312. PlayerTextDrawSetSelectable(playerid,NewCity, 0);
  313.  
  314. Roleplay = CreatePlayerTextDraw(playerid,395.000000, 220.000000, ": Roleplay");
  315. PlayerTextDrawAlignment(playerid,Roleplay, 2);
  316. PlayerTextDrawBackgroundColor(playerid,Roleplay, 255);
  317. PlayerTextDrawFont(playerid,Roleplay, 1);
  318. PlayerTextDrawLetterSize(playerid,Roleplay, 1.010000, 4.000000);
  319. PlayerTextDrawColor(playerid,Roleplay, -774778369);
  320. PlayerTextDrawSetOutline(playerid,Roleplay, 0);
  321. PlayerTextDrawSetProportional(playerid,Roleplay, 1);
  322. PlayerTextDrawSetShadow(playerid,Roleplay, 1);
  323. PlayerTextDrawSetSelectable(playerid,Roleplay, 0);
  324.  
  325. PlayerTextDrawShow(playerid, Background);
  326. PlayerTextDrawShow(playerid, Loading);
  327. PlayerTextDrawShow(playerid, NewCity);
  328. PlayerTextDrawShow(playerid, Roleplay);
  329. SetTimerEx("EndLoadingScreen", 3500, false, "i", playerid);
  330. }
  331.  
  332. forward EndLoadingScreen(playerid);
  333.  
  334. public EndLoadingScreen(playerid)
  335. {
  336. PlayerTextDrawHide(playerid, Background);
  337. PlayerTextDrawHide(playerid, Loading);
  338. PlayerTextDrawHide(playerid, NewCity);
  339. PlayerTextDrawHide(playerid, Roleplay);
  340. for(new i = 0; i < 20; i++)
  341. {
  342. SendClientMessage(playerid, C_Default, " ");
  343. }
  344. if(NumbersInString(playername(playerid)) == 0)
  345. {
  346. if(strfind(playername(playerid), "_", true) != -1)
  347. {
  348. if(fexist(UserPath(playerid)))
  349. {
  350. INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
  351. ShowPlayerDialog(playerid, D_Login, DIALOG_STYLE_PASSWORD, ""C_T_DialogTitle"New City Roleplay"C_T_Default": Login", ""C_T_Default"Welcome back to "C_T_DialogTitle"New City"C_T_Default": Roleplay.\nIn order to contine, Enter your password below.", "Login", "Exit");
  352. new logfile[255], logtext[255];
  353. format(logfile, 255, "%s/log.txt", playername(playerid));
  354. format(logtext, 255, "%s connected to the server.", playername(playerid));
  355. WriteLog(logfile, logtext);
  356. }
  357. else
  358. {
  359. new dir_n[MAX_PLAYER_NAME + 13] = "scriptfiles\\";
  360. strcat(dir_n, playername(playerid));
  361. dir_create(dir_n);
  362. ShowPlayerDialog(playerid, D_R_Password, DIALOG_STYLE_PASSWORD, ""C_T_DialogTitle"New City Roleplay"C_T_Default": Register", ""C_T_Default"Welcome to "C_T_DialogTitle"New City"C_T_Default": Roleplay.\nWe noticed that you're a new user.\nTo contine enter your password.", "Contine", "Quit");
  363. new logfile[255], logtext[255];
  364. format(logfile, 255, "%s/log.txt", playername(playerid));
  365. format(logtext, 255, "%s connected to the server.", playername(playerid));
  366. WriteLog(logfile, logtext);
  367. }
  368. }
  369. else
  370. {
  371. ShowPlayerDialog(playerid, D_Username, DIALOG_STYLE_INPUT, ""C_T_DialogTitle"New City Roleplay"C_T_Default": Invalid Name", ""C_T_Default"Welcome to "C_T_DialogTitle"New City"C_T_Default": Roleplay.\nIn order to play here, you must have a valid roleplay name.\nYou will be asked a few questions about roleplaying to make sure you actually can roleplay, Else will you get help by an advisor.\n\n"C_T_Error"Enter your name as John_Doe.", "Check", "Exit");
  372. }
  373. }
  374. else
  375. {
  376. ShowPlayerDialog(playerid, D_Username, DIALOG_STYLE_INPUT, ""C_T_DialogTitle"New City Roleplay"C_T_Default": Invalid Name", ""C_T_Default"Welcome to "C_T_DialogTitle"New City"C_T_Default": Roleplay.\nIn order to play here, you must have a valid roleplay name.\nYou will be asked a few questions about roleplaying to make sure you actually can roleplay, Else will you get help by an advisor.\n\n"C_T_Error"Enter your name as John_Doe.", "Check", "Exit");
  377. }
  378. return 1;
  379. }
  380.  
  381. stock lr_D_Login(playerid, response, inputtext[])
  382. {
  383. if(response)
  384. {
  385. if(!isnull(inputtext))
  386. {
  387. if(!strcmp(inputtext, Player[playerid][pPassword]))
  388. {
  389. SpawnPlayer(playerid);
  390. PlayerTextDrawShow(playerid, Background);
  391. PlayerTextDrawShow(playerid, Loading);
  392. PlayerTextDrawShow(playerid, NewCity);
  393. PlayerTextDrawShow(playerid, Roleplay);
  394. SetTimerEx("EndLoadingScreen20", 3500, false, "i", playerid);
  395. }
  396. else
  397. {
  398. passwordattemptsleft[playerid]--;
  399. if(passwordattemptsleft[playerid] != 0)
  400. {
  401. new dialogtext[255];
  402. format(dialogtext, 255, ""C_T_Default"Welcome back to "C_T_DialogTitle"New City"C_T_Default": Roleplay.\nIn order to contine, Enter your password below.\n\n"C_T_Error"You entered the wrong password! (%i/3 attempts left)", passwordattemptsleft[playerid]);
  403. ShowPlayerDialog(playerid, D_Login, DIALOG_STYLE_PASSWORD, ""C_T_DialogTitle"New City Roleplay"C_T_Default": Login", dialogtext, "Login", "Exit");
  404. }
  405. else
  406. {
  407. KickPlayer(playerid, "\"Entered over 3 invalid passwords.\"");
  408. }
  409. }
  410. }
  411. else
  412. {
  413. ShowPlayerDialog(playerid, D_Login, DIALOG_STYLE_PASSWORD, ""C_T_DialogTitle"New City Roleplay"C_T_Default": Login", ""C_T_Default"Welcome back to "C_T_DialogTitle"New City"C_T_Default": Roleplay.\nIn order to contine, Enter your password below.\n\n"C_T_Error"You forgot to insert a password.", "Login", "Exit");
  414. }
  415. }
  416. else
  417. {
  418. KickPlayer(playerid, "\"Pressed Exit on Login.\"");
  419. }
  420. }
  421.  
  422. stock lr_D_R_Password(playerid, response, inputtext[])
  423. {
  424. if(response)
  425. {
  426. if(!isnull(inputtext))
  427. {
  428. new INI:File = INI_Open(UserPath(playerid));
  429. INI_SetTag(File, "account");
  430. INI_WriteString(File, "Password", inputtext, 255);
  431. INI_Close(File);
  432. ShowPlayerDialog(playerid, D_R_Mail, DIALOG_STYLE_INPUT, ""C_T_DialogTitle"New City Roleplay"C_T_Default": Mail", ""C_T_Default"Welcome to "C_T_DialogTitle"New City"C_T_Default": Roleplay.\nPlease enter your mail in order to be able to confirm your account within 7 days.", "Contine", "Exit");
  433. }
  434. else
  435. {
  436. ShowPlayerDialog(playerid, D_R_Password, DIALOG_STYLE_PASSWORD, ""C_T_DialogTitle"New City Roleplay"C_T_Default": Register", ""C_T_Default"Welcome to "C_T_DialogTitle"New City"C_T_Default": Roleplay.\nWe noticed that you're a new user.\nTo contine enter your password.\n\n"C_T_Error"You didn't enter a password.", "Contine", "Quit");
  437. }
  438. }
  439. else
  440. {
  441. KickPlayer(playerid, "\"Pressed Exit on Register.\"");
  442. }
  443. }
  444.  
  445. stock lr_D_R_Mail(playerid, response, inputtext[])
  446. {
  447. if(response)
  448. {
  449. if(!isnull(inputtext))
  450. {
  451. if(strfind(inputtext, "@", true) != -1)
  452. {
  453. if(strfind(inputtext, ".", true) != -1)
  454. {
  455. new INI:File = INI_Open(UserPath(playerid));
  456. INI_SetTag(File, "account");
  457. INI_WriteString(File, "Mail", inputtext, 255);
  458. INI_Close(File);
  459. ShowPlayerDialog(playerid, D_R_C_Age, DIALOG_STYLE_INPUT, ""C_T_DialogTitle"New City Roleplay"C_T_Default": Character Age", ""C_T_Default"Welcome to "C_T_DialogTitle"New City"C_T_Default": Roleplay.\nHow old are your character? He/she must be over 17 and under 60.", "Contine", "Exit");
  460. }
  461. else
  462. {
  463. ShowPlayerDialog(playerid, D_R_Mail, DIALOG_STYLE_INPUT, ""C_T_DialogTitle"New City Roleplay"C_T_Default": Mail", ""C_T_Default"Welcome to "C_T_DialogTitle"New City"C_T_Default": Roleplay.\nPlease enter your mail in order to be able to confirm your account within 7 days.\n\n"C_T_Error"You entered a invalid mail.", "Contine", "Exit");
  464. }
  465. }
  466. else
  467. {
  468. ShowPlayerDialog(playerid, D_R_Mail, DIALOG_STYLE_INPUT, ""C_T_DialogTitle"New City Roleplay"C_T_Default": Mail", ""C_T_Default"Welcome to "C_T_DialogTitle"New City"C_T_Default": Roleplay.\nPlease enter your mail in order to be able to confirm your account within 7 days.\n\n"C_T_Error"You entered a invalid mail.", "Contine", "Exit");
  469. }
  470. }
  471. else
  472. {
  473. ShowPlayerDialog(playerid, D_R_Mail, DIALOG_STYLE_INPUT, ""C_T_DialogTitle"New City Roleplay"C_T_Default": Mail", ""C_T_Default"Welcome to "C_T_DialogTitle"New City"C_T_Default": Roleplay.\nPlease enter your mail in order to be able to confirm your account within 7 days.\n\n"C_T_Error"You didn't enter a mail.", "Contine", "Exit");
  474. }
  475. }
  476. else
  477. {
  478. KickPlayer(playerid, "\"Pressed Exit on Mail.\"");
  479. }
  480. }
  481.  
  482. stock lr_D_R_C_Age(playerid, response, inputtext[])
  483. {
  484. if(response)
  485. {
  486. if(!isnull(inputtext))
  487. {
  488. if(inputtext > 16 || inputtext < 61)
  489. {
  490. new INI:File = INI_Open(UserPath(playerid));
  491. INI_SetTag(File, "character");
  492. INI_WriteInt(File, "Age", inputtext);
  493. INI_Close(File);
  494. ShowPlayerDialog(playerid, D_R_C_Gender, DIALOG_STYLE_MSGBOX, ""C_T_DialogTitle"New City Roleplay"C_T_Default": Character Gender", ""C_T_Default"Welcome to "C_T_DialogTitle"New City"C_T_Default": Roleplay.\nPlease press your characters gender.", "Male", "Female");
  495. }
  496. else
  497. {
  498. ShowPlayerDialog(playerid, D_R_C_Age, DIALOG_STYLE_INPUT, ""C_T_DialogTitle"New City Roleplay"C_T_Default": Character Age", ""C_T_Default"Welcome to "C_T_DialogTitle"New City"C_T_Default": Roleplay.\nHow old are your character? He/she must be over 17 and under 60.\n\nYou didn't enter an age!", "Contine", "Exit");
  499. }
  500. }
  501. else
  502. {
  503. ShowPlayerDialog(playerid, D_R_C_Age, DIALOG_STYLE_INPUT, ""C_T_DialogTitle"New City Roleplay"C_T_Default": Character Age", ""C_T_Default"Welcome to "C_T_DialogTitle"New City"C_T_Default": Roleplay.\nHow old are your character? He/she must be over 17 and under 60.\n\n"C_T_Error"You forgot to enter an age.", "Contine", "Exit");
  504. }
  505. }
  506. else
  507. {
  508. KickPlayer(playerid, "\"Pressed Exit on Character Age.\"");
  509. }
  510. }
  511.  
  512. stock D_R_C_Gender(playerid, response)
  513. {
  514. if(response)
  515. {
  516. new INI:File = INI_Open(UserPath(playerid));
  517. INI_SetTag(File, "character");
  518. INI_WriteInt(File, "Gender", 1);
  519. INI_Close(File);
  520. ShowPlayerDialog(playerid, D_R_C_Origin, DIALOG_STYLE_INPUT, ""C_T_DialogTitle"New City Roleplay"C_T_Default": Character Origin", ""C_T_Default"Welcome to "C_T_DialogTitle"New City"C_T_Default": Roleplay.\nPlease enter your characters origin, Basically where he was born.", "Contine", "Exit");
  521. }
  522. else
  523. {
  524. new INI:File = INI_Open(UserPath(playerid));
  525. INI_SetTag(File, "character");
  526. INI_WriteInt(File, "Gender", 2);
  527. INI_Close(File);
  528. ShowPlayerDialog(playerid, D_R_C_Origin, DIALOG_STYLE_INPUT, ""C_T_DialogTitle"New City Roleplay"C_T_Default": Character Origin", ""C_T_Default"Welcome to "C_T_DialogTitle"New City"C_T_Default": Roleplay.\nPlease enter your characters origin, Basically where she was born.", "Contine", "Exit");
  529. }
  530. }
  531.  
  532. stock lr_D_R_C_Origin(playerid, response, inputtext[])
  533. {
  534. if(response)
  535. {
  536. if(!isnull(inputtext))
  537. {
  538. new INI:File = INI_Open(UserPath(playerid));
  539. INI_SetTag(File, "character");
  540. INI_WriteString(File, "Origin", inputtext);
  541. INI_Close(File);
  542. ShowPlayerDialog(playerid, D_R_C_Accent, DIALOG_STYLE_INPUT, ""C_T_DialogTitle"New City Roleplay"C_T_Default": Character Accent", ""C_T_Default"Welcome to "C_T_DialogTitle"New City"C_T_Default": Roleplay.\nPlease enter your characters accent, Basically the way they speak.", "Contine", "Exit");
  543. }
  544. else
  545. {
  546. ShowPlayerDialog(playerid, D_R_C_Origin, DIALOG_STYLE_INPUT, ""C_T_DialogTitle"New City Roleplay"C_T_Default": Character Origin", ""C_T_Default"Welcome to "C_T_DialogTitle"New City"C_T_Default": Roleplay.\nPlease enter your characters origin, Basically where he/she was born.\n\n"C_T_Error"You forgot to insert the place of birth.", "Contine", "Exit");
  547. }
  548. }
  549. else
  550. {
  551. KickPlayer(playerid, "\"Pressed Exit on Character Origin.\"");
  552. }
  553. }
  554.  
  555. stock D_R_C_Accent(playerid, response, inputtext[])
  556. {
  557. if(response)
  558. {
  559. if(!isnull(inputtext))
  560. {
  561. new INI:File = INI_Open(UserPath(playerid));
  562. INI_SetTag(File, "character");
  563. INI_WriteString(File, "Accent", inputtext);
  564. INI_Close(File);
  565. TogglePlayerSpectating(playerid, 0);
  566. SpawnPlayer(playerid);
  567. PlayerTextDrawShow(playerid, Background);
  568. PlayerTextDrawShow(playerid, Loading);
  569. PlayerTextDrawShow(playerid, NewCity);
  570. PlayerTextDrawShow(playerid, Roleplay);
  571. SetTimerEx("EndLoadingScreen30", 3500, false, "i", playerid);
  572. SetPlayerPos(playerid, 1743.1300, -1861.9683, 13.5769);
  573. SetPlayerFacingAngle(playerid, 359.2573);
  574. GivePlayerMoney(playerid, 25000);
  575. }
  576. else
  577. {
  578. ShowPlayerDialog(playerid, D_R_C_Accent, DIALOG_STYLE_INPUT, ""C_T_DialogTitle"New City Roleplay"C_T_Default": Character Accent", ""C_T_Default"Welcome to "C_T_DialogTitle"New City"C_T_Default": Roleplay.\nPlease enter your characters accent, Basically the way they speak.\n\n"C_T_Error"You forgot to enter the accent.", "Contine", "Exit");
  579. }
  580. }
  581. else
  582. {
  583. KickPlayer(playerid, "\"Pressed Exit on Character Accent.\"");
  584. }
  585. }
  586.  
  587. forward EndLoadingScreen30(playerid);
  588.  
  589. public EndLoadingScreen30(playerid)
  590. {
  591. PlayerTextDrawHide(playerid, Background);
  592. PlayerTextDrawHide(playerid, Loading);
  593. PlayerTextDrawHide(playerid, NewCity);
  594. PlayerTextDrawHide(playerid, Roleplay);
  595. if(Player[playerid][pGender] == 2)
  596. {
  597. //ShowPlayerDialog(playerid, 0, DIALOG_STYLE_PREVMODEL, "DIALOG_STYLE_PREVMODEL_LIST - skin selection test", "9\n \n10\n \n11\n \n12\n \n13\n \n31\n \n39\n \n40\n \n41\n \n53\n \n54\n \n55\n \n56\n \n63\n \n64\n \n65\n \n69\n \n75\n \n76\n \n77\n \n85\n \n87\n \n88\n \n89\n \n90\n \n91\n \n92\n \n93\n \n129\n \n130\n \n131\n \n141\n \n", "Select", "");
  598. }
  599. else
  600. {
  601.  
  602. }
  603. return 1;
  604. }
  605.  
  606. forward EndLoadingScreen20(playerid);
  607.  
  608. public EndLoadingScreen20(playerid)
  609. {
  610. PlayerTextDrawHide(playerid, Background);
  611. PlayerTextDrawHide(playerid, Loading);
  612. PlayerTextDrawHide(playerid, NewCity);
  613. PlayerTextDrawHide(playerid, Roleplay);
  614. return 1;
  615. }
  616. //----------------------------------------------------------------------------//
  617. /****************************************************************************/
  618. //----------------------------------------------------------------------------//
  619.  
  620. //----------------------------------------------------------------------------//
  621. /****************************************************************************/
  622. // CMD: mm //
  623. /****************************************************************************/
  624. //----------------------------------------------------------------------------//
  625. CMD:jetpack(playerid)
  626. {
  627. SetPlayerSpecialAction(playerid,SPECIAL_ACTION_USEJETPACK);
  628. return 1;
  629. }
  630. //----------------------------------------------------------------------------//
  631. /****************************************************************************/
  632. //----------------------------------------------------------------------------//
  633.  
  634. //----------------------------------------------------------------------------//
  635. /****************************************************************************/
  636. // KickPlayer //
  637. /****************************************************************************/
  638. //----------------------------------------------------------------------------//
  639. stock KickPlayer(playerid, reason[])
  640. {
  641. new logfile[255], logtext[255], dialogtext[255];
  642. format(logfile, 255, "%s/log.txt", playername(playerid));
  643. format(logtext, 255, "%s was kicked from the server of: %s.", playername(playerid), reason);
  644. WriteLog(logfile, logtext);
  645. format(dialogtext, 255, ""C_T_Default"You have been kicked from the server as of %s.\n\n"C_T_Error"You won't be able to login again within 5minutes.", reason);
  646. ShowPlayerDialog(playerid, D_Username, DIALOG_STYLE_INPUT, ""C_T_DialogTitle"New City Roleplay"C_T_Default": Notice", dialogtext, "Quit", "");
  647. SetTimerEx("Kicked", 1000, false, "i", playerid);
  648. }
  649.  
  650. forward Kicked(playerid);
  651.  
  652. public Kicked(playerid)
  653. {
  654. Kick(playerid);
  655. return 1;
  656. }
  657. //----------------------------------------------------------------------------//
  658. /****************************************************************************/
  659. //----------------------------------------------------------------------------//
  660.  
  661.  
  662.  
  663. //----------------------------------------------------------------------------//
  664. /****************************************************************************/
  665. // Player Command Log //
  666. /****************************************************************************/
  667. //----------------------------------------------------------------------------//
  668. public OnPlayerCommandPerformed(playerid, cmdtext[], success)
  669. {
  670. if(success)
  671. {
  672. new logfile[255], logtext[255];
  673. format(logfile, 255, "%s/log_commands.txt", playername(playerid));
  674. format(logtext, 255, "%s used %s", playername(playerid), cmdtext);
  675. WriteLog(logfile, logtext);
  676. }
  677. else
  678. {
  679. SendClientMessage(playerid, C_Default, "["C_T_Error"Error"C_T_Default"] That command doesn't exist, You can use /mm or /commands for help.");
  680. }
  681. return 1;
  682. }
  683. //----------------------------------------------------------------------------//
  684. /****************************************************************************/
  685. //----------------------------------------------------------------------------//
  686.  
  687. //----------------------------------------------------------------------------//
  688. /****************************************************************************/
  689. // WriteLog //
  690. /****************************************************************************/
  691. //----------------------------------------------------------------------------//
  692. stock WriteLog(logfile[], text[])
  693. {
  694. new File:handle = fopen(logfile, io_append);
  695. if(handle)
  696. {
  697. new logtext[255], Hour, Minute, Second;
  698. gettime(Hour, Minute, Second);
  699. format(logtext, 255, "[%02d:%02d:%02d] %s\r\n", Hour, Minute, Second, text);
  700. fwrite(handle, logtext);
  701. fclose(handle);
  702. }
  703. else
  704. {
  705. print("WARNING, WriteLog failed.");
  706. }
  707. }
  708. //----------------------------------------------------------------------------//
  709. /****************************************************************************/
  710. //----------------------------------------------------------------------------//
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement