Guest User

Untitled

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