Advertisement
Guest User

Hiddos

a guest
Mar 5th, 2011
776
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 3.13 KB | None | 0 0
  1. #include <a_samp>
  2. #define abs(%0) ((%0) >= 0 ? (%0) : -(%0))
  3. new loser = -1, cowly_cow, tiemr[2];
  4. public OnFilterScriptInit()
  5. {
  6.     print("\n--------------------------------------");
  7.     print(" Stalker Cows, another useless script");
  8.     print(" made by Hiddos. I'm wondering why");
  9.     print(" you're using this. Type 'unloadfs stalkercows'");
  10.     print(" right now and save yourself.");
  11.     print("--------------------------------------\n");
  12.     cowly_cow = CreateObject(16442, 0, 0, 0, 0, 0, 0);
  13.     ChooseNewLoser();
  14.     tiemr[0] = SetTimer("ChooseNewLoser", 60 * 1000, true);
  15.     tiemr[1] = SetTimer("DatOtherCallback", 28 * 100, true);
  16.     return 1;
  17. }
  18.  
  19. public OnFilterScriptExit()
  20. {
  21.     KillTimer(tiemr[0]);
  22.     KillTimer(tiemr[1]);
  23.     DestroyObject(cowly_cow); //Bai bai cow :(
  24.     return 1;
  25. }
  26.  
  27. public OnPlayerDisconnect(playerid, reason)
  28. {
  29.     if(playerid == loser) ChooseNewLoser();
  30.     return 1;
  31. }
  32.  
  33. /* Gary the Plumber: A story about Gary
  34.  
  35.     Do you know Gary the Plumber? No? You idiot. Well, here it goes:
  36.     Gary the Plumber is a guy from somewhere in England (I couldn't be arsed to
  37.     come up with a location). He's 24 years old and just bought a new rubber
  38.     chair to beat his fish with. Even though his name might make you think
  39.     otherwise, Gary is a Plumber. He recommends you not to become a plumber.
  40.     Anyhow, Gary lived happily ever after!
  41.    
  42.     The end of this romantic story kids. Hope for something better
  43.     in my next release.
  44.    
  45. */
  46.  
  47. forward ChooseNewLoser();
  48. public ChooseNewLoser()
  49. {
  50.     for(new i; i < MAX_PLAYERS; i++)
  51.     {
  52.         if(IsPlayerConnected(i)) break;
  53.         if(i == MAX_PLAYERS - 1) { loser = -1; return; }
  54.     }
  55.     new target = -1;
  56.     while(!IsPlayerConnected(target))
  57.     {
  58.         target = random(MAX_PLAYERS);
  59.     }
  60.     loser = target;
  61.     new Float:Pos[4];
  62.     if(IsPlayerInAnyVehicle(loser)) GetVehiclePos(GetPlayerVehicleID(loser), Pos[0], Pos[1], Pos[2]);
  63.     else GetPlayerPos(loser, Pos[0], Pos[1], Pos[2]);
  64.     Pos[0] += float(random(30) - 15);
  65.     Pos[1] += float(random(30) - 15);
  66.     StopObject(cowly_cow);
  67.     SetObjectPos(cowly_cow, Pos[0], Pos[1], Pos[2] - 7.5);
  68.     MoveObject(cowly_cow, Pos[0], Pos[1], Pos[2], 5.0);
  69. }
  70.  
  71. stock Float:GetPlayerSpeed(playerid)
  72. {
  73.     new Float:x,Float:y,Float:z;
  74.     if(IsPlayerInAnyVehicle(playerid)) GetVehicleVelocity(GetPlayerVehicleID(playerid),x,y,z);
  75.     else GetPlayerVelocity(playerid,x,y,z);
  76.     return floatsqroot(x*x+y*y+z*z) * 48.5;
  77. }
  78.  
  79. forward DatOtherCallback();
  80. public DatOtherCallback()
  81. {
  82.     if(loser == -1) return;
  83.     new Float:Pos[7];
  84.     GetObjectPos(cowly_cow, Pos[0], Pos[1], Pos[2]);
  85.     if(IsPlayerInAnyVehicle(loser)) GetVehiclePos(GetPlayerVehicleID(loser), Pos[3], Pos[4], Pos[5]);
  86.     else GetPlayerPos(loser, Pos[3], Pos[4], Pos[5]);
  87.     Pos[3] += float(random(10) - 5);
  88.     Pos[4] += float(random(10) - 5);
  89.     Pos[6] = atan( floatdiv(abs(Pos[4] - Pos[1]), abs(Pos[3] - Pos[0])) );
  90.  
  91.     if(Pos[3] < Pos[0] && Pos[4] < Pos[1])  Pos[6] += 180;
  92.     else if(!(Pos[3] > Pos[0] && Pos[4] > Pos[1]))
  93.     {
  94.         Pos[6] *= float(-1);
  95.         Pos[6] += float((Pos[3] > Pos[0] && Pos[4] < Pos[1]) ? (90) : (270));
  96.         Pos[6] -= float(90);
  97.     }
  98.     SetObjectRot(cowly_cow, 0, 0, Pos[6]);
  99.     MoveObject(cowly_cow, Pos[3], Pos[4], Pos[5] + 1.2, GetPlayerSpeed(loser) + 7.8);
  100. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement