Guest User

Fixed CrapYoPants

a guest
Feb 22nd, 2013
46
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 2.74 KB | None | 0 0
  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.     for(new i = 0; i < MAX_PLAYERS; i++) {
  38.         if(IsPlayerConnected(Prandom)) return 1;
  39.     }
  40.     return 0;
  41. }
  42.  
  43. GetXYInFrontOfPlayer(playerid, &Float:XP, &Float:YP, Float:distance)
  44. {   // Created by Y_Less
  45.  
  46.     new Float:a;
  47.  
  48.     GetPlayerPos(playerid, XP, YP, a);
  49.     GetPlayerFacingAngle(playerid, a);
  50.  
  51.     if (GetPlayerVehicleID(playerid)) {
  52.         GetVehicleZAngle(GetPlayerVehicleID(playerid), a);
  53.     }
  54.  
  55.     XP += (distance * floatsin(-a, degrees));
  56.     YP += (distance * floatcos(-a, degrees));
  57. }
  58.  
  59. //------------------------------------------------
  60.  
  61. public OnFilterScriptInit()
  62. {
  63.     print("Welcome to the most useless filterscript you will ever see.");
  64.     print("Why did you even download this crap?");
  65.    
  66.     ScaryCow = CreateObject(16442, 0, 0, 0, 0, 0, 0);
  67.    
  68.     timers[0] = SetTimer("ScarePlayer", 30000, true);
  69.    
  70.     return 1;
  71. }
  72.  
  73. //------------------------------------------------
  74.  
  75. public OnFilterScriptExit()
  76. {
  77.     KillTimer(timers[0]);
  78.     KillTimer(timers[1]);
  79.    
  80.     return 1;
  81. }
  82.  
  83. //------------------------------------------------
  84.  
  85. public OnPlayerDisconnect(playerid, reason)
  86. {
  87.     if(playerid == ScaredPlayer) ScarePlayer();
  88.    
  89.     return 1;
  90. }
  91.  
  92. //------------------------------------------------
  93.  
  94. public ScarePlayer()
  95. {
  96.     player = GetPlayerID();
  97.     new Float:pos[4], Hour, Min;
  98.    
  99.     if(player == -1) {}
  100.    
  101.    
  102.     if(IsPlayerInAnyVehicle(player)) GetVehiclePos(GetPlayerVehicleID(player), pos[0], pos[1], pos[2]);
  103.     else GetPlayerPos(player, pos[0], pos[1], pos[2]);
  104.    
  105.     GetPlayerFacingAngle(player, pos[3]);
  106.     GetXYInFrontOfPlayer(player, pos[0], pos[1], 3);
  107.    
  108.     PlayAudioStreamForPlayer(player, "http://sf-cnr.co.uk/lul.mp3");
  109.    
  110.     SetObjectPos(ScaryCow, pos[0], pos[1], pos[2]);
  111.     SetObjectRot(ScaryCow, 0, 0, pos[3]-90);
  112.    
  113.     GetPlayerTime(player, Hour, Min);
  114.     PlayerInfo[player][PTimeHour] = Hour;
  115.     PlayerInfo[player][PTimeMin] = Min;
  116.    
  117.     SetPlayerTime(player,0,0);
  118.     SetPlayerWeather(player, 8);
  119.    
  120.     timers[1] = SetTimer("Destroy", 4000, false);
  121.    
  122.     return 1;
  123. }
  124.  
  125. //------------------------------------------------
  126.  
  127. public Destroy()
  128. {
  129.     SetObjectPos(ScaryCow, 0, 0, 0);
  130.     PlayAudioStreamForPlayer(player, "stap");
  131.     SetPlayerTime(player,PlayerInfo[player][PTimeHour],PlayerInfo[player][PTimeMin]);
  132.     SetPlayerWeather(player, 0);
  133. }
Advertisement
Add Comment
Please, Sign In to add comment