Guest User

possaver

a guest
Jul 28th, 2011
304
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.68 KB | None | 0 0
  1. #define FILTERSCRIPT
  2.  
  3. #include <a_samp>
  4. #include <Dini>
  5. #include <dudb>
  6.  
  7. new Float:positionx;
  8. new Float:positiony;
  9. new Float:positionz;
  10.  
  11. #if defined FILTERSCRIPT
  12.  
  13. public OnFilterScriptInit()
  14. {
  15. print("\n--------------------------------------");
  16. print(" Position saver by Jueix");
  17. print("--------------------------------------\n");
  18. return 1;
  19. }
  20.  
  21. public OnPlayerConnect(playerid)
  22. {
  23. LoadStats(playerid);
  24. return 1;
  25. }
  26.  
  27. public OnPlayerDisconnect(playerid, reason)
  28. {
  29. new Float:x;
  30. new Float:y;
  31. new Float:z;
  32.  
  33. GetPlayerPos(playerid,x,y,z);
  34. positionx = x;
  35. positiony = y;
  36. positionz = z;
  37. if (!dini_Exists(Pos(playerid)))
  38. {
  39. dini_Create(Pos(playerid));
  40. }
  41.  
  42. SaveStats(playerid);
  43. return 1;
  44. }
  45.  
  46. public OnPlayerSpawn(playerid)
  47. {
  48. SetPlayerPos(playerid,positionx,positiony,positionz);
  49. return 1;
  50. }
  51.  
  52. Player(playerid)
  53. {
  54. new player[MAX_PLAYER_NAME];
  55. GetPlayerName(playerid, player, sizeof(player));
  56. return player;
  57. }
  58.  
  59. Pos(playerid)
  60. {
  61. new a[256]; format(a, sizeof(a), "%s.ini",udb_encode(Player(playerid)));
  62. return a;
  63. }
  64.  
  65. SaveStats(playerid)
  66. {
  67. dini_IntSet(Pos(playerid), "PositionX", floatround(positionx));
  68. dini_IntSet(Pos(playerid), "PositionY", floatround(positiony));
  69. dini_IntSet(Pos(playerid), "PositionZ", floatround(positionz));
  70. }
  71.  
  72. LoadStats(playerid)
  73. {
  74. positionx = dini_Int(Pos(playerid), "PositionX");
  75. positiony = dini_Int(Pos(playerid), "PositionY");
  76. positionz = dini_Int(Pos(playerid), "PositionZ");
  77. }
  78.  
  79. public OnFilterScriptExit()
  80. {
  81. return 1;
  82. }
  83.  
  84. #else
  85.  
  86. main()
  87. {
  88. print("\n----------------------------------");
  89. print(" Blank Gamemode by Jueix");
  90. print("----------------------------------\n");
  91. }
  92.  
  93. #endif
Advertisement
Add Comment
Please, Sign In to add comment