Guest User

Untitled

a guest
Jun 21st, 2010
165
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 30.65 KB | None | 0 0
  1. // This is a comment
  2. // uncomment the line below if you want to write a filterscript
  3. //#define FILTERSCRIPT
  4. #include <a_samp>
  5. #include <dini>
  6. #include <dudb>
  7.  
  8. stock IsValidSkin(skinid)
  9. {
  10. if (skinid < 0 || skinid > 299)
  11. return 0;
  12.  
  13. switch (skinid)
  14. {
  15. case
  16. 3, 4, 5, 6, 8, 42, 65, 74,
  17. 86, 119, 149, 208, 273, 289: return 0;
  18. }
  19.  
  20. return 1;
  21. }
  22. #define eadmin 0x33660000
  23. #define COLOR_ASKQ 0xFF0000FF
  24. #define CHECKPOINT_HOME 12
  25. #define COLOR_GRAD1 0xB4B5B7FF
  26. #define COLOR_GRAD2 0xBFC0C2FF
  27. #define COLOR_GRAD3 0xCBCCCEFF
  28. #define COLOR_GRAD4 0xD8D8D8FF
  29. #define COLOR_GRAD5 0xE3E3E3FF
  30. #define COLOR_GRAD6 0xF0F0F0FF
  31. #define COLOR_GREY 0xAFAFAFAA
  32. #define COLOR_GREEN 0x9EC73DAA
  33. #define COLOR_GROVE 0x00FF00FF
  34. #define COLOR_RED 0xAA3333AA
  35. #define COLOR_COOLRED 0xB35959AA
  36. #define COLOR_ORANGE 0xFF9900AA
  37. #define COLOR_PINK 0xFF66FFAA
  38. #define COLOR_DARKRED 0x660000AA
  39. #define COLOR_BRIGHTRED 0xFF0000AA
  40. #define COLOR_INDIGO 0x4B00B0AA
  41. #define COLOR_VIOLET 0x9955DEEE
  42. #define COLOR_GRAYWHITE 0xEEEEFFC4
  43. #define COLOR_LIGHTNEUTRALBLUE 0xabcdef66
  44. #define COLOR_GREENISHGOLD 0xCCFFDD56
  45. #define COLOR_LIGHTBLUEGREEN 0x0FFDD349
  46. #define COLOR_NEUTRALBLUE 0xABCDEF01
  47. #define COLOR_LIGHTCYAN 0xAAFFCC33
  48. #define COLOR_LEMON 0xDDDD2357
  49. #define COLOR_LIGHTRED 0xFF6347AA
  50. #define COLOR_LIGHTBLUE 0x33CCFFAA
  51. #define COLOR_LIGHTGREEN 0x9ACD32AA
  52. #define COLOR_YELLOW 0xDABB3EAA
  53. #define COLOR_YELLOW2 0xF5DEB3AA
  54. #define COLOR_WHITE 0xFFFFFFAA
  55. #define COLOR_FADE1 0xE6E6E6E6
  56. #define COLOR_FADE2 0xC8C8C8C8
  57. #define COLOR_FADE3 0xAAAAAAAA
  58. #define COLOR_FADE4 0x8C8C8C8C
  59. #define COLOR_FADE5 0x6E6E6E6E
  60. #define COLOR_PURPLE 0xC2A2DAAA
  61. #define COLOR_CHAT1 0xF9B7FFAA
  62. #define COLOR_CHAT2 0xE6A9ECAA
  63. #define COLOR_CHAT3 0xC38EC7AA
  64. #define COLOR_CHAT4 0xD2B9D3AA
  65. #define COLOR_CHAT5 0xC6AEC7AA
  66. #define COLOR_ALLDEPT 0xFF8282AA
  67. #define COLOR_NEWS 0x458E1DAA
  68. #define COLOR_OOC 0xE0FFFFAA
  69. #define TEAM_CYAN 1
  70. #define TEAM_BLUE 2
  71. #define TEAM_GREEN 3
  72. #define TEAM_ORANGE 4
  73. #define TEAM_COR 5
  74. #define TEAM_BAR 6
  75. #define TEAM_TAT 7
  76. #define TEAM_CUN 8
  77. #define TEAM_STR 9
  78. #define TEAM_HIT 10
  79. #define TEAM_ADMIN 11
  80. #define OBJECTIVE_COLOR 0x64000064
  81. #define TEAM_GREEN_COLOR 0xFFFFFFAA
  82. #define TEAM_JOB_COLOR 0xFFB6C1AA
  83. #define TEAM_HIT_COLOR 0xFFFFFF00
  84. #define TEAM_BLUE_COLOR 0x8D8DFF00
  85. #define TEAM_RADIO_COLOR 0xF2D068FF
  86. #define COLOR_ADD 0x63FF60AA
  87. #define TEAM_GROVE_COLOR 0x00D900C8
  88. #define TEAM_VAGOS_COLOR 0xFFC801C8
  89. #define TEAM_BALLAS_COLOR 0xD900D3C8
  90. #define TEAM_AZTECAS_COLOR 0x01FCFFC8
  91. #define TEAM_CYAN_COLOR 0xFF8282AA
  92. #define TEAM_ORANGE_COLOR 0xFF830000
  93. #define TEAM_COR_COLOR 0x39393900
  94. #define TEAM_BAR_COLOR 0x00D90000
  95. #define TEAM_TAT_COLOR 0xBDCB9200
  96. #define TEAM_CUN_COLOR 0xD900D300
  97. #define TEAM_STR_COLOR 0x01FCFF00
  98. #define TEAM_ADMIN_COLOR 0x00808000
  99. #define COLOR_SEA 0x00808000
  100. #define COLOR_INVIS 0xAFAFAF00
  101. #define COLOR_SPEC 0xBFC0C200
  102. new file[256];
  103. new Float:positionx;
  104. new Float:positiony;
  105. new Float:positionz;
  106. forward Testing(playerid);
  107. ReturnUser(text[], playerid = INVALID_PLAYER_ID)
  108. {
  109. new pos = 0;
  110. while (text[pos] < 0x21) // Strip out leading spaces
  111. {
  112. if (text[pos] == 0) return INVALID_PLAYER_ID; // No passed text
  113. pos++;
  114. }
  115. new userid = INVALID_PLAYER_ID;
  116. if (IsNumeric(text[pos])) // Check whole passed string
  117. {
  118. // If they have a numeric name you have a problem (although names are checked on id failure)
  119. userid = strval(text[pos]);
  120. if (userid >=0 && userid < MAX_PLAYERS)
  121. {
  122. if(!IsPlayerConnected(userid))
  123. {
  124. /*if (playerid != INVALID_PLAYER_ID)
  125. {
  126. SendClientMessage(playerid, 0xFF0000AA, "User not connected");
  127. }*/
  128. userid = INVALID_PLAYER_ID;
  129. }
  130. else
  131. {
  132. return userid; // A player was found
  133. }
  134. }
  135. /*else
  136. {
  137. if (playerid != INVALID_PLAYER_ID)
  138. {
  139. SendClientMessage(playerid, 0xFF0000AA, "Invalid user ID");
  140. }
  141. userid = INVALID_PLAYER_ID;
  142. }
  143. return userid;*/
  144. // Removed for fallthrough code
  145. }
  146. // They entered [part of] a name or the id search failed (check names just incase)
  147. new len = strlen(text[pos]);
  148. new count = 0;
  149. new name[MAX_PLAYER_NAME];
  150. for (new i = 0; i < MAX_PLAYERS; i++)
  151. {
  152. if (IsPlayerConnected(i))
  153. {
  154. GetPlayerName(i, name, sizeof (name));
  155. if (strcmp(name, text[pos], true, len) == 0) // Check segment of name
  156. {
  157. if (len == strlen(name)) // Exact match
  158. {
  159. return i; // Return the exact player on an exact match
  160. // Otherwise if there are two players:
  161. // Me and MeYou any time you entered Me it would find both
  162. // And never be able to return just Me's id
  163. }
  164. else // Partial match
  165. {
  166. count++;
  167. userid = i;
  168. }
  169. }
  170. }
  171. }
  172. if (count != 1)
  173. {
  174. if (playerid != INVALID_PLAYER_ID)
  175. {
  176. if (count)
  177. {
  178. SendClientMessage(playerid, 0xFF0000AA, "Multiple users found, please narrow earch");
  179. }
  180. else
  181. {
  182. SendClientMessage(playerid, 0xFF0000AA, "No matching user found");
  183. }
  184. }
  185. userid = INVALID_PLAYER_ID;
  186. }
  187. return userid; // INVALID_USER_ID for bad return
  188. }
  189. IsNumeric(const string[])
  190. {
  191. for (new i = 0, j = strlen(string); i < j; i++)
  192. {
  193. if (string[i] > '9' || string[i] < '0') return 0;
  194. }
  195. return 1;
  196. }
  197. public Testing(playerid)
  198. {
  199. SetPlayerPos(playerid, -69.0184,565.1793,-1.0729);
  200. SetPlayerCameraPos(playerid, -175.2453,823.6674,59.7646);
  201. ShowPlayerDialog(playerid, 1, DIALOG_STYLE_MSGBOX, "Welcome to Blank RP!", "This is an RP server. That being said, in order\n to play here, you must know how to RP.\n If you are new to RP, please select 'new'.\n If you already know how to RP, select 'not new'.", "New", "Not New");
  202. TogglePlayerControllable(playerid, 0);
  203. }
  204.  
  205.  
  206. new IsLogged[MAX_PLAYERS];
  207. new WrongTestAnswers[MAX_PLAYERS];
  208.  
  209. enum pInfo
  210. {
  211. AdminLevel,
  212. Cash,
  213. Kills,
  214. Deaths,
  215. Faction,
  216. Family,
  217. Test,
  218. Gender,
  219. Skin,
  220. }
  221. new PlayerInfo[MAX_PLAYERS][pInfo];
  222. #if defined FILTERSCRIPT
  223.  
  224. public OnFilterScriptInit()
  225. {
  226. print("\n--------------------------------------");
  227. print(" Blank Filterscript by your name here");
  228. print("--------------------------------------\n");
  229. return 1;
  230. }
  231.  
  232. public OnFilterScriptExit()
  233. {
  234. return 1;
  235. }
  236.  
  237. #else
  238.  
  239. main()
  240. {
  241. print("\n----------------------------------");
  242. print(" Blank Gamemode by your name here");
  243. print("----------------------------------\n");
  244. }
  245.  
  246. #endif
  247.  
  248. public OnGameModeInit()
  249. {
  250. // Don't use these lines if it's a filterscript
  251. SetGameModeText("Blank Script");
  252. AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
  253. return 1;
  254. }
  255.  
  256. public OnGameModeExit()
  257. {
  258. return 1;
  259. }
  260.  
  261. public OnPlayerRequestClass(playerid, classid)
  262. {
  263. SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
  264. SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
  265. SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
  266. return 1;
  267. }
  268.  
  269. public OnPlayerConnect(playerid)
  270. {
  271. SendClientMessage(playerid, 0xFFFFFFFF, "Welcome to Blank RP. If you have an exiting account, /login. Otherwise, /register.");
  272. IsLogged[playerid] = 0;
  273. return 1;
  274. }
  275. SavePos(playerid)
  276. {
  277. dini_IntSet(file, "PositionX", floatround(positionx));
  278. dini_IntSet(file, "PositionY", floatround(positiony));
  279. dini_IntSet(file, "PositionZ", floatround(positionz));
  280. }
  281. public OnPlayerDisconnect(playerid, reason)
  282. {
  283. IsLogged[playerid] = 0;
  284. new Float:x;
  285. new Float:y;
  286. new Float:z;
  287.  
  288.  
  289.  
  290.  
  291.  
  292. GetPlayerPos(playerid,x,y,z);
  293. positionx = x;
  294. positiony = y;
  295. positionz = z;
  296.  
  297. SavePos(playerid);
  298.  
  299.  
  300. return 1;
  301. }
  302.  
  303. public OnPlayerSpawn(playerid)
  304. {
  305. if(IsLogged[playerid] != 1) { return SendClientMessage(playerid, 0xFFFFFFFF, "You have not logged in yet, so you may not spawn!"); }
  306. {
  307. if(PlayerInfo[playerid][Test] == 1)
  308. {
  309. Testing(playerid);
  310. }
  311. else if(PlayerInfo[playerid][Test] != 1)
  312. {
  313. SetPlayerPos(playerid,positionx,positiony,positionz);
  314. }
  315. }
  316.  
  317. return 1;
  318. }
  319.  
  320. public OnPlayerDeath(playerid, killerid, reason)
  321. {
  322. return 1;
  323. }
  324.  
  325. public OnVehicleSpawn(vehicleid)
  326. {
  327. return 1;
  328. }
  329.  
  330. public OnVehicleDeath(vehicleid, killerid)
  331. {
  332. return 1;
  333. }
  334.  
  335. public OnPlayerText(playerid, text[])
  336. {
  337. return 1;
  338. }
  339.  
  340. public OnPlayerCommandText(playerid, cmdtext[])
  341. {
  342.  
  343. new cmd[256], idx, file[128], tmp[256], tmp2[256];
  344. cmd = strtok(cmdtext, idx);
  345. if(strcmp(cmd, "/makeadmin", true) == 0)
  346. {
  347. new string[128];
  348. new tmp[256];
  349. new player[MAX_PLAYER_NAME], giveplayer[MAX_PLAYER_NAME];
  350. new giveplayerid;
  351. if(PlayerInfo[playerid][AdminLevel] > 1336)
  352. {
  353. tmp = strtok(cmdtext, idx);
  354. if(!strlen(tmp))
  355. {
  356. SendClientMessage(playerid, COLOR_GRAD1, "/makeadmin [playerid] [admin level]");
  357. return 1;
  358. }
  359. giveplayerid = ReturnUser(tmp);
  360. tmp = strtok(cmdtext, idx);
  361. new level = strval(tmp);
  362. if(giveplayerid != INVALID_PLAYER_ID)
  363. {
  364.  
  365. GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
  366. GetPlayerName(playerid, player, sizeof(player));
  367. PlayerInfo[giveplayerid][AdminLevel] = level;
  368. printf("Admin %s made %s a level %d admin.", player, giveplayer, level);
  369. format(string, sizeof(string), "You are now an administrator level %d thanks to %s.", level, player);
  370. SendClientMessage(giveplayerid, 0x00C2ECFF, string);
  371. format(string, sizeof(string), "You have given %s level %d admin.", giveplayer,PlayerInfo[giveplayerid][AdminLevel]);
  372. SendClientMessage(playerid, 0x00C2ECFF, string);
  373. }
  374. else if(giveplayerid == INVALID_PLAYER_ID)
  375. {
  376. format(string, sizeof(string), "%i is not an active player.", giveplayerid);
  377. SendClientMessage(playerid, 0xE60000FF, string);
  378. }
  379. }
  380. else
  381. {
  382. SendClientMessage(playerid, 0xE60000FF, "You are not a lead admin!");
  383. }
  384. return 1;
  385. }
  386. if(strcmp(cmd, "/register", true) == 0)
  387. {
  388. new name[MAX_PLAYER_NAME];
  389. tmp = strtok(cmdtext, idx);
  390. GetPlayerName(playerid, name, sizeof(name));
  391. if(strlen(tmp) == 0) return SendClientMessage(playerid, 0xFFFFFFFF, "USAGE: /register [password]");
  392. format(file,sizeof(file),"%s.ini",name);
  393. if(!fexist(file))
  394. {
  395. dini_Create(file);
  396. dini_IntSet(file, "Password", udb_hash(tmp));
  397. dini_IntSet(file,"AdminLevel", 0);
  398. dini_IntSet(file,"Cash", 0);
  399. dini_IntSet(file,"Faction", 0);
  400. dini_IntSet(file,"Family", 0);
  401. dini_IntSet(file,"Kills", 0);
  402. dini_IntSet(file,"Deaths", 0);
  403. dini_IntSet(file,"Test", 1);
  404. dini_IntSet(file,"Skin", 0);
  405. dini_IntSet(file, "PositionX", floatround(positionx));
  406. dini_IntSet(file, "PositionY", floatround(positiony));
  407. dini_IntSet(file, "PositionZ", floatround(positionz));
  408. SendClientMessage(playerid, eadmin, "[System]: Account Created!");
  409. PlayerPlaySound(playerid,1057,0.0,0.0,0.0);
  410. GetPlayerName(playerid, name, sizeof(name));
  411. printf("%s has registered a account!", name);
  412. }
  413. else
  414. {
  415. SendClientMessage(playerid, COLOR_GRAD1, "An account with this username already exists! Please log in or pick a new name!");
  416. PlayerPlaySound(playerid,1057,0.0,0.0,0.0);
  417. }
  418. return 1;
  419. }
  420. if(strcmp(cmd, "/login", true) == 0)
  421. {
  422. new PlayerName[24];
  423. tmp = strtok(cmdtext, idx);
  424. if(strlen(tmp) == 0) return SendClientMessage(playerid, 0xFFFFFFFF, "USAGE: /login [password]");
  425. new name[MAX_PLAYER_NAME];
  426. if(IsLogged[playerid] == 1)
  427. {
  428. SendClientMessage(playerid, COLOR_GRAD1, "You already are logged in!");
  429. return 1;
  430. }
  431. else
  432. {
  433. GetPlayerName(playerid, name, sizeof(name));
  434. format(file,sizeof(file),"%s.ini",name);
  435. if(fexist(file))
  436. {
  437. tmp2 = dini_Get(file, "Password");
  438. if(udb_hash(tmp) != strval(tmp2))
  439. {
  440. SendClientMessage(playerid, COLOR_GRAD1, "Incorrect password!");
  441. GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
  442. printf("%s has failed to login.", name);
  443. }
  444. else
  445. {
  446. IsLogged[playerid] = 1;
  447. SetPlayerMoney(playerid, dini_Int(file, "Cash"));
  448. PlayerInfo[playerid][AdminLevel] = dini_Int(file, "AdminLevel");
  449. PlayerInfo[playerid][Test] = dini_Int(file, "Test");
  450. SetPlayerSkin(playerid, dini_Int(file, "Skin"));
  451. SendClientMessage(playerid, COLOR_GRAD1, "Thank you for logging in. You may now spawn!");
  452. }
  453. }
  454. }
  455. return 1;
  456. }
  457. return 0;
  458. }
  459.  
  460. public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
  461. {
  462. return 1;
  463. }
  464.  
  465. public OnPlayerExitVehicle(playerid, vehicleid)
  466. {
  467. return 1;
  468. }
  469.  
  470. public OnPlayerStateChange(playerid, newstate, oldstate)
  471. {
  472. return 1;
  473. }
  474.  
  475. public OnPlayerEnterCheckpoint(playerid)
  476. {
  477. return 1;
  478. }
  479.  
  480. public OnPlayerLeaveCheckpoint(playerid)
  481. {
  482. return 1;
  483. }
  484.  
  485. public OnPlayerEnterRaceCheckpoint(playerid)
  486. {
  487. return 1;
  488. }
  489.  
  490. public OnPlayerLeaveRaceCheckpoint(playerid)
  491. {
  492. return 1;
  493. }
  494.  
  495. public OnRconCommand(cmd[])
  496. {
  497. return 1;
  498. }
  499.  
  500. public OnPlayerRequestSpawn(playerid)
  501. {
  502. return 1;
  503. }
  504.  
  505. public OnObjectMoved(objectid)
  506. {
  507. return 1;
  508. }
  509.  
  510. public OnPlayerObjectMoved(playerid, objectid)
  511. {
  512. return 1;
  513. }
  514.  
  515. public OnPlayerPickUpPickup(playerid, pickupid)
  516. {
  517. return 1;
  518. }
  519.  
  520. public OnVehicleMod(playerid, vehicleid, componentid)
  521. {
  522. return 1;
  523. }
  524.  
  525. public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
  526. {
  527. return 1;
  528. }
  529.  
  530. public OnVehicleRespray(playerid, vehicleid, color1, color2)
  531. {
  532. return 1;
  533. }
  534.  
  535. public OnPlayerSelectedMenuRow(playerid, row)
  536. {
  537. return 1;
  538. }
  539.  
  540. public OnPlayerExitedMenu(playerid)
  541. {
  542. return 1;
  543. }
  544.  
  545. public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
  546. {
  547. return 1;
  548. }
  549.  
  550. public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
  551. {
  552. return 1;
  553. }
  554.  
  555. public OnRconLoginAttempt(ip[], password[], success)
  556. {
  557. return 1;
  558. }
  559.  
  560. public OnPlayerUpdate(playerid)
  561. {
  562. return 1;
  563. }
  564.  
  565. public OnPlayerStreamIn(playerid, forplayerid)
  566. {
  567. return 1;
  568. }
  569.  
  570. public OnPlayerStreamOut(playerid, forplayerid)
  571. {
  572. return 1;
  573. }
  574.  
  575. public OnVehicleStreamIn(vehicleid, forplayerid)
  576. {
  577. return 1;
  578. }
  579.  
  580. public OnVehicleStreamOut(vehicleid, forplayerid)
  581. {
  582. return 1;
  583. }
  584.  
  585. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  586. {
  587. if(dialogid == 1)
  588. {
  589. if(response == 1)
  590. {
  591. ShowPlayerDialog(playerid, 3, DIALOG_STYLE_MSGBOX, "Tutorial", "You have selected you are a new player.\nYou will now be shown a short tutorial about RP.\nPay attention, it will help you greatly in succeeding on the server!", "Continue", "Cancel");
  592. }
  593. if(response == 0)
  594. {
  595. ShowPlayerDialog(playerid, 2, DIALOG_STYLE_LIST, "1. What is RP?", "A. Taking on the role of a character.\nB. Killing everyone to get the highest score.\nC. None of the above.\nD. I don't know", "Select", "Cancel");
  596. }
  597. }
  598. if(dialogid == 2) // If the dialogid is 1 (our dialog) and they pressed 'Purchase'
  599. {
  600. if(response == 1)
  601. {
  602. switch(listitem)
  603. {
  604. case 0:
  605. {
  606. SendClientMessage(playerid, COLOR_GRAD1, "Correct, on to question number 2!");
  607. ShowPlayerDialog(playerid, 4, DIALOG_STYLE_LIST, "2. What is DM?", "A. Dead Man, an exploit to run around while dead.\nB. Deed Making, making fake deeds.\nC. Death Matching, killing without proper IC reason.\nD. I don't know.", "Select", "Cancel");
  608. }
  609. case 1:
  610. {
  611. WrongTestAnswers[playerid] ++;
  612. SendClientMessage(playerid, COLOR_YELLOW, "Wrong answer! If you get one more answer wrong, you will be kicked and forced to restart.");
  613. ShowPlayerDialog(playerid, 2, DIALOG_STYLE_LIST, "1. What is RP?", "A. Taking on the role of a character.\nB. Killing everyone to get the highest score.\nC. None of the above.\nD. I don't know", "Select", "Cancel");
  614. }
  615. case 2:
  616. {
  617. WrongTestAnswers[playerid] ++;
  618. SendClientMessage(playerid, COLOR_YELLOW, "Wrong answer! If you get one more answer wrong, you will be kicked and forced to restart.");
  619. ShowPlayerDialog(playerid, 2, DIALOG_STYLE_LIST, "1. What is RP?", "A. Taking on the role of a character.\nB. Killing everyone to get the highest score.\nC. None of the above.\nD. I don't know", "Select", "Cancel");
  620. }
  621. case 3:
  622. {
  623. WrongTestAnswers[playerid] ++;
  624. SendClientMessage(playerid, COLOR_YELLOW, "Wrong answer! If you get one more answer wrong, you will be kicked and forced to restart.");
  625. ShowPlayerDialog(playerid, 2, DIALOG_STYLE_LIST, "1. What is RP?", "A. Taking on the role of a character.\nB. Killing everyone to get the highest score.\nC. None of the above.\nD. I don't know", "Select", "Cancel");
  626. }
  627. }
  628. }
  629. else if(response == 0)
  630. {
  631. SendClientMessage(playerid, COLOR_GRAD1, "You must complete the test in order to spawn. You have been kicked for cancelling.");
  632. Kick(playerid);
  633. }
  634. return 1;
  635. }
  636. if(dialogid == 4) // If the dialogid is 1 (our dialog) and they pressed 'Purchase'
  637. {
  638. if(response == 1)
  639. {
  640. switch(listitem)
  641. {
  642. case 0:
  643. {
  644. if(WrongTestAnswers[playerid] > 0)
  645. {
  646. SendClientMessage(playerid, COLOR_GRAD1, "You answered two questions wrong, so you have been kicked.");
  647. Kick(playerid);
  648. }
  649. else if(WrongTestAnswers[playerid] == 0)
  650. {
  651. SendClientMessage(playerid, COLOR_YELLOW, "Wrong answer! If you answer two questions wrong, you will be kicked!");
  652. WrongTestAnswers[playerid] ++;
  653. ShowPlayerDialog(playerid, 4, DIALOG_STYLE_LIST, "2. What is DM?", "A. Dead Man, an exploit to run around while dead.\nB. Deed Making, making fake deeds.\nC. Death Matching, killing without proper IC reason.\nD. I don't know.", "Select", "Cancel");
  654. }
  655. }
  656. case 1:
  657. {
  658. if(WrongTestAnswers[playerid] > 0)
  659. {
  660. SendClientMessage(playerid, COLOR_GRAD1, "You answered two questions wrong, so you have been kicked.");
  661. Kick(playerid);
  662. }
  663. else if(WrongTestAnswers[playerid] == 0)
  664. {
  665. SendClientMessage(playerid, COLOR_YELLOW, "Wrong Answer! If you answer two questions wrong, you will be kicked!");
  666. WrongTestAnswers[playerid] ++;
  667. ShowPlayerDialog(playerid, 4, DIALOG_STYLE_LIST, "2. What is DM?", "A. Dead Man, an exploit to run around while dead.\nB. Deed Making, making fake deeds.\nC. Death Matching, killing without proper IC reason.\nD. I don't know.", "Select", "Cancel");
  668. }
  669. }
  670. case 2:
  671. {
  672. SendClientMessage(playerid, COLOR_GRAD1, "Correct, on to question number 3!");
  673. ShowPlayerDialog(playerid, 5, DIALOG_STYLE_LIST, "3. What is powergaming?", "A. Acting like you have a lot of power.\nB. Doing something impossible/forcing roleplay.\nC. Repeating certain actions over and over.\nD. I don't know.", "Select", "Cancel");
  674. }
  675. case 3:
  676. {
  677. if(WrongTestAnswers[playerid] > 0)
  678. {
  679. SendClientMessage(playerid, COLOR_GRAD1, "You answered two questions wrong, so you have been kicked.");
  680. Kick(playerid);
  681. }
  682. else if(WrongTestAnswers[playerid] == 0)
  683. {
  684. SendClientMessage(playerid, COLOR_YELLOW, "Wrong answer! If you answer two questions wrong, you will be kicked!");
  685. WrongTestAnswers[playerid] ++;
  686. ShowPlayerDialog(playerid, 4, DIALOG_STYLE_LIST, "2. What is DM?", "A. Dead Man, an exploit to run around while dead.\nB. Deed Making, making fake deeds.\nC. Death Matching, killing without proper IC reason.\nD. I don't know.", "Select", "Cancel");
  687. }
  688. }
  689. }
  690. }
  691. else if(response == 0)
  692. {
  693. SendClientMessage(playerid, COLOR_GRAD1, "You must complete the test in order to spawn. You have been kicked for cancelling.");
  694. Kick(playerid);
  695. }
  696. }
  697. if(dialogid == 5) // If the dialogid is 1 (our dialog) and they pressed 'Purchase'
  698. {
  699. if(response == 1)
  700. {
  701. switch(listitem)
  702. {
  703. case 0:
  704. {
  705. if(WrongTestAnswers[playerid] > 0)
  706. {
  707. SendClientMessage(playerid, COLOR_GRAD1, "You answered two questions wrong, so you have been kicked.");
  708. Kick(playerid);
  709. }
  710. else if(WrongTestAnswers[playerid] == 0)
  711. {
  712. SendClientMessage(playerid, COLOR_YELLOW, "Wrong answer! If you answer two questions wrong, you will be kicked!");
  713. WrongTestAnswers[playerid] ++;
  714. ShowPlayerDialog(playerid, 5, DIALOG_STYLE_LIST, "3. What is powergaming?", "A. Acting like you have a lot of power.\nB. Doing something impossible/forcing roleplay.\nC. Repeating certain actions over and over.\nD. I don't know.", "Select", "Cancel");
  715. }
  716. }
  717. case 1:
  718. {
  719. SendClientMessage(playerid, COLOR_GRAD1, "Correct, on to question number 4!");
  720. ShowPlayerDialog(playerid, 6, DIALOG_STYLE_LIST, "4. What is metagaming?", "A. Using OOC information IC.\nB. Alt Tabbing to avoid dying.\nC. Speaking in more than one language at a time.\nD. I don't know.", "Select", "Cancel");
  721. }
  722. case 2:
  723. {
  724. if(WrongTestAnswers[playerid] > 0)
  725. {
  726. SendClientMessage(playerid, COLOR_GRAD1, "You answered two questions wrong, so you have been kicked.");
  727. Kick(playerid);
  728. }
  729. else if(WrongTestAnswers[playerid] == 0)
  730. {
  731. SendClientMessage(playerid, COLOR_YELLOW, "Wrong answer! If you answer two questions wrong, you will be kicked!");
  732. WrongTestAnswers[playerid] ++;
  733. ShowPlayerDialog(playerid, 5, DIALOG_STYLE_LIST, "3. What is powergaming?", "A. Acting like you have a lot of power.\nB. Doing something impossible/forcing roleplay.\nC. Repeating certain actions over and over.\nD. I don't know.", "Select", "Cancel");
  734. }
  735. }
  736. case 3:
  737. {
  738. if(WrongTestAnswers[playerid] > 0)
  739. {
  740. SendClientMessage(playerid, COLOR_GRAD1, "You answered two questions wrong, so you have been kicked.");
  741. Kick(playerid);
  742. }
  743. else if(WrongTestAnswers[playerid] == 0)
  744. {
  745. SendClientMessage(playerid, COLOR_YELLOW, "Wrong answer! If you answer two questions wrong, you will be kicked!");
  746. WrongTestAnswers[playerid] ++;
  747. ShowPlayerDialog(playerid, 5, DIALOG_STYLE_LIST, "3. What is powergaming?", "A. Acting like you have a lot of power.\nB. Doing something impossible/forcing roleplay.\nC. Repeating certain actions over and over.\nD. I don't know.", "Select", "Cancel");
  748. }
  749. }
  750. }
  751. }
  752. else if(response == 0)
  753. {
  754. SendClientMessage(playerid, COLOR_GRAD1, "You must complete the test in order to spawn. You have been kicked for cancelling.");
  755. Kick(playerid);
  756. }
  757. }
  758. if(dialogid == 6) // If the dialogid is 1 (our dialog) and they pressed 'Purchase'
  759. {
  760. if(response == 1)
  761. {
  762. switch(listitem)
  763. {
  764. case 0:
  765. {
  766. ShowPlayerDialog(playerid, 7, DIALOG_STYLE_MSGBOX, "Congratulations!", "You passed the roleplay test. Now, you will\n need to choose a few things about your character.", "Continue", "Cancel");
  767. }
  768. case 1:
  769. {
  770. if(WrongTestAnswers[playerid] > 0)
  771. {
  772. SendClientMessage(playerid, COLOR_GRAD1, "You answered two questions wrong, so you have been kicked.");
  773. Kick(playerid);
  774. }
  775. else if(WrongTestAnswers[playerid] == 0)
  776. {
  777. SendClientMessage(playerid, COLOR_YELLOW, "Wrong answer! If you answer two questions wrong, you will be kicked!");
  778. WrongTestAnswers[playerid] ++;
  779. ShowPlayerDialog(playerid, 6, DIALOG_STYLE_LIST, "4. What is metagaming?", "A. Using OOC information IC.\nB. Alt Tabbing to avoid dying.\nC. Speaking in more than one language at a time.\nD. I don't know.", "Select", "Cancel");
  780. }
  781. }
  782. case 2:
  783. {
  784. if(WrongTestAnswers[playerid] > 0)
  785. {
  786. SendClientMessage(playerid, COLOR_GRAD1, "You answered two questions wrong, so you have been kicked.");
  787. Kick(playerid);
  788. }
  789. else if(WrongTestAnswers[playerid] == 0)
  790. {
  791. SendClientMessage(playerid, COLOR_YELLOW, "Wrong answer! If you answer two questions wrong, you will be kicked!");
  792. WrongTestAnswers[playerid] ++;
  793. ShowPlayerDialog(playerid, 6, DIALOG_STYLE_LIST, "4. What is metagaming?", "A. Using OOC information IC.\nB. Alt Tabbing to avoid dying.\nC. Speaking in more than one language at a time.\nD. I don't know.", "Select", "Cancel");
  794. }
  795. }
  796. case 3:
  797. {
  798. if(WrongTestAnswers[playerid] > 0)
  799. {
  800. SendClientMessage(playerid, COLOR_GRAD1, "You answered two questions wrong, so you have been kicked.");
  801. Kick(playerid);
  802. }
  803. else if(WrongTestAnswers[playerid] == 0)
  804. {
  805. SendClientMessage(playerid, COLOR_YELLOW, "Wrong answer! If you answer two questions wrong, you will be kicked!");
  806. WrongTestAnswers[playerid] ++;
  807. ShowPlayerDialog(playerid, 6, DIALOG_STYLE_LIST, "4. What is metagaming?", "A. Using OOC information IC.\nB. Alt Tabbing to avoid dying.\nC. Speaking in more than one language at a time.\nD. I don't know.", "Select", "Cancel");
  808. }
  809. }
  810. }
  811. }
  812. else if(response == 0)
  813. {
  814. SendClientMessage(playerid, COLOR_GRAD1, "You must complete the test in order to spawn. You have been kicked for cancelling.");
  815. Kick(playerid);
  816. }
  817. }
  818. if(dialogid == 7)
  819. {
  820. if(response == 1)
  821. {
  822. SetPlayerPos(playerid, 257.9030,-40.5248,1002.0234);
  823. SetPlayerInterior(playerid, 14);
  824. SetPlayerCameraPos(playerid, 254.2984,-42.2291,1002.0308);
  825. ShowPlayerDialog(playerid, 8, DIALOG_STYLE_LIST, "Character Details", "Gender\nClothing\nFighting Style\nFinished", "Select", "Cancel");
  826. }
  827. else if(response == 0)
  828. {
  829. SendClientMessage(playerid, COLOR_YELLOW, "You have been kicked for failing to complete the character set up!");
  830. Kick(playerid);
  831. }
  832. }
  833. if(dialogid == 8)
  834. {
  835. if(response == 1)
  836. {
  837. switch(listitem)
  838. {
  839. case 0:
  840. {
  841. ShowPlayerDialog(playerid, 9, DIALOG_STYLE_LIST, "Select Your Gender", "Male\nFemale", "Select", "Back");
  842. }
  843. case 1:
  844. {
  845. ShowPlayerDialog(playerid,10,DIALOG_STYLE_INPUT,"Clothing","Type the skin ID you would like below.","Change","Cancel");
  846. }
  847. case 2:
  848. {
  849. SendClientMessage(playerid, COLOR_WHITE, "Under construction!");
  850. ShowPlayerDialog(playerid, 8, DIALOG_STYLE_LIST, "Character Details", "Gender\nClothing\nFighting Style\nFinished", "Select", "Cancel");
  851. // ShowPlayerDialog(playerid,11,DIALOG_STYLE_LIST, "Choose Your Fighting Style", "Boxing\nKung Fu\nKneehead\nGrabkick\nElbow", "Select", "Back");
  852. }
  853. case 3:
  854. {
  855. PlayerInfo[playerid][Test] = 0;
  856. SetPlayerPos(playerid, -186.8255,977.1414,19.0608);
  857. SetPlayerInterior(playerid, 0);
  858. SetCameraBehindPlayer(playerid);
  859. TogglePlayerControllable(playerid, 1);
  860. SendClientMessage(playerid, COLOR_PURPLE, "** You step off the bus, and take your first step in Fort Carson.");
  861. SendClientMessage(playerid, COLOR_PURPLE, "** All you have is your wallet with your ID and $525.");
  862. GivePlayerMoney(playerid, 525);
  863. }
  864. }
  865. }
  866. else if(response == 0)
  867. {
  868. SendClientMessage(playerid, COLOR_GRAD1, "You have been kicked for failing to complete the character set up.");
  869. Kick(playerid);
  870. }
  871. }
  872. if(dialogid == 9)
  873. {
  874. if(response == 1)
  875. {
  876. switch(listitem)
  877. {
  878. case 0:
  879. {
  880. PlayerInfo[playerid][Gender] = 1;
  881. SendClientMessage(playerid, COLOR_GRAD1, "You have set your gender as male.");
  882. ShowPlayerDialog(playerid, 8, DIALOG_STYLE_LIST, "Character Details", "Gender\nClothing\nFighting Style\nFinished", "Select", "Cancel");
  883. }
  884. case 1:
  885. {
  886. PlayerInfo[playerid][Gender] = 2;
  887. SendClientMessage(playerid, COLOR_GRAD1, "You have set your gender as female.");
  888. ShowPlayerDialog(playerid, 8, DIALOG_STYLE_LIST, "Character Details", "Gender\nClothing\nFighting Style\nFinished", "Select", "Cancel");
  889. }
  890. }
  891. }
  892. else if(response == 0)
  893. {
  894. ShowPlayerDialog(playerid, 8, DIALOG_STYLE_LIST, "Character Details", "Gender\nClothing\nFighting Style\nFinished", "Select", "Cancel");
  895. }
  896. }
  897. if(response)
  898. {
  899. if(dialogid == 10)
  900. {
  901. if(!inputtext[0])
  902. {
  903. ShowPlayerDialog(playerid, 10, DIALOG_STYLE_INPUT, "Skin", "Type in your wanted skin id into the input box.", "Change", "Cancel");
  904. }
  905. else if(IsValidSkin(strval(inputtext)) == 0)
  906. {
  907. SendClientMessage(playerid, COLOR_GRAD1, "This is a restricted skin. Please pick another.");
  908. ShowPlayerDialog(playerid, 10, DIALOG_STYLE_INPUT, "Clothing", "Type the skin ID you would like below.", "Select", "Back");
  909. return 1;
  910. }
  911. SetPlayerSkin(playerid, strval(inputtext));
  912. SendClientMessage(playerid, COLOR_WHITE, "You have changed your skin!");
  913. ShowPlayerDialog(playerid, 8, DIALOG_STYLE_LIST, "Character Details", "Gender\nClothing\nFighting Style\nFinished", "Select", "Cancel");
  914. }
  915. }
  916.  
  917.  
  918. return 1;
  919. }
  920.  
  921.  
  922. public OnPlayerClickPlayer(playerid, clickedplayerid, source)
  923. {
  924. return 1;
  925. }
Advertisement
Add Comment
Please, Sign In to add comment