Advertisement
Guest User

Untitled

a guest
Sep 29th, 2012
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.07 KB | None | 0 0
  1. #include <a_samp>
  2. #include <mfiles>
  3. #include <sscanf2>
  4. #include <zcmd>
  5.  
  6. #define MAX_PICK 50
  7.  
  8. #define COLOR_WHITE 0xFFFFFFFF
  9. #define COLOR_RED 0xFF0000FF
  10.  
  11. enum pickupinfo
  12. {
  13. Float:pX,
  14. Float:pY,
  15. Float:pZ,
  16. pModel,
  17. pType,
  18. pID
  19. }
  20. new Pickup[MAX_PICK][pickupinfo];
  21.  
  22. public OnFilterScriptInit()
  23. {
  24. CreatePickup(1272,0,0.0,0.0,-150.0); // Anti ID Verschiebung
  25. for(new p=1;p<MAX_PICK;p++)
  26. {
  27. LoadPickup(p);
  28. }
  29. print("\n--------------------------------------");
  30. print(" mDynamics 1.1 by munkee");
  31. print("--------------------------------------\n");
  32. return 1;
  33. }
  34.  
  35. public OnFilterScriptExit()
  36. {
  37. for(new p=1;p<MAX_PICK;p++)
  38. {
  39. SavePickup(p);
  40. }
  41. return 1;
  42. }
  43.  
  44. public OnPlayerConnect(playerid)
  45. {
  46. return 1;
  47. }
  48.  
  49. public OnPlayerDisconnect(playerid, reason)
  50. {
  51. return 1;
  52. }
  53.  
  54. public OnPlayerSpawn(playerid)
  55. {
  56. return 1;
  57. }
  58.  
  59. public OnPlayerDeath(playerid, killerid, reason)
  60. {
  61. return 1;
  62. }
  63.  
  64. public OnVehicleSpawn(vehicleid)
  65. {
  66. return 1;
  67. }
  68.  
  69. public OnVehicleDeath(vehicleid, killerid)
  70. {
  71. return 1;
  72. }
  73.  
  74. public OnPlayerText(playerid, text[])
  75. {
  76. return 1;
  77. }
  78.  
  79. CMD:cpickup(playerid,params[])
  80. {
  81. new model,type;
  82. if(!sscanf(params,"ii",model,type))
  83. {
  84. new Float:X,Float:Y,Float:Z;
  85. GetPlayerPos(playerid,X,Y,Z);
  86. PickupCreate(X,Y,Z,model,type);
  87. } else return SendClientMessage(playerid,COLOR_RED,"Syntax: /cpickup [ModelID] [Type]");
  88. return 1;
  89. }
  90.  
  91. CMD:precover(playerid,params[])
  92. {
  93. new recid;
  94. if(!sscanf(params,"i",recid))
  95. {
  96. new file[128];
  97. format(file,128,"Pickups/deleted_%d",recid);
  98. if(fexist(file))
  99. {
  100. new file2[128];
  101. for(new p=0; p<MAX_PICK; p++)
  102. {
  103. format(file2,128,"Pickups/%d.ini",p);
  104. if(!fexist(file2))
  105. {
  106. File_Rename(file,file2);
  107. LoadPickup(p);
  108. }
  109. }
  110. }
  111. } else return SendClientMessage(playerid,COLOR_RED,"Syntax: /precover [recoverid]");
  112. return 1;
  113. }
  114.  
  115. CMD:dpickup(playerid,params[])
  116. {
  117. for(new p=1;p<MAX_PICK;p++)
  118. {
  119. if(IsPlayerInRangeOfPoint(playerid,2.0,Pickup[p][pX],Pickup[p][pY],Pickup[p][pZ]))
  120. {
  121. DestroyPickup(Pickup[p][pID]);
  122. return DeletePickup(playerid,p);
  123. }
  124. }
  125. return 1;
  126. }
  127.  
  128. public OnPlayerCommandText(playerid, cmdtext[])
  129. {
  130. return 1;
  131. }
  132.  
  133. public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
  134. {
  135. return 1;
  136. }
  137.  
  138. public OnPlayerExitVehicle(playerid, vehicleid)
  139. {
  140. return 1;
  141. }
  142.  
  143. public OnPlayerStateChange(playerid, newstate, oldstate)
  144. {
  145. return 1;
  146. }
  147.  
  148. public OnPlayerEnterCheckpoint(playerid)
  149. {
  150. return 1;
  151. }
  152.  
  153. public OnPlayerLeaveCheckpoint(playerid)
  154. {
  155. return 1;
  156. }
  157.  
  158. public OnPlayerEnterRaceCheckpoint(playerid)
  159. {
  160. return 1;
  161. }
  162.  
  163. public OnPlayerLeaveRaceCheckpoint(playerid)
  164. {
  165. return 1;
  166. }
  167.  
  168. public OnRconCommand(cmd[])
  169. {
  170. return 1;
  171. }
  172.  
  173. public OnPlayerRequestSpawn(playerid)
  174. {
  175. return 1;
  176. }
  177.  
  178. public OnObjectMoved(objectid)
  179. {
  180. return 1;
  181. }
  182.  
  183. public OnPlayerObjectMoved(playerid, objectid)
  184. {
  185. return 1;
  186. }
  187.  
  188. public OnPlayerPickUpPickup(playerid, pickupid)
  189. {
  190. return 1;
  191. }
  192.  
  193. public OnVehicleMod(playerid, vehicleid, componentid)
  194. {
  195. return 1;
  196. }
  197.  
  198. public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
  199. {
  200. return 1;
  201. }
  202.  
  203. public OnVehicleRespray(playerid, vehicleid, color1, color2)
  204. {
  205. return 1;
  206. }
  207.  
  208. public OnPlayerSelectedMenuRow(playerid, row)
  209. {
  210. return 1;
  211. }
  212.  
  213. public OnPlayerExitedMenu(playerid)
  214. {
  215. return 1;
  216. }
  217.  
  218. public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
  219. {
  220. return 1;
  221. }
  222.  
  223. public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
  224. {
  225. return 1;
  226. }
  227.  
  228. public OnRconLoginAttempt(ip[], password[], success)
  229. {
  230. return 1;
  231. }
  232.  
  233. public OnPlayerUpdate(playerid)
  234. {
  235. return 1;
  236. }
  237.  
  238. public OnPlayerStreamIn(playerid, forplayerid)
  239. {
  240. return 1;
  241. }
  242.  
  243. public OnPlayerStreamOut(playerid, forplayerid)
  244. {
  245. return 1;
  246. }
  247.  
  248. public OnVehicleStreamIn(vehicleid, forplayerid)
  249. {
  250. return 1;
  251. }
  252.  
  253. public OnVehicleStreamOut(vehicleid, forplayerid)
  254. {
  255. return 1;
  256. }
  257.  
  258. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  259. {
  260. return 1;
  261. }
  262.  
  263. public OnPlayerClickPlayer(playerid, clickedplayerid, source)
  264. {
  265. return 1;
  266. }
  267.  
  268. stock PickupCreate(Float:x,Float:y,Float:z,model,type)
  269. {
  270. new file[128];
  271. for(new p=1;p<MAX_PICK;p++)
  272. {
  273. format(file,128,"Pickups/%d.ini",p);
  274. if(!fexist(file))
  275. {
  276. File_Create(file);
  277. File_Write(file);
  278. File_WriteFloat("x",x);
  279. File_WriteFloat("y",y);
  280. File_WriteFloat("z",z);
  281. File_WriteInt("model",model);
  282. File_WriteInt("type",type);
  283. File_WriteFinish(file);
  284. return LoadPickup(p);
  285. }
  286. }
  287. return 1;
  288. }
  289.  
  290. stock SavePickup(pickupid)
  291. {
  292. new file[128];
  293. format(file,128,"Pickups/%d.ini",pickupid);
  294. if(fexist(file))
  295. {
  296. File_Open(file);
  297. File_Write(file);
  298. File_WriteFloat("x",Pickup[pickupid][pX]);
  299. File_WriteFloat("y",Pickup[pickupid][pY]);
  300. File_WriteFloat("z",Pickup[pickupid][pZ]);
  301. File_WriteInt("model",Pickup[pickupid][pModel]);
  302. File_WriteInt("type",Pickup[pickupid][pType]);
  303. File_WriteFinish(file);
  304. }
  305. }
  306.  
  307. stock LoadPickup(pickupid)
  308. {
  309. new file[128];
  310. format(file,128,"Pickups/%d.ini",pickupid);
  311. if(fexist(file))
  312. {
  313. File_Open(file);
  314. Pickup[pickupid][pX] = File_GetFloat("x");
  315. Pickup[pickupid][pY] = File_GetFloat("y");
  316. Pickup[pickupid][pZ] = File_GetFloat("z");
  317. Pickup[pickupid][pModel] = File_GetInt("model");
  318. Pickup[pickupid][pType] = File_GetInt("type");
  319. File_Close();
  320. Pickup[pickupid][pID] = CreatePickup(Pickup[pickupid][pModel],Pickup[pickupid][pType],Pickup[pickupid][pX],Pickup[pickupid][pY],Pickup[pickupid][pZ]);
  321. }
  322. return 1;
  323. }
  324.  
  325. stock DeletePickup(playerid,pickupid)
  326. {
  327. new file[128];
  328. format(file,128,"Pickups/%d.ini",pickupid);
  329. DestroyPickup(Pickup[pickupid][pID]);
  330. if(fexist(file))
  331. {
  332. new file2[128], string[128];
  333. new rand = random(9999);
  334. format(file2,128,"Pickups/deleted_%d",rand);
  335. File_Rename(file,file2);
  336. format(string,128,"Pickup gelöscht, recovercode: %d (/precover %d um Pickup wiederherzustellen)",rand,rand);
  337. SendClientMessage(playerid,COLOR_WHITE,string);
  338. }
  339. return 1;
  340. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement