Advertisement
Guest User

Untitled

a guest
Apr 17th, 2014
38
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.74 KB | None | 0 0
  1. #include <Dini>
  2. #include <dudb>
  3.  
  4.  
  5. Player(playerid)
  6. {
  7. new player[MAX_PLAYER_NAME];
  8. GetPlayerName(playerid, player, sizeof(player));
  9. return player;
  10. }
  11.  
  12.  
  13. new Float:positionx;
  14. new Float:positiony;
  15. new Float:positionz;
  16.  
  17. FileStats(playerid)
  18. {
  19. new a[256]; format(a, sizeof(a), "%s.ini",udb_encode(Player(playerid)));
  20. return a;
  21. }
  22.  
  23.  
  24. SaveStats(playerid)
  25. {
  26. dini_IntSet(FileStats(playerid), "PositionX", floatround(positionx));
  27. dini_IntSet(FileStats(playerid), "PositionY", floatround(positiony));
  28. dini_IntSet(FileStats(playerid), "PositionZ", floatround(positionz));
  29. }
  30.  
  31.  
  32. LoadStats(playerid)
  33. {
  34. positionx = dini_Int(FileStats(playerid), "PositionX");
  35. positiony = dini_Int(FileStats(playerid), "PositionY");
  36. positionz = dini_Int(FileStats(playerid), "PositionZ");
  37. }
  38.  
  39.  
  40.  
  41. LoadStats(playerid);
  42.  
  43.  
  44.  
  45.  
  46. new Float:x;
  47. new Float:y;
  48. new Float:z;
  49.  
  50. GetPlayerPos(playerid,x,y,z);
  51. positionx = x;
  52. positiony = y;
  53. positionz = z;
  54. if (!dini_Exists(FileStats(playerid)))
  55. {
  56. dini_Create(FileStats(playerid));
  57. }
  58.  
  59. SaveStats(playerid);
  60.  
  61.  
  62.  
  63. SetPlayerPos(playerid,positionx,positiony,positionz);
  64.  
  65.  
  66.  
  67. SetPlayerPos(playerid,1182.7733,-1323.6193,13.5785);
  68. positionx = 1182.7733;
  69. positiony = -1323.6193;
  70. positionz = 13.5785;
  71.  
  72.  
  73. Evo ovako treba da ti izgleda na kraju SEM
  74. #include <Dini>
  75. #include <dudb>
  76.  
  77. new Float:positionx;
  78. new Float:positiony;
  79. new Float:positionz;
  80.  
  81. public OnPlayerConnect(playerid)
  82. {
  83. LoadStats(playerid);
  84. return 1;
  85. }
  86.  
  87. public OnPlayerDisconnect(playerid, reason)
  88. {
  89. new Float:x;
  90. new Float:y;
  91. new Float:z;
  92.  
  93. GetPlayerPos(playerid,x,y,z);
  94. positionx = x;
  95. positiony = y;
  96. positionz = z;
  97. if (!dini_Exists(FileStats(playerid)))
  98. {
  99. dini_Create(FileStats(playerid));
  100. }
  101.  
  102. SaveStats(playerid);
  103. return 1;
  104. }
  105.  
  106. public OnPlayerSpawn(playerid)
  107. {
  108. SetPlayerPos(playerid,positionx,positiony,positionz);
  109. return 1;
  110. }
  111.  
  112. public OnPlayerDeath(playerid, killerid, reason)
  113. {
  114. SetPlayerPos(playerid,1182.7733,-1323.6193,13.5785);
  115. positionx = 1182.7733;
  116. positiony = -1323.6193;
  117. positionz = 13.5785;
  118. return 1;
  119. }
  120.  
  121. Player(playerid)
  122. {
  123. new player[MAX_PLAYER_NAME];
  124. GetPlayerName(playerid, player, sizeof(player));
  125. return player;
  126. }
  127.  
  128. FileStats(playerid)
  129. {
  130. new a[256]; format(a, sizeof(a), "%s.ini",udb_encode(Player(playerid)));
  131. return a;
  132. }
  133.  
  134. SaveStats(playerid)
  135. {
  136. dini_IntSet(FileStats(playerid), "PositionX", floatround(positionx));
  137. dini_IntSet(FileStats(playerid), "PositionY", floatround(positiony));
  138. dini_IntSet(FileStats(playerid), "PositionZ", floatround(positionz));
  139. }
  140.  
  141. LoadStats(playerid)
  142. {
  143. positionx = dini_Int(FileStats(playerid), "PositionX");
  144. positiony = dini_Int(FileStats(playerid), "PositionY");
  145. positionz = dini_Int(FileStats(playerid), "PositionZ");
  146. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement