Advertisement
Guest User

Hiddos

a guest
Sep 19th, 2010
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 4.51 KB | None | 0 0
  1. //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  2. ///                                                                                                                    ///
  3. ///                             This script requires Kalcor's (Kye) MapAndreas plugin to work!                         ///
  4. ///                                                                                                                    ///
  5. //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  6. #include <a_samp>
  7. #include <mapandreas>
  8. #define COLOR_BLUE 0x0000FFFF
  9. new Cow[MAX_PLAYERS] = {-1,-1,...};
  10. new CowTimer[MAX_PLAYERS];
  11. forward OnCowUpdate(playerid);
  12. public OnFilterScriptInit()
  13. {
  14.     print(" ______________________________________");
  15.     print("|                                      |");
  16.     print("|   The Cowly Cow FilterScript         |");
  17.     print("|  Originally produced by Hiddos       |");
  18.     print("|    Rape it                McFaik     |");
  19.     print("|______________________________________|");
  20.     MapAndreas_Init(MAP_ANDREAS_MODE_FULL);
  21.     return 1;
  22. }
  23.  
  24.  
  25. public OnPlayerDisconnect(playerid, reason)
  26. {
  27.     if(Cow[playerid] != -1)
  28.     {
  29.         DestroyObject(Cow[playerid]);
  30.         Cow[playerid] = -1;
  31.         KillTimer(CowTimer[playerid]);
  32.     }
  33.     return 1;
  34. }
  35.  
  36. public OnPlayerCommandText(playerid, cmdtext[])
  37. {
  38.     if(!strcmp("/ride", cmdtext, true))
  39.     {
  40.         new Float:x, Float:y, Float:z;
  41.         if(Cow[playerid] != -1)
  42.         {
  43.             GetObjectPos(Cow[playerid], x, y, z);
  44.             DestroyObject(Cow[playerid]);
  45.             SendClientMessage(playerid,COLOR_BLUE,"You've stopped enjoying a ride on a cow.");
  46.             Cow[playerid] = -1;
  47.             TogglePlayerSpectating(playerid,0);
  48.             SetPlayerPos(playerid, x, y, z);
  49.             KillTimer(CowTimer[playerid]);
  50.             return 1;
  51.         }
  52.         new Float:a;
  53.         GetPlayerPos(playerid,x,y,z);
  54.         GetPlayerFacingAngle(playerid,a);
  55.         a+=90;
  56.         Cow[playerid] = CreateObject(16442,x+5,y,z+2,0,0,a);
  57.         SendClientMessage(playerid,COLOR_BLUE,"You've climbed into the head of a cow and are now in full control of her brain.");
  58.         TogglePlayerSpectating(playerid,1);
  59.         OnCowUpdate(playerid);
  60.         CowTimer[playerid] = SetTimerEx("OnCowUpdate", 30, 1, "d", playerid);
  61.         return 1;
  62.     }
  63.     return 0;
  64. }
  65.  
  66.    
  67. public OnCowUpdate(playerid)
  68. {
  69.     new Keys[3];
  70.     new Float:Pos[7]; //x-y-z-X-Y-Z-a
  71.     GetPlayerKeys(playerid, Keys[0], Keys[1], Keys[2]); // Keys - Left/Right Value - Up/Down Value
  72.     GetObjectRot(Cow[playerid], Pos[0], Pos[1], Pos[6]);
  73.     GetObjectPos(Cow[playerid], Pos[0], Pos[1], Pos[2]);
  74.    
  75.     if(Keys[2] != 0)
  76.     {
  77.         SetObjectRot(Cow[playerid], 0, 0, ((Keys[2] > 0 && Keys[1] <= 0) || (Keys[2] < 0 && Keys[1] > 0)) ? (Pos[6] - 3.5) : (Pos[6] + 3.5));
  78.     }
  79.  
  80.     Pos[6] += 90;
  81.  
  82.     if(Keys[1] < 0)
  83.     {
  84.         Pos[3] = Pos[0] - (((Keys[0] & KEY_SPRINT) ? (0.58) : (0.26)) * floatsin(-Pos[6], degrees));
  85.         Pos[4] = Pos[1] - (((Keys[0] & KEY_SPRINT) ? (0.58) : (0.26)) * floatcos(-Pos[6], degrees));
  86.         MapAndreas_FindZ_For2DCoord(Pos[3], Pos[4], Pos[5]);
  87.         if(Pos[5] - Pos[2] < 4)
  88.         {
  89.             if(Pos[2] - Pos[5] > 4.5) SetObjectPos(Cow[playerid], Pos[3], Pos[4], Pos[2] - 0.6);
  90.             else SetObjectPos(Cow[playerid], Pos[3], Pos[4], Pos[5] + 2);
  91.         }
  92.        
  93.         SetPlayerCameraLookAt(playerid, Pos[3], Pos[4], Pos[((Pos[2] - Pos[5] > 4.5) ? (2):(5))]+ 2.5);
  94.         Pos[3] += (7.8 * floatsin(-Pos[6], degrees));
  95.         Pos[4] += (7.8 * floatcos(-Pos[6], degrees));
  96.         SetPlayerCameraPos(playerid,Pos[3], Pos[4], Pos[2] + 3.2);
  97.     }
  98.         else if(Keys[1] > 0)
  99.     {
  100.         Pos[3] = Pos[0] + (0.2 * floatsin(-Pos[6], degrees));
  101.         Pos[4] = Pos[1] + (0.2 * floatcos(-Pos[6], degrees));
  102.         MapAndreas_FindZ_For2DCoord(Pos[3], Pos[4], Pos[5]);
  103.         if(Pos[5] - Pos[2] < 2)
  104.         {
  105.             if(Pos[2] - Pos[5] > 4.5) SetObjectPos(Cow[playerid], Pos[3], Pos[4], Pos[2] - 0.6);
  106.             else SetObjectPos(Cow[playerid], Pos[3], Pos[4], Pos[5] + 2);
  107.         }
  108.  
  109.         SetPlayerCameraLookAt(playerid, Pos[3], Pos[4], Pos[((Pos[2] - Pos[5] > 4.5) ? (2):(5))] + 2.5);
  110.         Pos[3] = Pos[0] +(7.8 * floatsin(-Pos[6], degrees));
  111.         Pos[4] = Pos[1] +(7.8 * floatcos(-Pos[6], degrees));
  112.         SetPlayerCameraPos(playerid, Pos[3], Pos[4], Pos[2] + 3.2);
  113.     }
  114.         else
  115.     {
  116.         MapAndreas_FindZ_For2DCoord(Pos[0], Pos[1], Pos[5]);
  117.         if(Pos[2] - Pos[5] > 4.5) SetObjectPos(Cow[playerid], Pos[0], Pos[1], Pos[2] - 0.6);
  118.         SetPlayerCameraLookAt(playerid, Pos[0], Pos[1], Pos[2]+0.1);
  119.         Pos[0] += (7 * floatsin(-Pos[6], degrees));
  120.         Pos[1] += (7 * floatcos(-Pos[6], degrees));
  121.         SetPlayerCameraPos(playerid, Pos[0], Pos[1], Pos[2]+2.9);
  122.     }
  123.     return;
  124. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement