Advertisement
Ranko_

Save Position System By: Ranko

Oct 14th, 2018
943
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.06 KB | None | 0 0
  1. //==============================================================================
  2. // SYSTEM Save Position
  3. // SCRIPTED BY Ranko
  4. // VERSION v1.0
  5. //==============================================================================
  6.  
  7. #include <a_samp>
  8. #include <Dini>
  9. #include <dudb>
  10.  
  11. new Float:positionx;
  12. new Float:positiony;
  13. new Float:positionz;
  14.  
  15. #if defined FILTERSCRIPT
  16.  
  17. public OnFilterScriptInit()
  18. {
  19. print(" Saveposition System By Ranko");
  20. return 1;
  21. }
  22.  
  23. public OnFilterScriptExit()
  24. {
  25. return 1;
  26. }
  27.  
  28. #else
  29.  
  30. main()
  31. {
  32. print(" Saveposition System By Ranko");
  33. }
  34.  
  35. #endif
  36.  
  37. public OnGameModeInit()
  38. {
  39. SetGameModeText("Saveposition system");
  40. AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
  41. return 1;
  42. }
  43.  
  44. public OnGameModeExit()
  45. {
  46. return 1;
  47. }
  48.  
  49. public OnPlayerRequestClass(playerid, classid)
  50. {
  51. SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
  52. SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
  53. SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
  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. positionx = x;
  71. positiony = y;
  72. positionz = z;
  73. if (!dini_Exists(FileStats(playerid)))
  74. {
  75. dini_Create(FileStats(playerid));
  76. }
  77.  
  78. SaveStats(playerid);
  79. return 1;
  80. }
  81.  
  82. public OnPlayerSpawn(playerid)
  83. {
  84. SetPlayerPos(playerid,positionx,positiony,positionz);
  85. return 1;
  86. }
  87.  
  88. public OnPlayerDeath(playerid, killerid, reason)
  89. {
  90. SetPlayerPos(playerid,1182.7733,-1323.6193,13.5785);
  91. positionx = 1182.7733;
  92. positiony = -1323.6193;
  93. positionz = 13.5785;
  94. return 1;
  95. }
  96.  
  97. public OnVehicleSpawn(vehicleid)
  98. {
  99. return 1;
  100. }
  101.  
  102. public OnVehicleDeath(vehicleid, killerid)
  103. {
  104. return 1;
  105. }
  106.  
  107. public OnPlayerText(playerid, text[])
  108. {
  109. return 1;
  110. }
  111.  
  112. public OnPlayerCommandText(playerid, cmdtext[])
  113. {
  114. if (strcmp("/mycommand", cmdtext, true, 10) == 0)
  115. {
  116. // Do something here
  117. return 1;
  118. }
  119. return 0;
  120. }
  121.  
  122. public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
  123. {
  124. return 1;
  125. }
  126.  
  127. public OnPlayerExitVehicle(playerid, vehicleid)
  128. {
  129. return 1;
  130. }
  131.  
  132. public OnPlayerStateChange(playerid, newstate, oldstate)
  133. {
  134. return 1;
  135. }
  136.  
  137. public OnPlayerEnterCheckpoint(playerid)
  138. {
  139. return 1;
  140. }
  141.  
  142. public OnPlayerLeaveCheckpoint(playerid)
  143. {
  144. return 1;
  145. }
  146.  
  147. public OnPlayerEnterRaceCheckpoint(playerid)
  148. {
  149. return 1;
  150. }
  151.  
  152. public OnPlayerLeaveRaceCheckpoint(playerid)
  153. {
  154. return 1;
  155. }
  156.  
  157. public OnRconCommand(cmd[])
  158. {
  159. return 1;
  160. }
  161.  
  162. public OnPlayerRequestSpawn(playerid)
  163. {
  164. return 1;
  165. }
  166.  
  167. public OnObjectMoved(objectid)
  168. {
  169. return 1;
  170. }
  171.  
  172. public OnPlayerObjectMoved(playerid, objectid)
  173. {
  174. return 1;
  175. }
  176.  
  177. public OnPlayerPickUpPickup(playerid, pickupid)
  178. {
  179. return 1;
  180. }
  181.  
  182. public OnVehicleMod(playerid, vehicleid, componentid)
  183. {
  184. return 1;
  185. }
  186.  
  187. public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
  188. {
  189. return 1;
  190. }
  191.  
  192. public OnVehicleRespray(playerid, vehicleid, color1, color2)
  193. {
  194. return 1;
  195. }
  196.  
  197. public OnPlayerSelectedMenuRow(playerid, row)
  198. {
  199. return 1;
  200. }
  201.  
  202. public OnPlayerExitedMenu(playerid)
  203. {
  204. return 1;
  205. }
  206.  
  207. public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
  208. {
  209. return 1;
  210. }
  211.  
  212. public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
  213. {
  214. return 1;
  215. }
  216.  
  217. public OnRconLoginAttempt(ip[], password[], success)
  218. {
  219. return 1;
  220. }
  221.  
  222. public OnPlayerUpdate(playerid)
  223. {
  224. return 1;
  225. }
  226.  
  227. public OnPlayerStreamIn(playerid, forplayerid)
  228. {
  229. return 1;
  230. }
  231.  
  232. public OnPlayerStreamOut(playerid, forplayerid)
  233. {
  234. return 1;
  235. }
  236.  
  237. public OnVehicleStreamIn(vehicleid, forplayerid)
  238. {
  239. return 1;
  240. }
  241.  
  242. public OnVehicleStreamOut(vehicleid, forplayerid)
  243. {
  244. return 1;
  245. }
  246.  
  247. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  248. {
  249. return 1;
  250. }
  251.  
  252. public OnPlayerClickPlayer(playerid, clickedplayerid, source)
  253. {
  254. return 1;
  255. }
  256. Player(playerid)
  257. {
  258. new player[MAX_PLAYER_NAME];
  259. GetPlayerName(playerid, player, sizeof(player));
  260. return player;
  261. }
  262. FileStats(playerid)
  263. {
  264. new a[256]; format(a, sizeof(a), "%s.ini",udb_encode(Player(playerid)));
  265. return a;
  266. }
  267. LoadStats(playerid)
  268. {
  269. positionx = dini_Int(FileStats(playerid), "PositionX");
  270. positiony = dini_Int(FileStats(playerid), "PositionY");
  271. positionz = dini_Int(FileStats(playerid), "PositionZ");
  272. }
  273. SaveStats(playerid)
  274. {
  275. dini_IntSet(FileStats(playerid), "PositionX", floatround(positionx));
  276. dini_IntSet(FileStats(playerid), "PositionY", floatround(positiony));
  277. dini_IntSet(FileStats(playerid), "PositionZ", floatround(positionz));
  278. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement