Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // By Mean
- #define FILTERSCRIPT
- #include <a_samp>
- #include <foreach>
- #include <zcmd>
- #define abs(%0) ((%0) >= 0 ? (%0) : -(%0))
- #define PUB:%0(%1) forward public %0(%1); public %0(%1)
- new CowObject[MAX_PLAYERS][2];
- new StreamTimer;
- new PlayerHasCow[MAX_PLAYERS];
- stock StopCowFollow(playerid) {
- PlayerHasCow[playerid] = 0;
- KillTimer(StreamTimer);
- for(new i=0; i<sizeof(CowObject); ++i) DestroyObject(CowObject[playerid][i]);
- StopAudioStreamForPlayer(playerid);
- }
- stock StartCowFollow(playerid) {
- new Float:pos[3];
- GetPlayerPos(playerid, pos[0], pos[1], pos[2]);
- CowObject[playerid][0] = CreateObject(16442, pos[0] + 10, pos[1] + 10, pos[2], 0.0, -76.0, 0.0);
- MoveObject(CowObject[playerid][0], pos[0], pos[1], pos[2], 11.0);
- CowObject[playerid][1] = CreateObject(335, 1.89596, -0.42760, 0.17158, 0.0, 0.0, 0.0);
- AttachObjectToObject(CowObject[playerid][1], CowObject[playerid][0], 0.65, -0.4, -1.7, 0.0, 0.0, 0.0, 0);
- PlayerHasCow[playerid] = 1;
- PlayAudioStreamForPlayer(playerid, "http://ge.tt/api/1/files/9l5QsKZ/0/blob?download");
- StreamTimer = SetTimerEx("CowStream", 4000, 1, "i", playerid);
- }
- stock IsObjectInRangeOfPoint( Float:radi, objectid, Float:x, Float:y, Float:z ) {
- new Float:oldposx, Float:oldposy, Float:oldposz;
- new Float:tempposx, Float:tempposy, Float:tempposz;
- GetObjectPos( objectid, oldposx, oldposy, oldposz );
- tempposx = ( oldposx -x );
- tempposy = ( oldposy -y );
- tempposz = ( oldposz -z );
- if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi))) {
- return 1;
- }
- return 0;
- }
- public OnFilterScriptInit() {
- printf("COWS COWS COWS");
- return 1;
- }
- public OnPlayerDisconnect(playerid) {
- StopCowFollow(playerid);
- return 1;
- }
- public OnPlayerDeath(playerid) {
- StopCowFollow(playerid);
- return 1;
- }
- public OnObjectMoved(objectid) {
- foreach(Player, playerid) {
- if(CowObject[playerid][0] == objectid) {
- new Float:pos[3];
- GetPlayerPos(playerid, pos[0], pos[1], pos[2]);
- // THIS PART OF CODE IS FROM HIDDOS'S SCRIPT
- new Float:Pos[7];
- GetObjectPos(CowObject[playerid][0], Pos[0], Pos[1], Pos[2]);
- if(IsPlayerInAnyVehicle(playerid)) GetVehiclePos(GetPlayerVehicleID(playerid), Pos[3], Pos[4], Pos[5]);
- else GetPlayerPos(playerid, Pos[3], Pos[4], Pos[5]);
- Pos[3] += float(random(10) - 5);
- Pos[4] += float(random(10) - 5);
- Pos[6] = atan( floatdiv(abs(Pos[4] - Pos[1]), abs(Pos[3] - Pos[0])) );
- if(Pos[3] < Pos[0] && Pos[4] < Pos[1]) Pos[6] += 180;
- else if(!(Pos[3] > Pos[0] && Pos[4] > Pos[1])) {
- Pos[6] *= float(-1);
- Pos[6] += float((Pos[3] > Pos[0] && Pos[4] < Pos[1]) ? (90) : (270));
- Pos[6] -= float(90);
- }
- // END HIDDOS CODE
- MoveObject(CowObject[playerid][0], pos[0], pos[1], pos[2], 10, 0.0, -76.0, Pos[6]);
- if(IsObjectInRangeOfPoint(4.0, CowObject[playerid][0], pos[0], pos[1], pos[2]) && GetPlayerState(playerid) != PLAYER_STATE_WASTED) {
- SetPlayerHealth(playerid, 0);
- SendClientMessage(playerid, 0xFF0000AA, "You just got killed by the KILLER COW!");
- }
- }
- }
- return 1;
- }
- CMD:cowon(playerid, params[]) {
- if(PlayerHasCow[playerid] == 1) return SendClientMessage(playerid, -1, "You already have a pet cow.");
- StartCowFollow(playerid);
- SendClientMessage(playerid, -1, "You're SO DEAD!");
- return 1;
- }
- CMD:cowoff(playerid, params[]) {
- if(PlayerHasCow[playerid] == 0) return SendClientMessage(playerid, -1, "You don't have a pet cow, get one now @ /cowon!");
- StopCowFollow(playerid);
- SendClientMessage(playerid, -1, "You've stopped the cow!");
- return 1;
- }
- PUB:CowStream(playerid) {
- PlayAudioStreamForPlayer(playerid, "http://ge.tt/api/1/files/9l5QsKZ/0/blob?download");
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment