Guest User

rcar

a guest
May 12th, 2013
177
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 5.76 KB | None | 0 0
  1. // This is a comment
  2. // uncomment the line below if you want to write a filterscript
  3. //#define FILTERSCRIPT
  4.  
  5. #include <a_samp>
  6.  
  7. forward LooDDetectorV(Float:radi, playerid, vehicleid);
  8. #if defined FILTERSCRIPT
  9.  
  10. public OnFilterScriptInit()
  11. {
  12.     print("\n--------------------------------------");
  13.     print(" Respawn vehicle system by --LooD--");
  14.     print("--------------------------------------\n");
  15.     return 1;
  16. }
  17.  
  18. public OnFilterScriptExit()
  19. {
  20.     return 1;
  21. }
  22.  
  23. #else
  24.  
  25.  
  26.  
  27. #endif
  28.  
  29.  
  30.  
  31. public OnPlayerRequestClass(playerid, classid)
  32. {
  33.     SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
  34.     SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
  35.     SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
  36.     return 1;
  37. }
  38.  
  39. public OnPlayerConnect(playerid)
  40. {
  41.     return 1;
  42. }
  43.  
  44. public OnPlayerDisconnect(playerid, reason)
  45. {
  46.     return 1;
  47. }
  48.  
  49. public OnPlayerSpawn(playerid)
  50. {
  51.     return 1;
  52. }
  53.  
  54. public OnPlayerDeath(playerid, killerid, reason)
  55. {
  56.     return 1;
  57. }
  58.  
  59. public OnVehicleSpawn(vehicleid)
  60. {
  61.     return 1;
  62. }
  63.  
  64. public OnVehicleDeath(vehicleid, killerid)
  65. {
  66.     return 1;
  67. }
  68.  
  69. public OnPlayerText(playerid, text[])
  70. {
  71.     return 1;
  72. }
  73.  
  74. public OnPlayerCommandText(playerid, cmdtext[])
  75. {
  76.     if (strcmp("/rtc", cmdtext, true, 10) == 0)
  77.     {
  78.         new string[128];
  79.         if (IsPlayerConnected(playerid))
  80.         {
  81.             if(IsPlayerAdmin(playerid))
  82.             {
  83.             format(string, sizeof(string), "{FFFFFF}%s{00C0FF} je respawnovao vozilo id %d.",ImePrezime(playerid),GetPlayerVehicleID(playerid));
  84.             SendClientMessageToAll(0xDABB3EAA, string);
  85.             new rcar = GetPlayerVehicleID(playerid);
  86.             SetVehicleToRespawn(rcar);
  87.  
  88.             SendClientMessage(playerid, -1, "   Vozilo respawnovano !");
  89.  
  90.             }
  91.         }
  92.         return 1;
  93.     }
  94.     if (strcmp("/rac", cmdtext, true, 10) == 0)
  95.     {
  96.         if(IsPlayerConnected(playerid))
  97.         {
  98.             if(IsPlayerAdmin(playerid))
  99.             {
  100.             new bool:unwanted[MAX_VEHICLES];
  101.             new string[128];
  102.             for(new player=0; player<MAX_PLAYERS; player++)
  103.             {
  104.                 if(IsPlayerInAnyVehicle(player)) { unwanted[GetPlayerVehicleID(player)]=true; }
  105.             }
  106.             for(new car = 1; car <= MAX_VEHICLES; car++)
  107.             {
  108.                 if(!unwanted[car]) SetVehicleToRespawn(car);
  109.             }
  110.             format(string, sizeof(string), "{FFFFFF}%s{00C0FF} je respawnovao sva nekoristena vozila", ImePrezime(playerid));
  111.             SendClientMessageToAll(-1, string);
  112.  
  113.             }
  114.         }
  115.         return 1;
  116.     }
  117.    
  118.     if (strcmp("/rlc", cmdtext, true, 10) == 0)
  119.     {
  120.         if(IsPlayerConnected(playerid))
  121.         {
  122.             if(IsPlayerAdmin(playerid))
  123.             {
  124.             new bool:unwanted[MAX_VEHICLES];
  125.             for(new player=0; player<MAX_PLAYERS; player++)
  126.             {
  127.                 if(IsPlayerInAnyVehicle(player)) { unwanted[GetPlayerVehicleID(player)]=true; }
  128.             }
  129.             for(new car = 1; car <= MAX_VEHICLES; car++)
  130.             {
  131.                 if(LooDDetectorV(10.0, playerid, car))
  132.                 {
  133.                 if(!unwanted[car]) SetVehicleToRespawn(car);
  134.                 }
  135.             }
  136.             SendClientMessage(playerid, -1, "{00C0FF} Respawnali ste sva nekoristena vozila u svojoj blizini.");
  137.             }
  138.         }
  139.         return 1;
  140.     }
  141.    
  142.     return 0;
  143. }
  144.  
  145. public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
  146. {
  147.     return 1;
  148. }
  149.  
  150. public OnPlayerExitVehicle(playerid, vehicleid)
  151. {
  152.     return 1;
  153. }
  154.  
  155. public OnPlayerStateChange(playerid, newstate, oldstate)
  156. {
  157.     return 1;
  158. }
  159.  
  160. public OnPlayerEnterCheckpoint(playerid)
  161. {
  162.     return 1;
  163. }
  164.  
  165. public OnPlayerLeaveCheckpoint(playerid)
  166. {
  167.     return 1;
  168. }
  169.  
  170. public OnPlayerEnterRaceCheckpoint(playerid)
  171. {
  172.     return 1;
  173. }
  174.  
  175. public OnPlayerLeaveRaceCheckpoint(playerid)
  176. {
  177.     return 1;
  178. }
  179.  
  180. public OnRconCommand(cmd[])
  181. {
  182.     return 1;
  183. }
  184.  
  185. public OnPlayerRequestSpawn(playerid)
  186. {
  187.     return 1;
  188. }
  189.  
  190. public OnObjectMoved(objectid)
  191. {
  192.     return 1;
  193. }
  194.  
  195. public OnPlayerObjectMoved(playerid, objectid)
  196. {
  197.     return 1;
  198. }
  199.  
  200. public OnPlayerPickUpPickup(playerid, pickupid)
  201. {
  202.     return 1;
  203. }
  204.  
  205. public OnVehicleMod(playerid, vehicleid, componentid)
  206. {
  207.     return 1;
  208. }
  209.  
  210. public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
  211. {
  212.     return 1;
  213. }
  214.  
  215. public OnVehicleRespray(playerid, vehicleid, color1, color2)
  216. {
  217.     return 1;
  218. }
  219.  
  220. public OnPlayerSelectedMenuRow(playerid, row)
  221. {
  222.     return 1;
  223. }
  224.  
  225. public OnPlayerExitedMenu(playerid)
  226. {
  227.     return 1;
  228. }
  229.  
  230. public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
  231. {
  232.     return 1;
  233. }
  234.  
  235. public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
  236. {
  237.     return 1;
  238. }
  239.  
  240. public OnRconLoginAttempt(ip[], password[], success)
  241. {
  242.     return 1;
  243. }
  244.  
  245. public OnPlayerUpdate(playerid)
  246. {
  247.     return 1;
  248. }
  249.  
  250. public OnPlayerStreamIn(playerid, forplayerid)
  251. {
  252.     return 1;
  253. }
  254.  
  255. public OnPlayerStreamOut(playerid, forplayerid)
  256. {
  257.     return 1;
  258. }
  259.  
  260. public OnVehicleStreamIn(vehicleid, forplayerid)
  261. {
  262.     return 1;
  263. }
  264.  
  265. public OnVehicleStreamOut(vehicleid, forplayerid)
  266. {
  267.     return 1;
  268. }
  269.  
  270. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  271. {
  272.     return 1;
  273. }
  274.  
  275. public OnPlayerClickPlayer(playerid, clickedplayerid, source)
  276. {
  277.     return 1;
  278. }
  279.  
  280.  
  281. public LooDDetectorV(Float:radi, playerid, vehicleid)
  282. {
  283.     if(IsPlayerConnected(playerid))
  284.     {
  285.         new Float:posx, Float:posy, Float:posz;
  286.         new Float:oldposx, Float:oldposy, Float:oldposz;
  287.         new Float:tempposx, Float:tempposy, Float:tempposz;
  288.         GetPlayerPos(playerid, oldposx, oldposy, oldposz);
  289.         //radi = 2.0; //Trigger Radius
  290.         GetVehiclePos(vehicleid, posx, posy, posz);
  291.         tempposx = (oldposx -posx);
  292.         tempposy = (oldposy -posy);
  293.         tempposz = (oldposz -posz);
  294.         //printf("DEBUG: X:%f Y:%f Z:%f",posx,posy,posz);
  295.         if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
  296.         {
  297.             return 1;
  298.         }
  299.     }
  300.     return 0;
  301. }
  302.  
  303. stock ImePrezime(playerid)
  304. {
  305.     new pname[MAX_PLAYER_NAME]; GetPlayerName(playerid,pname,sizeof(pname));
  306.     new i = strfind(pname,"_",true);
  307.     if(i != (-1)) pname[i] = ' ';
  308.     return pname;
  309.  
  310. }
Advertisement
Add Comment
Please, Sign In to add comment