Guest User

Checkpoints with Dialogs

a guest
Jul 25th, 2012
156
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 6.06 KB | None | 0 0
  1. //--------------------
  2. #include <a_samp>
  3. #include <zcmd>
  4. //--------------------
  5. #define DIALOG_WEAPON 1
  6.  
  7. new CP[MAX_PLAYERS];
  8.  
  9. main()
  10. {
  11.     print("\n----------------------------------");
  12.     print(" Checkpoints with Dialogs - JustinAn");
  13.     print("----------------------------------\n");
  14. }
  15.  
  16. public OnGameModeInit()
  17. {
  18.     SetGameModeText("Checkpoints with Dialogs - JustinAn");
  19.     AddPlayerClass(299, 2489.9390,-1647.3156,14.0772, 180.2384, 0, 0, 0, 0, 0, 0);
  20.     return 1;
  21. }
  22.  
  23. public OnGameModeExit()
  24. {
  25.     return 1;
  26. }
  27.  
  28. public OnPlayerRequestClass(playerid, classid)
  29. {
  30.     return 1;
  31. }
  32.  
  33. public OnPlayerConnect(playerid)
  34. {
  35.     return 1;
  36. }
  37.  
  38. public OnPlayerDisconnect(playerid, reason)
  39. {
  40.     return 1;
  41. }
  42.  
  43. public OnPlayerSpawn(playerid)
  44. {
  45.     return 1;
  46. }
  47.  
  48. public OnPlayerDeath(playerid, killerid, reason)
  49. {
  50.     return 1;
  51. }
  52.  
  53. public OnVehicleSpawn(vehicleid)
  54. {
  55.     return 1;
  56. }
  57.  
  58. public OnVehicleDeath(vehicleid, killerid)
  59. {
  60.     return 1;
  61. }
  62.  
  63. public OnPlayerText(playerid, text[])
  64. {
  65.     return 1;
  66. }
  67.  
  68. public OnPlayerCommandText(playerid, cmdtext[])
  69. {
  70.     if (strcmp("/mycommand", cmdtext, true, 10) == 0)
  71.     {
  72.         // Do something here
  73.         return 1;
  74.     }
  75.     return 0;
  76. }
  77.  
  78. public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
  79. {
  80.     return 1;
  81. }
  82.  
  83. public OnPlayerExitVehicle(playerid, vehicleid)
  84. {
  85.     return 1;
  86. }
  87.  
  88. public OnPlayerStateChange(playerid, newstate, oldstate)
  89. {
  90.     return 1;
  91. }
  92.  
  93. public OnPlayerEnterCheckpoint(playerid)
  94. {
  95.     if(CP[playerid] == 1) // This checks if our variable equals to 1, if so: it continues
  96.     {
  97.         DisablePlayerCheckpoint(playerid); // This makes sure that there will be a new checkpoint
  98.         CP[playerid] = 4; // Changes the variable, so we can use it later again with OnPlayerEnterCheckpoint
  99.         GivePlayerWeapon(playerid, 30, 999999);
  100.         SendClientMessage(playerid, -1, "Enjoy your weapon!");
  101.         return 1;
  102.     }
  103.     if(CP[playerid] == 2) // This checks if our variable equals to 2, if so: it continues
  104.     {
  105.         DisablePlayerCheckpoint(playerid); // This makes sure that there will be a new checkpoint
  106.         CP[playerid] = 5; // Changes the variable, so we can use it later again with OnPlayerEnterCheckpoint
  107.         GivePlayerWeapon(playerid, 31, 999999);
  108.         SendClientMessage(playerid, -1, "Enjoy your weapon!");
  109.     }
  110.     if(CP[playerid] == 2) // This checks if our variable equals to 2, if so: it continues
  111.     {
  112.         DisablePlayerCheckpoint(playerid); // This makes sure that there will be a new checkpoint
  113.         CP[playerid] = 6; // Changes the variable, so we can use it later again with OnPlayerEnterCheckpoint
  114.         GivePlayerWeapon(playerid, 34, 999999);
  115.         SendClientMessage(playerid, -1, "Enjoy your weapon!");
  116.     }
  117.     return 1;
  118. }
  119.  
  120. public OnPlayerLeaveCheckpoint(playerid)
  121. {
  122.     return 1;
  123. }
  124.  
  125. public OnPlayerEnterRaceCheckpoint(playerid)
  126. {
  127.     return 1;
  128. }
  129.  
  130. public OnPlayerLeaveRaceCheckpoint(playerid)
  131. {
  132.     return 1;
  133. }
  134.  
  135. public OnRconCommand(cmd[])
  136. {
  137.     return 1;
  138. }
  139.  
  140. public OnPlayerRequestSpawn(playerid)
  141. {
  142.     return 1;
  143. }
  144.  
  145. public OnObjectMoved(objectid)
  146. {
  147.     return 1;
  148. }
  149.  
  150. public OnPlayerObjectMoved(playerid, objectid)
  151. {
  152.     return 1;
  153. }
  154.  
  155. public OnPlayerPickUpPickup(playerid, pickupid)
  156. {
  157.     return 1;
  158. }
  159.  
  160. public OnVehicleMod(playerid, vehicleid, componentid)
  161. {
  162.     return 1;
  163. }
  164.  
  165. public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
  166. {
  167.     return 1;
  168. }
  169.  
  170. public OnVehicleRespray(playerid, vehicleid, color1, color2)
  171. {
  172.     return 1;
  173. }
  174.  
  175. public OnPlayerSelectedMenuRow(playerid, row)
  176. {
  177.     return 1;
  178. }
  179.  
  180. public OnPlayerExitedMenu(playerid)
  181. {
  182.     return 1;
  183. }
  184.  
  185. public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
  186. {
  187.     return 1;
  188. }
  189.  
  190. public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
  191. {
  192.     return 1;
  193. }
  194.  
  195. public OnRconLoginAttempt(ip[], password[], success)
  196. {
  197.     return 1;
  198. }
  199.  
  200. public OnPlayerUpdate(playerid)
  201. {
  202.     return 1;
  203. }
  204.  
  205. public OnPlayerStreamIn(playerid, forplayerid)
  206. {
  207.     return 1;
  208. }
  209.  
  210. public OnPlayerStreamOut(playerid, forplayerid)
  211. {
  212.     return 1;
  213. }
  214.  
  215. public OnVehicleStreamIn(vehicleid, forplayerid)
  216. {
  217.     return 1;
  218. }
  219.  
  220. public OnVehicleStreamOut(vehicleid, forplayerid)
  221. {
  222.     return 1;
  223. }
  224.  
  225. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  226. {
  227.     if(dialogid == DIALOG_WEAPON) // This checks if the dialog equals to the dialog define 'DIALOG_WEAPON', You can use a switch aswell, but i just prefer just to see the whole line
  228.     {
  229.         if(!response) return 0; // If you press the second button (No), the dialog dissapears and nothing happens
  230.         if(response) // If there is a response (first button( Yes )) it continues
  231.         {
  232.             if(listitem == 0) // If you choose the first listitem, this happens
  233.             {
  234.                 CP[playerid] = 1;
  235.                 SetPlayerCheckpoint(playerid, 2745.6499,-2453.8032,13.8623, 1.0);
  236.                 SendClientMessage(playerid, -1, "You have chosen the AK-47, follow the checkpoint to get the AK-47.");
  237.                 return 1;
  238.             }
  239.             if(listitem == 1) // If you choose the second listitem
  240.             {
  241.                 CP[playerid] = 2;
  242.                 SetPlayerCheckpoint(playerid, 1579.4326,-1635.8755,13.5604, 1.0); // This creates a checkpoint at the coördinates: "-1051.4005,-655.8729,31.7361"
  243.                 SendClientMessage(playerid, -1, "You have chosen the M4, follow the checkpoint to get the M4.");
  244.                 return 1;
  245.             }
  246.             if(listitem == 2) // If you choose the third listitem
  247.             {
  248.                 CP[playerid] = 3;
  249.                 SetPlayerCheckpoint(playerid, 1544.9388,-1353.3195,329.4743, 1.0); // This creates a checkpoint at the coördinates: "-2286.7529,2282.9390,5.9015"
  250.                 SendClientMessage(playerid, -1, "You have chosen the Sniper Rifle, follow the checkpoint to get the Sniper Rifle.");
  251.                 return 1;
  252.             }
  253.         }
  254.     }
  255.     return 1;
  256. }
  257.  
  258. public OnPlayerClickPlayer(playerid, clickedplayerid, source)
  259. {
  260.     return 1;
  261. }
  262.  
  263. // COMMANDS
  264. CMD:weapons(playerid, params[])
  265. {
  266.     ShowPlayerDialog(playerid, DIALOG_WEAPON, DIALOG_STYLE_LIST, "Weapons", "AK47\nM4\nSniper Rifle", "Yes", "No");
  267.     return 1;
  268. }
Advertisement
Add Comment
Please, Sign In to add comment