Guest User

pos saver v2

a guest
Jan 15th, 2012
751
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #define FILTERSCRIPT
  2.  
  3. #include <a_samp>
  4. #include <Dini>
  5. #include <dudb>
  6.  
  7. //player info
  8. new Float:positionx;
  9. new Float:positiony;
  10. new Float:positionz;
  11. new skin;
  12. new money;
  13. new weed;
  14. new healthpack;
  15. new mp3;
  16. new dlic;
  17.  
  18. //driveing school
  19. new dpick;
  20.  
  21. //shops
  22. new shop1;
  23.  
  24. //Color Defines
  25. #define COLOR_GRAD1 0xB4B5B7AA
  26. #define COLOR_GREY 0xAFAFAFAA
  27. #define COLOR_GREEN 0x33AA33AA
  28. #define green 0x33FF33AA
  29. #define red 0xFF0000AA
  30. #define yellow 0xFFFF00AA
  31. #define grey 0xC0C0C0AA
  32. #define blue 0x2641FEAA
  33. #define orange 0xFF9900AA
  34. #define black 0x2C2727AA
  35. #define COLOR_PINK 0xFF66FFAA
  36. #define COLOR_BLUE 0x0000BBAA
  37. #define COLOR_PURPLE 0x800080AA
  38. #define COLOR_BLACK 0x000000AA
  39. #define COLOR_WHITE 0xFFFFFFAA
  40. #define COLOR_GREEN1 0x33AA33AA
  41. #define COLOR_BROWN 0xA52A2AAA
  42.  
  43. #if defined FILTERSCRIPT
  44.  
  45. public OnFilterScriptInit()
  46. {
  47. print("\n--------------------------------------");
  48. print(" Position saver by Jueix");
  49. print("--------------------------------------\n");
  50. //shop pick ups
  51. shop1 = CreatePickup(1274, 1, -23.5076, -55.1543, 1003.5469, -1);
  52. //driving school n pick upscars
  53. dpick = CreatePickup(1274, 1, 1173.1597, 1348.6721, 10.9219, -1);
  54. return 1;
  55. }
  56.  
  57. public OnPlayerConnect(playerid)
  58. {
  59. LoadStats(playerid);
  60. return 1;
  61. }
  62.  
  63. public OnPlayerDisconnect(playerid, reason)
  64. {
  65. new Float:x;
  66. new Float:y;
  67. new Float:z;
  68.  
  69. GetPlayerPos(playerid,x,y,z);
  70. skin = GetPlayerSkin(playerid);
  71. money = GetPlayerMoney(playerid);
  72. positionx = x;
  73. positiony = y;
  74. positionz = z;
  75.  
  76. if (!dini_Exists(Pos(playerid)))
  77. {
  78. dini_Create(Pos(playerid));
  79. }
  80. SaveStats(playerid);
  81. return 1;
  82. }
  83.  
  84. public OnPlayerSpawn(playerid)
  85. {
  86. if (!dini_Exists(Pos(playerid))) {
  87. SetPlayerPos(playerid, 1676.8462, 1447.7908, 10.7833);
  88. GivePlayerMoney(playerid, 50000);
  89. }
  90. else
  91. {
  92. SetPlayerPos(playerid, positionx,positiony,positionz);
  93. SetPlayerSkin(playerid,skin);
  94. GivePlayerMoney(playerid,money);
  95. }
  96. return 1;
  97. }
  98.  
  99. public OnPlayerCommandText(playerid, cmdtext[])
  100. {
  101. if (strcmp("/mp3", cmdtext, true, 10) == 0) //Change this one to whatever you want.
  102. {
  103. if(mp3 >= 1) {
  104. ShowPlayerDialog(playerid,90,DIALOG_STYLE_LIST,"Mp3 player by jueix","1. Eppictv monster\r\n2. Eppic by no means\r\n3. Boyce avenue every breath\r\n4. FYRE STARTERZ we wont stop ","Select", "Cancel");//We use the line above to make the Dialog show, and as you notice we want DIALOG_STYLE_LIST because it will be a list so we can choose from.
  105. }
  106. else {
  107. SendClientMessage(playerid, red,"Error: You don't have a mp3 player");
  108. }
  109. return 1;
  110. }
  111. if (strcmp("/stopmusic", cmdtext, true, 10) == 0)
  112. {
  113. StopAudioStreamForPlayer(playerid);//This is the function we need to stop the audio from streaming the music.
  114. return 1;
  115. }
  116. //worlds
  117. if (strcmp("/musichelp", cmdtext, true, 10) == 0)
  118. {
  119. SendClientMessage(playerid, blue,"/mp3 to play a list of music and /stopmusic to stop");
  120. return 1;
  121. }
  122. if (strcmp("/weed", cmdtext, true, 10) == 0)
  123. {
  124. if(weed >= 1) {
  125. SendClientMessage(playerid, blue,"you smoke the weed");
  126. weed = weed-1;
  127. }
  128. else {
  129. SendClientMessage(playerid, red,"Error: You don't have any weed");
  130. }
  131. return 1;
  132. }
  133. if (strcmp("/healthpack", cmdtext, true, 10) == 0)
  134. {
  135. if(healthpack >= 1) {
  136. SendClientMessage(playerid, blue,"you put the bandages on");
  137. healthpack = healthpack-1;
  138. }
  139. else {
  140. SendClientMessage(playerid, red,"Error: You don't have a healthpack");
  141. }
  142. return 1;
  143. }
  144. return 0;
  145. }
  146.  
  147. public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
  148. {
  149. if(dlic >= 1) {
  150. //
  151. }
  152. else
  153. {
  154. SendClientMessage(playerid, blue,"you don't have a driving lic go to the school to get one");
  155. }
  156. return 1;
  157. }
  158.  
  159. public OnPlayerPickUpPickup(playerid, pickupid)
  160. {
  161. if(pickupid == shop1)
  162. {
  163. ShowPlayerDialog(playerid,1,DIALOG_STYLE_LIST,"shop","1. weed £25\r\n2. health £500 \r\n3. Mp3 player £1500","Select", "Cancel");
  164. }
  165. if(pickupid == dpick)
  166. if(dlic == 0) {
  167. GivePlayerMoney(playerid,-500);
  168. SendClientMessage(playerid,green,"you now have a driving license");
  169. dlic = 1;
  170. }
  171. else
  172. {
  173. SendClientMessage(playerid,green,"you aready have a driving license");
  174. }
  175. return 1;
  176. }
  177.  
  178. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  179. {
  180. switch(dialogid)
  181. {
  182. case 90:
  183. {
  184. if(!response)
  185. {
  186. SendClientMessage(playerid, 0x42F3F198, "You canceled the dialog.");
  187. return 1;
  188. }
  189. switch(listitem)
  190. {
  191. case 0:
  192. {
  193. PlayAudioStreamForPlayer(playerid, "http://k002.kiwi6.com/hotlink/4sbcq95h9i/paramore_monster_eppic_and_alex_g_cover.mp3");
  194. SendClientMessage(playerid, 0x42F3F198, "Type /stopmusic to stop audio streaming.");
  195. }
  196. case 1:
  197. {
  198. PlayAudioStreamForPlayer(playerid, "http://k002.kiwi6.com/hotlink/p4t199hze3/eppic_feat_lindsey_stirling_by_no_means_original_song.mp3");//This function will play our desired radio. So we have to put the url between its brackets.
  199. SendClientMessage(playerid, 0x42F3F198, "Type /stopmusic to stop audio streaming.");
  200. }
  201. case 2:
  202. {
  203. PlayAudioStreamForPlayer(playerid, "http://k002.kiwi6.com/hotlink/o8gr9q3g0c/boyce_avenue_every_breath.mp3");
  204. SendClientMessage(playerid, 0x42F3F198, "Type /stopmusic to stop audio streaming.");
  205. }
  206. case 3:
  207. {
  208. PlayAudioStreamForPlayer(playerid, "http://k003.kiwi6.com/hotlink/34le71lfyp/fyre_starterz_we_won_t_stop.mp3");
  209. SendClientMessage(playerid, 0x42F3F198, "Type /stopmusic to stop audio streaming.");
  210. }
  211. //You can continue cases here but make sure you make a new line in the ShowPlayerDialog on /mp3 command \r\n4. 4th \r\n5. 5th channel etc..
  212. }
  213. }
  214. }
  215. switch(dialogid)
  216. {
  217. case 1:
  218. {
  219. if(!response)
  220. {
  221. SendClientMessage(playerid, 0x42F3F198, "Thanks come back soon.");
  222. return 1;
  223. }
  224. switch(listitem)
  225. {
  226. case 0:
  227. {
  228. GivePlayerMoney(playerid,-25);
  229. weed = weed+1;
  230. SendClientMessage(playerid, 0x42F3F198, "You have bought some weed type /weed to smoke it");
  231. }
  232. case 1:
  233. {
  234. GivePlayerMoney(playerid, -500);
  235. healthpack = healthpack+1;
  236. SendClientMessage(playerid, 0x42F3F198, "You have bought a health kit type /health to use it");
  237. }
  238. case 2:
  239. {
  240. GivePlayerMoney(playerid, -1500);
  241. mp3 = 1;
  242. SendClientMessage(playerid, 0x42F3F198, "You have bought a mp3 player type /mp3 to use it");
  243. }
  244. //You can continue cases here but make sure you make a new line in the ShowPlayerDialog on shop1 in pickup command \r\n4. 4th \r\n5. 5th channel etc..
  245. }
  246. }
  247. }
  248. return 1;
  249. }
  250.  
  251. Player(playerid)
  252. {
  253. new player[MAX_PLAYER_NAME];
  254. GetPlayerName(playerid, player, sizeof(player));
  255. return player;
  256. }
  257.  
  258. Pos(playerid)
  259. {
  260. new a[256]; format(a, sizeof(a), "%s.ini",udb_encode(Player(playerid)));
  261. return a;
  262. }
  263.  
  264. SaveStats(playerid)
  265. {
  266. dini_IntSet(Pos(playerid), "PositionX", floatround(positionx));
  267. dini_IntSet(Pos(playerid), "PositionY", floatround(positiony));
  268. dini_IntSet(Pos(playerid), "PositionZ", floatround(positionz));
  269. dini_IntSet(Pos(playerid), "skin", (skin));
  270. dini_IntSet(Pos(playerid), "money", (money));
  271. dini_IntSet(Pos(playerid), "weed", (weed));
  272. dini_IntSet(Pos(playerid), "healthpack", (healthpack));
  273. dini_IntSet(Pos(playerid), "dlic", (dlic));
  274. }
  275.  
  276. LoadStats(playerid)
  277. {
  278. positionx = dini_Int(Pos(playerid), "PositionX");
  279. positiony = dini_Int(Pos(playerid), "PositionY");
  280. positionz = dini_Int(Pos(playerid), "PositionZ");
  281. skin = dini_Int(Pos(playerid), "skin");
  282. money = dini_Int(Pos(playerid), "money");
  283. weed = dini_Int(Pos(playerid), "weed");
  284. healthpack = dini_Int(Pos(playerid), "healthpack");
  285. dlic = dini_Int(Pos(playerid), "dlic");
  286. }
  287.  
  288. public OnFilterScriptExit()
  289. {
  290. return 1;
  291. }
  292.  
  293. #else
  294.  
  295. main()
  296. {
  297. print("\n----------------------------------");
  298. print(" Blank Gamemode by Jueix");
  299. print("----------------------------------\n");
  300. }
  301.  
  302. #endif
Advertisement
Add Comment
Please, Sign In to add comment