Guest User

Fixed CrapYoPants

a guest
Feb 22nd, 2013
40
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*
  2.  
  3.     Inspired by Hiddos's filterscript http://forum.sa-mp.com/showthread.php?t=235383
  4.  
  5.     This shows the true strength of boredom
  6.  
  7.     Hopefully this one is fixed!
  8. */
  9.  
  10. #include <a_samp>
  11.  
  12. enum PlayerI
  13. {
  14.     PWeather,
  15.     PTimeMin,
  16.     PTimeHour
  17. }
  18.  
  19. new PlayerInfo[MAX_PLAYERS][PlayerI];
  20.  
  21. //Variables
  22.  
  23. new ScaryCow;
  24. new ScaredPlayer;
  25. new player =-1;
  26. new timers[2];
  27. //Forwards
  28.  
  29. forward ScarePlayer();
  30. forward Destroy();
  31.  
  32. //Functions
  33.  
  34. GetPlayerID() {
  35.  
  36.     new Prandom = random(MAX_PLAYERS);
  37.     if(IsPlayerConnected(Prandom)) return 1;
  38.     return 0;
  39. }
  40.  
  41. GetXYInFrontOfPlayer(playerid, &Float:XP, &Float:YP, Float:distance)
  42. {   // Created by Y_Less
  43.  
  44.     new Float:a;
  45.  
  46.     GetPlayerPos(playerid, XP, YP, a);
  47.     GetPlayerFacingAngle(playerid, a);
  48.  
  49.     if (GetPlayerVehicleID(playerid)) {
  50.         GetVehicleZAngle(GetPlayerVehicleID(playerid), a);
  51.     }
  52.  
  53.     XP += (distance * floatsin(-a, degrees));
  54.     YP += (distance * floatcos(-a, degrees));
  55. }
  56.  
  57. //------------------------------------------------
  58.  
  59. public OnFilterScriptInit()
  60. {
  61.     print("Welcome to the most useless filterscript you will ever see.");
  62.     print("Why did you even download this crap?");
  63.    
  64.     ScaryCow = CreateObject(16442, 0, 0, 0, 0, 0, 0);
  65.    
  66.     timers[0] = SetTimer("ScarePlayer", 30000, true);
  67.    
  68.     return 1;
  69. }
  70.  
  71. //------------------------------------------------
  72.  
  73. public OnFilterScriptExit()
  74. {
  75.     KillTimer(timers[0]);
  76.     KillTimer(timers[1]);
  77.    
  78.     return 1;
  79. }
  80.  
  81. //------------------------------------------------
  82.  
  83. public OnPlayerDisconnect(playerid, reason)
  84. {
  85.     if(playerid == ScaredPlayer) ScarePlayer();
  86.    
  87.     return 1;
  88. }
  89.  
  90. //------------------------------------------------
  91.  
  92. public ScarePlayer()
  93. {
  94.     player = GetPlayerID();
  95.     new Float:pos[4], Hour, Min;
  96.    
  97.     if(player == 0) {}
  98.    
  99.    
  100.     if(IsPlayerInAnyVehicle(player)) GetVehiclePos(GetPlayerVehicleID(player), pos[0], pos[1], pos[2]);
  101.     else GetPlayerPos(player, pos[0], pos[1], pos[2]);
  102.    
  103.     GetPlayerFacingAngle(player, pos[3]);
  104.     GetXYInFrontOfPlayer(player, pos[0], pos[1], 3);
  105.    
  106.     PlayAudioStreamForPlayer(player, "http://sf-cnr.co.uk/lul.mp3");
  107.    
  108.     SetObjectPos(ScaryCow, pos[0], pos[1], pos[2]);
  109.     SetObjectRot(ScaryCow, 0, 0, pos[3]-90);
  110.    
  111.     GetPlayerTime(player, Hour, Min);
  112.     PlayerInfo[player][PTimeHour] = Hour;
  113.     PlayerInfo[player][PTimeMin] = Min;
  114.    
  115.     SetPlayerTime(player,0,0);
  116.     SetPlayerWeather(player, 8);
  117.    
  118.     timers[1] = SetTimer("Destroy", 4000, false);
  119.    
  120.     return 1;
  121. }
  122.  
  123. //------------------------------------------------
  124.  
  125. public Destroy()
  126. {
  127.     SetObjectPos(ScaryCow, 0, 0, 0);
  128.     PlayAudioStreamForPlayer(player, "stap");
  129.     SetPlayerTime(player,PlayerInfo[player][PTimeHour],PlayerInfo[player][PTimeMin]);
  130.     SetPlayerWeather(player, 0);
  131. }
Advertisement
Add Comment
Please, Sign In to add comment