Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
- /// ///
- /// This script requires Kalcor's (Kye) MapAndreas plugin to work! ///
- /// ///
- //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
- #include <a_samp>
- #include <mapandreas>
- #define COLOR_BLUE 0x0000FFFF
- new Cow[MAX_PLAYERS] = {-1,-1,...};
- new CowTimer[MAX_PLAYERS];
- forward OnCowUpdate(playerid);
- public OnFilterScriptInit()
- {
- print(" ______________________________________");
- print("| |");
- print("| The Cowly Cow FilterScript |");
- print("| Originally produced by Hiddos |");
- print("| Rape it McFaik |");
- print("|______________________________________|");
- MapAndreas_Init(MAP_ANDREAS_MODE_FULL);
- return 1;
- }
- public OnPlayerDisconnect(playerid, reason)
- {
- if(Cow[playerid] != -1)
- {
- DestroyObject(Cow[playerid]);
- Cow[playerid] = -1;
- KillTimer(CowTimer[playerid]);
- }
- return 1;
- }
- public OnPlayerCommandText(playerid, cmdtext[])
- {
- if(!strcmp("/ride", cmdtext, true))
- {
- new Float:x, Float:y, Float:z;
- if(Cow[playerid] != -1)
- {
- GetObjectPos(Cow[playerid], x, y, z);
- DestroyObject(Cow[playerid]);
- SendClientMessage(playerid,COLOR_BLUE,"You've stopped enjoying a ride on a cow.");
- Cow[playerid] = -1;
- TogglePlayerSpectating(playerid,0);
- SetPlayerPos(playerid, x, y, z);
- KillTimer(CowTimer[playerid]);
- return 1;
- }
- new Float:a;
- GetPlayerPos(playerid,x,y,z);
- GetPlayerFacingAngle(playerid,a);
- a+=90;
- Cow[playerid] = CreateObject(16442,x+5,y,z+2,0,0,a);
- SendClientMessage(playerid,COLOR_BLUE,"You've climbed into the head of a cow and are now in full control of her brain.");
- TogglePlayerSpectating(playerid,1);
- OnCowUpdate(playerid);
- CowTimer[playerid] = SetTimerEx("OnCowUpdate", 30, 1, "d", playerid);
- return 1;
- }
- return 0;
- }
- public OnCowUpdate(playerid)
- {
- new Keys[3];
- new Float:Pos[7]; //x-y-z-X-Y-Z-a
- GetPlayerKeys(playerid, Keys[0], Keys[1], Keys[2]); // Keys - Left/Right Value - Up/Down Value
- GetObjectRot(Cow[playerid], Pos[0], Pos[1], Pos[6]);
- GetObjectPos(Cow[playerid], Pos[0], Pos[1], Pos[2]);
- if(Keys[2] != 0)
- {
- 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));
- }
- Pos[6] += 90;
- if(Keys[1] < 0)
- {
- Pos[3] = Pos[0] - (((Keys[0] & KEY_SPRINT) ? (0.58) : (0.26)) * floatsin(-Pos[6], degrees));
- Pos[4] = Pos[1] - (((Keys[0] & KEY_SPRINT) ? (0.58) : (0.26)) * floatcos(-Pos[6], degrees));
- MapAndreas_FindZ_For2DCoord(Pos[3], Pos[4], Pos[5]);
- if(Pos[5] - Pos[2] < 4)
- {
- if(Pos[2] - Pos[5] > 4.5) SetObjectPos(Cow[playerid], Pos[3], Pos[4], Pos[2] - 0.6);
- else SetObjectPos(Cow[playerid], Pos[3], Pos[4], Pos[5] + 2);
- }
- SetPlayerCameraLookAt(playerid, Pos[3], Pos[4], Pos[((Pos[2] - Pos[5] > 4.5) ? (2):(5))]+ 2.5);
- Pos[3] += (7.8 * floatsin(-Pos[6], degrees));
- Pos[4] += (7.8 * floatcos(-Pos[6], degrees));
- SetPlayerCameraPos(playerid,Pos[3], Pos[4], Pos[2] + 3.2);
- }
- else if(Keys[1] > 0)
- {
- Pos[3] = Pos[0] + (0.2 * floatsin(-Pos[6], degrees));
- Pos[4] = Pos[1] + (0.2 * floatcos(-Pos[6], degrees));
- MapAndreas_FindZ_For2DCoord(Pos[3], Pos[4], Pos[5]);
- if(Pos[5] - Pos[2] < 2)
- {
- if(Pos[2] - Pos[5] > 4.5) SetObjectPos(Cow[playerid], Pos[3], Pos[4], Pos[2] - 0.6);
- else SetObjectPos(Cow[playerid], Pos[3], Pos[4], Pos[5] + 2);
- }
- SetPlayerCameraLookAt(playerid, Pos[3], Pos[4], Pos[((Pos[2] - Pos[5] > 4.5) ? (2):(5))] + 2.5);
- Pos[3] = Pos[0] +(7.8 * floatsin(-Pos[6], degrees));
- Pos[4] = Pos[1] +(7.8 * floatcos(-Pos[6], degrees));
- SetPlayerCameraPos(playerid, Pos[3], Pos[4], Pos[2] + 3.2);
- }
- else
- {
- MapAndreas_FindZ_For2DCoord(Pos[0], Pos[1], Pos[5]);
- if(Pos[2] - Pos[5] > 4.5) SetObjectPos(Cow[playerid], Pos[0], Pos[1], Pos[2] - 0.6);
- SetPlayerCameraLookAt(playerid, Pos[0], Pos[1], Pos[2]+0.1);
- Pos[0] += (7 * floatsin(-Pos[6], degrees));
- Pos[1] += (7 * floatcos(-Pos[6], degrees));
- SetPlayerCameraPos(playerid, Pos[0], Pos[1], Pos[2]+2.9);
- }
- return;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement