Advertisement
OG_LOC

Testing

May 23rd, 2014
187
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.49 KB | None | 0 0
  1. //Includes
  2. #include <a_samp>
  3. #include <YSI\y_ini>
  4. #include <sscanf>
  5. #include <zcmd>
  6.  
  7. //Other Defines
  8. #define FILTERSCRIPT
  9.  
  10. //Colors
  11. #define COLOR_YELLOW 0xFFEE00AA
  12. #define COLOR_ORANGE 0xFFBB00AA
  13. #define COLOR_RED 0xFF0000FF
  14.  
  15. //Enum
  16. enum PositionInfo
  17. {
  18. Float: PosX,
  19. Float: PosY,
  20. Float: PosZ,
  21. Float: Angle,
  22. Interior,
  23. VirtualWorld
  24. }
  25.  
  26. new YPosInfo[MAX_PLAYERS][PositionInfo];
  27.  
  28. #define YPos_Path "YPOS/%s.ini"
  29. stock user_ini_file(playerid)
  30. {
  31. new str[128],user_name[MAX_PLAYER_NAME];
  32. GetPlayerName(playerid,user_name,sizeof(user_name));
  33.  
  34. for(new d,len = strlen(user_name); d != len; d++)
  35. user_name[d] = tolower(user_name[d]);
  36.  
  37. format(str,sizeof(str),YPos_Path,user_name);
  38. return str;
  39. }
  40.  
  41. forward @load_user_position(playerid, name[], value[]);
  42.  
  43. @load_user_position(playerid, name[], value[])
  44. {
  45. INI_Float("PositionX", YPosInfo[playerid][PosX]);
  46. INI_Float("PositionY", YPosInfo[playerid][PosY]);
  47. INI_Float("PositionZ", YPosInfo[playerid][PosZ]);
  48. INI_Float("Angle", YPosInfo[playerid][Angle]);
  49. INI_Int("Interior", YPosInfo[playerid][Interior]);
  50. INI_Int("VirtualWorld", YPosInfo[playerid][VirtualWorld]);
  51. return 1;
  52. }
  53.  
  54. public OnFilterScriptInit()
  55. {
  56. print("\n--------------------------------------");
  57. print(" Youssef's Saving/Loading Position Filterscript Loaded");
  58. print("--------------------------------------\n");
  59. return 1;
  60. }
  61.  
  62. public OnFilterScriptExit()
  63. {
  64. print("\n--------------------------------------");
  65. print(" Youssef's Saving/Loading Position Filterscript Unloaded");
  66. print("--------------------------------------\n");
  67. return 1;
  68. }
  69.  
  70.  
  71. public OnPlayerConnect(playerid)
  72. {
  73. YPosInfo[playerid][PosX] = 0;
  74. YPosInfo[playerid][PosY] = 0;
  75. YPosInfo[playerid][PosZ] = 0;
  76. YPosInfo[playerid][Angle] = 0;
  77. YPosInfo[playerid][Interior] = 0;
  78. YPosInfo[playerid][VirtualWorld] = 0;
  79. SendClientMessage(playerid,COLOR_YELLOW,"This Server Uses YPOS (Youssef's Saving/Loading Position) Filterscript.");
  80. INI_ParseFile(user_ini_file(playerid), "load_user_%s", .bExtra = true, .extra = playerid);
  81. return 1;
  82. }
  83.  
  84. public OnPlayerDisconnect(playerid, reason)
  85. {
  86. return 1;
  87. }
  88.  
  89. public OnPlayerSpawn(playerid)
  90. {
  91. return 1;
  92. }
  93.  
  94. COMMAND:saveplace1(playerid, params[])
  95. {
  96. new string[64];
  97. GetPlayerPos(playerid, YPosInfo[playerid][PosX], YPosInfo[playerid][PosY], YPosInfo[playerid][PosZ]);
  98. GetPlayerFacingAngle(playerid, YPosInfo[playerid][Angle]);
  99. new INI:File = INI_Open(user_ini_file(playerid));
  100. INI_SetTag(File, "YPositions");
  101. INI_WriteFloat(File, "PositionX", YPosInfo[playerid][PosX]);
  102. INI_WriteFloat(File, "PositionY", YPosInfo[playerid][PosY]);
  103. INI_WriteFloat(File, "PositionZ", YPosInfo[playerid][PosZ]);
  104. INI_WriteFloat(File, "Angle", YPosInfo[playerid][Angle]);
  105. INI_WriteInt(File, "Interior", GetPlayerInterior(playerid));
  106. INI_WriteInt(File, "VirtualWorld", GetPlayerVirtualWorld(playerid));
  107. INI_Close(File);
  108. format(string,sizeof string, "Successfully Saved The PositionX: %f", YPosInfo[playerid][PosX]);
  109. SendClientMessage(playerid, COLOR_ORANGE, string);
  110. format(string,sizeof string, "Successfully Saved The PositionY: %f", YPosInfo[playerid][PosY]);
  111. SendClientMessage(playerid, COLOR_ORANGE, string);
  112. format(string,sizeof string, "Successfully Saved The PositionZ: %f", YPosInfo[playerid][PosZ]);
  113. SendClientMessage(playerid, COLOR_ORANGE, string);
  114. format(string,sizeof string, "Angle: %f , Interior: %d , Virtual World: %d ", YPosInfo[playerid][Angle],GetPlayerInterior(playerid),GetPlayerVirtualWorld(playerid));
  115. SendClientMessage(playerid, COLOR_ORANGE, string);
  116. return 1;
  117. }
  118.  
  119. COMMAND:gotoplace1(playerid, params[])
  120. {
  121. if(!fexist(user_ini_file(playerid)))
  122. {
  123. SendClientMessage(playerid, COLOR_RED, "You Have Not Saved Your Place Number 1, Yet! Use /saveplace1 To Save Your Current Place To Number 1");
  124. }
  125. else if(fexist(user_ini_file(playerid)))
  126. {
  127. SetPlayerPos(playerid, YPosInfo[playerid][PosX], YPosInfo[playerid][PosY], YPosInfo[playerid][PosZ]);
  128. SetPlayerFacingAngle(playerid, YPosInfo[playerid][Angle]);
  129. SetPlayerInterior(playerid, YPosInfo[playerid][Interior]);
  130. SetPlayerVirtualWorld(playerid, YPosInfo[playerid][VirtualWorld]);
  131. SendClientMessage(playerid, COLOR_ORANGE, "Successfully Teleported To Your Place Number 1.");
  132. }
  133. return 1;
  134. }
  135.  
  136. public OnPlayerDeath(playerid, killerid, reason)
  137. {
  138. return 1;
  139. }
  140.  
  141. public OnVehicleSpawn(vehicleid)
  142. {
  143. return 1;
  144. }
  145.  
  146. public OnVehicleDeath(vehicleid, killerid)
  147. {
  148. return 1;
  149. }
  150.  
  151. public OnPlayerText(playerid, text[])
  152. {
  153. return 1;
  154. }
  155.  
  156. public OnPlayerCommandText(playerid, cmdtext[])
  157. {
  158. return 1;
  159. }
  160.  
  161. public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
  162. {
  163. return 1;
  164. }
  165.  
  166. public OnPlayerExitVehicle(playerid, vehicleid)
  167. {
  168. return 1;
  169. }
  170.  
  171. public OnPlayerStateChange(playerid, newstate, oldstate)
  172. {
  173. return 1;
  174. }
  175.  
  176. public OnPlayerEnterCheckpoint(playerid)
  177. {
  178. return 1;
  179. }
  180.  
  181. public OnPlayerLeaveCheckpoint(playerid)
  182. {
  183. return 1;
  184. }
  185.  
  186. public OnPlayerEnterRaceCheckpoint(playerid)
  187. {
  188. return 1;
  189. }
  190.  
  191. public OnPlayerLeaveRaceCheckpoint(playerid)
  192. {
  193. return 1;
  194. }
  195.  
  196. public OnRconCommand(cmd[])
  197. {
  198. return 1;
  199. }
  200.  
  201. public OnPlayerRequestSpawn(playerid)
  202. {
  203. return 1;
  204. }
  205.  
  206. public OnObjectMoved(objectid)
  207. {
  208. return 1;
  209. }
  210.  
  211. public OnPlayerObjectMoved(playerid, objectid)
  212. {
  213. return 1;
  214. }
  215.  
  216. public OnPlayerPickUpPickup(playerid, pickupid)
  217. {
  218. return 1;
  219. }
  220.  
  221. public OnVehicleMod(playerid, vehicleid, componentid)
  222. {
  223. return 1;
  224. }
  225.  
  226. public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
  227. {
  228. return 1;
  229. }
  230.  
  231. public OnVehicleRespray(playerid, vehicleid, color1, color2)
  232. {
  233. return 1;
  234. }
  235.  
  236. public OnPlayerSelectedMenuRow(playerid, row)
  237. {
  238. return 1;
  239. }
  240.  
  241. public OnPlayerExitedMenu(playerid)
  242. {
  243. return 1;
  244. }
  245.  
  246. public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
  247. {
  248. return 1;
  249. }
  250.  
  251. public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
  252. {
  253. return 1;
  254. }
  255.  
  256. public OnRconLoginAttempt(ip[], password[], success)
  257. {
  258. return 1;
  259. }
  260.  
  261. public OnPlayerUpdate(playerid)
  262. {
  263. return 1;
  264. }
  265.  
  266. public OnPlayerStreamIn(playerid, forplayerid)
  267. {
  268. return 1;
  269. }
  270.  
  271. public OnPlayerStreamOut(playerid, forplayerid)
  272. {
  273. return 1;
  274. }
  275.  
  276. public OnVehicleStreamIn(vehicleid, forplayerid)
  277. {
  278. return 1;
  279. }
  280.  
  281. public OnVehicleStreamOut(vehicleid, forplayerid)
  282. {
  283. return 1;
  284. }
  285.  
  286. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  287. {
  288. return 1;
  289. }
  290.  
  291. public OnPlayerClickPlayer(playerid, clickedplayerid, source)
  292. {
  293. return 1;
  294. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement