Advertisement
Guest User

Kocsi mentés/betöltés rendszer

a guest
Aug 20th, 2014
229
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 4.79 KB | None | 0 0
  1. #include <a_samp>
  2. #include <dini>
  3. #include <zcmd>
  4.  
  5. #define PIROS 0xFF0000FF
  6.  
  7. new file[128];
  8.  
  9. main()
  10. {
  11.  
  12. }
  13.  
  14. public OnGameModeInit()
  15. {
  16.     for(new i=0; i<MAX_VEHICLES; i++) // Egy ciklus amivel végig megyünk az összes kocsin
  17.     {
  18.         format(file,sizeof(file),"/Cars/%d.ini",i); // Formázzuk a fájlt
  19.         if(fexist(file)) // Ha létezik a file
  20.         {
  21.             new Float:posx, Float:posy, Float:posz, Float:angle, model; // Létrehozzuk a megfelelő változókat
  22.             posx = dini_Float(file,"PosX"); // Lekérjük a fájlból az -X kordinátát
  23.             posy = dini_Float(file,"PosY"); // -Y kordinátát
  24.             posz = dini_Float(file,"PosZ"); // -Z kordinátát
  25.             angle = dini_Float(file,"Angle"); // -Forgásirányát
  26.             model = dini_Int(file,"Model"); // -a model id-jét
  27.             CreateVehicle(model,posx,posy,posz,angle,1,1,-1); // Létrehozzuk a kocsit
  28.         }
  29.     }
  30.     return 1;
  31. }
  32.  
  33. public OnGameModeExit()
  34. {
  35.     return 1;
  36. }
  37.  
  38. public OnPlayerRequestClass(playerid, classid)
  39. {
  40.     return 1;
  41. }
  42.  
  43. public OnPlayerConnect(playerid)
  44. {
  45.     return 1;
  46. }
  47.  
  48. public OnPlayerDisconnect(playerid, reason)
  49. {
  50.     return 1;
  51. }
  52.  
  53. public OnPlayerSpawn(playerid)
  54. {
  55.     return 1;
  56. }
  57.  
  58. public OnPlayerDeath(playerid, killerid, reason)
  59. {
  60.     return 1;
  61. }
  62.  
  63. public OnVehicleSpawn(vehicleid)
  64. {
  65.     return 1;
  66. }
  67.  
  68. public OnVehicleDeath(vehicleid, killerid)
  69. {
  70.     return 1;
  71. }
  72.  
  73. public OnPlayerText(playerid, text[])
  74. {
  75.     return 1;
  76. }
  77.  
  78. public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
  79. {
  80.     return 1;
  81. }
  82.  
  83. public OnPlayerExitVehicle(playerid, vehicleid)
  84. {
  85.     return 1;
  86. }
  87.  
  88. public OnPlayerStateChange(playerid, newstate, oldstate)
  89. {
  90.     return 1;
  91. }
  92.  
  93. public OnPlayerEnterCheckpoint(playerid)
  94. {
  95.     return 1;
  96. }
  97.  
  98. public OnPlayerLeaveCheckpoint(playerid)
  99. {
  100.     return 1;
  101. }
  102.  
  103. public OnPlayerEnterRaceCheckpoint(playerid)
  104. {
  105.     return 1;
  106. }
  107.  
  108. public OnPlayerLeaveRaceCheckpoint(playerid)
  109. {
  110.     return 1;
  111. }
  112.  
  113. public OnRconCommand(cmd[])
  114. {
  115.     return 1;
  116. }
  117.  
  118. public OnPlayerRequestSpawn(playerid)
  119. {
  120.     return 1;
  121. }
  122.  
  123. public OnObjectMoved(objectid)
  124. {
  125.     return 1;
  126. }
  127.  
  128. public OnPlayerObjectMoved(playerid, objectid)
  129. {
  130.     return 1;
  131. }
  132.  
  133. public OnPlayerPickUpPickup(playerid, pickupid)
  134. {
  135.     return 1;
  136. }
  137.  
  138. public OnVehicleMod(playerid, vehicleid, componentid)
  139. {
  140.     return 1;
  141. }
  142.  
  143. public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
  144. {
  145.     return 1;
  146. }
  147.  
  148. public OnVehicleRespray(playerid, vehicleid, color1, color2)
  149. {
  150.     return 1;
  151. }
  152.  
  153. public OnPlayerSelectedMenuRow(playerid, row)
  154. {
  155.     return 1;
  156. }
  157.  
  158. public OnPlayerExitedMenu(playerid)
  159. {
  160.     return 1;
  161. }
  162.  
  163. public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
  164. {
  165.     return 1;
  166. }
  167.  
  168. public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
  169. {
  170.     return 1;
  171. }
  172.  
  173. public OnRconLoginAttempt(ip[], password[], success)
  174. {
  175.     return 1;
  176. }
  177.  
  178. public OnPlayerUpdate(playerid)
  179. {
  180.     return 1;
  181. }
  182.  
  183. public OnPlayerStreamIn(playerid, forplayerid)
  184. {
  185.     return 1;
  186. }
  187.  
  188. public OnPlayerStreamOut(playerid, forplayerid)
  189. {
  190.     return 1;
  191. }
  192.  
  193. public OnVehicleStreamIn(vehicleid, forplayerid)
  194. {
  195.     return 1;
  196. }
  197.  
  198. public OnVehicleStreamOut(vehicleid, forplayerid)
  199. {
  200.     return 1;
  201. }
  202.  
  203. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  204. {
  205.     return 1;
  206. }
  207.  
  208. public OnPlayerClickPlayer(playerid, clickedplayerid, source)
  209. {
  210.     return 1;
  211. }
  212.  
  213. CMD:sveh(playerid)
  214. {
  215.     if(IsPlayerInAnyVehicle(playerid)) // Ha járműben van a játékos
  216.     {
  217.         new vehid = GetPlayerVehicleID(playerid); // Lekérjük hogy a játékos melyik id-jű kocsiban van
  218.         new Float:posx, Float:posy, Float:posz, Float:angle, model; // Létrehozzul a változókat
  219.         GetVehiclePos(vehid,posx,posy,posz); // Lekérjük a kocsi kordinátáját
  220.         GetVehicleZAngle(vehid,angle); // Lekérjük a kocsi forgásirányát
  221.         model = GetVehicleModel(vehid); // Lekérjük a kocsi model id-jét
  222.         format(file,sizeof(file),"/Cars/%d.ini",vehid); // Formázzuk a file változót a mappának megfelelően
  223.         if(!fexist(file)) // Ha létezik a file
  224.         {
  225.             dini_Create(file); // Létrehozzuk a fájlt
  226.             dini_FloatSet(file,"PosX",posx); // Lementjük az -X koordinátát
  227.             dini_FloatSet(file,"PosY",posy); // -Y koordinátát
  228.             dini_FloatSet(file,"PosZ",posz); // -Z koordinátát
  229.             dini_FloatSet(file,"Angle",angle); // -Forgásirányát
  230.             dini_IntSet(file,"Model",model); // -A model id-jét
  231.         }
  232.         else // Ha nem létezik a file
  233.         {
  234.             dini_FloatSet(file,"PosX",posx); // Lementjük az -X koordinátát
  235.             dini_FloatSet(file,"PosY",posy); // -Y koordinátát
  236.             dini_FloatSet(file,"PosZ",posz); // -Z koordinátát
  237.             dini_FloatSet(file,"Angle",angle); // -Forgásirányát
  238.             dini_IntSet(file,"Model",model); // -A model id-jét
  239.         }
  240.     }
  241.     else // Ha nincs járműben a játékos
  242.     {
  243.         SendClientMessage(playerid,PIROS,"Nem vagy járműben!");
  244.     }
  245.     return 1;
  246. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement