Guest User

pos saver v2

a guest
Jan 15th, 2012
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.65 KB | None | 0 0
  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. return 1;
  51. }
  52.  
  53. public OnPlayerConnect(playerid)
  54. {
  55. LoadStats(playerid);
  56. return 1;
  57. }
  58.  
  59. public OnPlayerDisconnect(playerid, reason)
  60. {
  61. new Float:x;
  62. new Float:y;
  63. new Float:z;
  64.  
  65. GetPlayerPos(playerid,x,y,z);
  66. skin = GetPlayerSkin(playerid);
  67. money = GetPlayerMoney(playerid);
  68. positionx = x;
  69. positiony = y;
  70. positionz = z;
  71.  
  72. if (!dini_Exists(Pos(playerid)))
  73. {
  74. dini_Create(Pos(playerid));
  75. }
  76. SaveStats(playerid);
  77. return 1;
  78. }
  79.  
  80. public OnPlayerSpawn(playerid)
  81. {
  82. if (!dini_Exists(Pos(playerid))) {
  83. SetPlayerPos(playerid, 1676.8462, 1447.7908, 10.7833);
  84. GivePlayerMoney(playerid, 50000);
  85. }
  86. else
  87. {
  88. SetPlayerPos(playerid, positionx,positiony,positionz);
  89. SetPlayerSkin(playerid,skin);
  90. GivePlayerMoney(playerid,money);
  91. }
  92. return 1;
  93. }
  94.  
  95. public OnPlayerCommandText(playerid, cmdtext[])
  96. {
  97. if (strcmp("/mp3", cmdtext, true, 10) == 0) //Change this one to whatever you want.
  98. {
  99. if(mp3 >= 1) {
  100. 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.
  101. }
  102. else {
  103. SendClientMessage(playerid, red,"Error: You don't have a mp3 player");
  104. }
  105. return 1;
  106. }
  107. if (strcmp("/stopmusic", cmdtext, true, 10) == 0)
  108. {
  109. StopAudioStreamForPlayer(playerid);//This is the function we need to stop the audio from streaming the music.
  110. return 1;
  111. }
  112. //worlds
  113. if (strcmp("/musichelp", cmdtext, true, 10) == 0)
  114. {
  115. SendClientMessage(playerid, blue,"/mp3 to play a list of music and /stopmusic to stop");
  116. return 1;
  117. }
  118. if (strcmp("/weed", cmdtext, true, 10) == 0)
  119. {
  120. if(weed >= 1) {
  121. SendClientMessage(playerid, blue,"you smoke the weed");
  122. weed = weed-1;
  123. }
  124. else {
  125. SendClientMessage(playerid, red,"Error: You don't have any weed");
  126. }
  127. return 1;
  128. }
  129. if (strcmp("/healthpack", cmdtext, true, 10) == 0)
  130. {
  131. if(healthpack >= 1) {
  132. SendClientMessage(playerid, blue,"you put the bandages on");
  133. healthpack = healthpack-1;
  134. }
  135. else {
  136. SendClientMessage(playerid, red,"Error: You don't have a healthpack");
  137. }
  138. return 1;
  139. }
  140. return 0;
  141. }
  142.  
  143. public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
  144. {
  145. if(dlic >= 1) {
  146. //
  147. }
  148. else
  149. {
  150. SendClientMessage(playerid, blue,"you don't have a driving lic go to the school to get one");
  151. }
  152. return 1;
  153. }
  154.  
  155. public OnPlayerPickUpPickup(playerid, pickupid)
  156. {
  157. if(pickupid == shop1)
  158. {
  159. ShowPlayerDialog(playerid,1,DIALOG_STYLE_LIST,"shop","1. weed £25\r\n2. health £500 \r\n3. Mp3 player £1500","Select", "Cancel");
  160. }
  161. if(pickupid == dpick)
  162. if(dlic == 0) {
  163. GivePlayerMoney(playerid,-500);
  164. SendClientMessage(playerid,green,"you now have a driving license");
  165. dlic = 1;
  166. }
  167. else
  168. {
  169. SendClientMessage(playerid,green,"you aready have a driving license");
  170. }
  171. return 1;
  172. }
  173.  
  174. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  175. {
  176. switch(dialogid)
  177. {
  178. case 90:
  179. {
  180. if(!response)
  181. {
  182. SendClientMessage(playerid, 0x42F3F198, "You canceled the dialog.");
  183. return 1;
  184. }
  185. switch(listitem)
  186. {
  187. case 0:
  188. {
  189. PlayAudioStreamForPlayer(playerid, "http://k002.kiwi6.com/hotlink/4sbcq95h9i/paramore_monster_eppic_and_alex_g_cover.mp3");
  190. SendClientMessage(playerid, 0x42F3F198, "Type /stopmusic to stop audio streaming.");
  191. }
  192. case 1:
  193. {
  194. 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.
  195. SendClientMessage(playerid, 0x42F3F198, "Type /stopmusic to stop audio streaming.");
  196. }
  197. case 2:
  198. {
  199. PlayAudioStreamForPlayer(playerid, "http://k002.kiwi6.com/hotlink/o8gr9q3g0c/boyce_avenue_every_breath.mp3");
  200. SendClientMessage(playerid, 0x42F3F198, "Type /stopmusic to stop audio streaming.");
  201. }
  202. case 3:
  203. {
  204. PlayAudioStreamForPlayer(playerid, "http://k003.kiwi6.com/hotlink/34le71lfyp/fyre_starterz_we_won_t_stop.mp3");
  205. SendClientMessage(playerid, 0x42F3F198, "Type /stopmusic to stop audio streaming.");
  206. }
  207. //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..
  208. }
  209. }
  210. }
  211. switch(dialogid)
  212. {
  213. case 1:
  214. {
  215. if(!response)
  216. {
  217. SendClientMessage(playerid, 0x42F3F198, "Thanks come back soon.");
  218. return 1;
  219. }
  220. switch(listitem)
  221. {
  222. case 0:
  223. {
  224. GivePlayerMoney(playerid,-25);
  225. weed = weed+1;
  226. SendClientMessage(playerid, 0x42F3F198, "You have bought some weed type /weed to smoke it");
  227. }
  228. case 1:
  229. {
  230. GivePlayerMoney(playerid, -500);
  231. healthpack = healthpack+1;
  232. SendClientMessage(playerid, 0x42F3F198, "You have bought a health kit type /health to use it");
  233. }
  234. case 2:
  235. {
  236. GivePlayerMoney(playerid, -1500);
  237. mp3 = 1;
  238. SendClientMessage(playerid, 0x42F3F198, "You have bought a mp3 player type /mp3 to use it");
  239. }
  240. //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..
  241. }
  242. }
  243. }
  244. return 1;
  245. }
  246.  
  247. Player(playerid)
  248. {
  249. new player[MAX_PLAYER_NAME];
  250. GetPlayerName(playerid, player, sizeof(player));
  251. return player;
  252. }
  253.  
  254. Pos(playerid)
  255. {
  256. new a[256]; format(a, sizeof(a), "%s.ini",udb_encode(Player(playerid)));
  257. return a;
  258. }
  259.  
  260. SaveStats(playerid)
  261. {
  262. dini_IntSet(Pos(playerid), "PositionX", floatround(positionx));
  263. dini_IntSet(Pos(playerid), "PositionY", floatround(positiony));
  264. dini_IntSet(Pos(playerid), "PositionZ", floatround(positionz));
  265. dini_IntSet(Pos(playerid), "skin", (skin));
  266. dini_IntSet(Pos(playerid), "money", (money));
  267. dini_IntSet(Pos(playerid), "weed", (weed));
  268. dini_IntSet(Pos(playerid), "healthpack", (healthpack));
  269. dini_IntSet(Pos(playerid), "dlic", (dlic));
  270. }
  271.  
  272. LoadStats(playerid)
  273. {
  274. positionx = dini_Int(Pos(playerid), "PositionX");
  275. positiony = dini_Int(Pos(playerid), "PositionY");
  276. positionz = dini_Int(Pos(playerid), "PositionZ");
  277. skin = dini_Int(Pos(playerid), "skin");
  278. money = dini_Int(Pos(playerid), "money");
  279. weed = dini_Int(Pos(playerid), "weed");
  280. healthpack = dini_Int(Pos(playerid), "healthpack");
  281. dlic = dini_Int(Pos(playerid), "dlic");
  282. }
  283.  
  284. public OnFilterScriptExit()
  285. {
  286. return 1;
  287. }
  288.  
  289. #else
  290.  
  291. main()
  292. {
  293. print("\n----------------------------------");
  294. print(" Blank Gamemode by Jueix");
  295. print("----------------------------------\n");
  296. }
  297.  
  298. #endif
Advertisement
Add Comment
Please, Sign In to add comment