Ask about earthquakes system
#15

Quote:
Originally Posted by Mionee
Посмотреть сообщение
Yeah, you can load the changes using a public or stock function which gets called after your earthquake ends.

As for the earthquake, it's kind of simple to do. Making an exact replica might be difficult but you can always create something similar.

http://www.youtube.com/watch?v=2Vne9IKB7rw

My code might not be the best but you could use it as an example.

pawn Код:
#include <a_samp>
#include <zcmd>

new Float: playerPrevPos[MAX_PLAYERS][3];
new playerQuakeProg[MAX_PLAYERS];
new playerQuakeTimer[MAX_PLAYERS];

CMD:earthquake(playerid)
{
    new Float:Pos[3];

    SendClientMessage(playerid, -1, "Earthquake started");

    GetPlayerPos(playerid, Pos[0], Pos[1], Pos[2]);
    PlayAudioStreamForPlayer(playerid, "http://damianc.us/anniversary/earthquake_sound.mp3");

    SetPlayerDrunkLevel(playerid, 5001);
    SetPlayerWeather(playerid, 19);

    playerPrevPos[playerid][0] = Pos[0];
    playerPrevPos[playerid][1] = Pos[1];
    playerPrevPos[playerid][2] = Pos[2];

    SetPlayerVelocity(playerid, 0.0, 0.0, 0.05);
    playerQuakeTimer[playerid] = SetTimer("VelocityModeOne", 500, true);

    return 1;
}

forward VelocityModeOne(playerid);
public VelocityModeOne(playerid)
{
    if(playerQuakeProg[playerid] == 0)
    {
        if(GetPlayerState(playerid) == PLAYER_STATE_ONFOOT)
        {
            SetPlayerPos(playerid, playerPrevPos[playerid][0], playerPrevPos[playerid][1], playerPrevPos[playerid][2]);
        }
       
        else if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
        {
            SetVehiclePos(GetPlayerVehicleID(playerid), playerPrevPos[playerid][0], playerPrevPos[playerid][1], playerPrevPos[playerid][2]);
        }

        playerQuakeProg[playerid] = 1;
    }
   
    else if(playerQuakeProg[playerid] > 0)
    {
        switch(random(3))
        {
            case 0:
            {
                if(GetPlayerState(playerid) == PLAYER_STATE_ONFOOT) SetPlayerVelocity(playerid, 0.03, 0.0, 0.05);
                else if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER) SetVehicleVelocity(GetPlayerVehicleID(playerid), 0.03, 0.0, 0.05);
            }

            case 1:
            {
                if(GetPlayerState(playerid) == PLAYER_STATE_ONFOOT) SetPlayerVelocity(playerid, 0.05, 0.0, 0.02);
                else if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER) SetVehicleVelocity(GetPlayerVehicleID(playerid), 0.05, 0.0, 0.02);
            }
           
            case 2:
            {
                if(GetPlayerState(playerid) == PLAYER_STATE_ONFOOT) SetPlayerVelocity(playerid, 0.01, 0.05, 0.03);
                else if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER) SetVehicleVelocity(GetPlayerVehicleID(playerid), 0.05, 0.0, 0.02);
            }
        }

        SetPlayerDrunkLevel(playerid, 50000);
        playerQuakeProg[playerid] += 1;

        if(playerQuakeProg[playerid] > 6)
        {
            KillTimer(playerQuakeTimer[playerid]);
            SetTimer("VelocityModeTwo", 500, false);
        }
    }

    return 1;
}

forward VelocityModeTwo(playerid);
public VelocityModeTwo(playerid)
{
    SetPlayerDrunkLevel(playerid, 0);
    SetPlayerWeather(playerid, 0);

    playerQuakeProg[playerid] = 0;
    StopAudioStreamForPlayer(playerid);

    SendClientMessage(playerid, -1, "Earthquake ended");

    return 1;
}
Just effect? and how about after earthquake map is broken?
Reply


Messages In This Thread
Ask about earthquakes system - by TheFirst - 18.05.2014, 17:40
Re: Ask about earthquakes system - by Redirect Left - 18.05.2014, 17:45
Re: Ask about earthquakes system - by TheFirst - 18.05.2014, 17:47
Re: Ask about earthquakes system - by Kaperstone - 18.05.2014, 17:49
Re: Ask about earthquakes system - by TheFirst - 18.05.2014, 18:00
Re: Ask about earthquakes system - by Kindred - 18.05.2014, 18:02
Re: Ask about earthquakes system - by Calgon - 18.05.2014, 19:17
Re: Ask about earthquakes system - by LocMax - 18.05.2014, 19:25
Re: Ask about earthquakes system - by TheFirst - 18.05.2014, 19:27
Re: Ask about earthquakes system - by TheFirst - 18.05.2014, 19:30
Re: Ask about earthquakes system - by Khanz - 18.05.2014, 19:49
Re: Ask about earthquakes system - by TheFirst - 18.05.2014, 20:30
Re: Ask about earthquakes system - by Onfroi - 18.05.2014, 20:48
Re: Ask about earthquakes system - by Dignity - 18.05.2014, 20:49
Re: Ask about earthquakes system - by TheFirst - 18.05.2014, 21:00
Re: Ask about earthquakes system - by Dignity - 18.05.2014, 21:02
Re: Ask about earthquakes system - by GreenSt4lker - 18.05.2014, 21:04
Re: Ask about earthquakes system - by TheFirst - 18.05.2014, 21:06
Re: Ask about earthquakes system - by Basssiiie - 18.05.2014, 21:21
Re: Ask about earthquakes system - by TheFirst - 18.05.2014, 21:35
Re: Ask about earthquakes system - by beatsbydre - 18.05.2014, 21:50
Re: Ask about earthquakes system - by TheFirst - 18.05.2014, 21:57
Re: Ask about earthquakes system - by TheFirst - 18.05.2014, 21:59
Re: Ask about earthquakes system - by Damian - 18.05.2014, 22:06
Re: Ask about earthquakes system - by TheFirst - 18.05.2014, 22:13
Re: Ask about earthquakes system - by Abagail - 18.05.2014, 22:40
Re: Ask about earthquakes system - by Yves - 18.05.2014, 23:22
Re: Ask about earthquakes system - by Kindred - 19.05.2014, 13:05
Re: Ask about earthquakes system - by SaintMikey - 19.05.2014, 13:13
Re: Ask about earthquakes system - by Kindred - 19.05.2014, 13:18
Re: Ask about earthquakes system - by SaintMikey - 19.05.2014, 13:24
Re: Ask about earthquakes system - by Kindred - 19.05.2014, 15:27
Re: Ask about earthquakes system - by ZachKnoxx - 19.05.2014, 15:31
Re: Ask about earthquakes system - by FaceTutorialz - 20.05.2014, 10:46

Forum Jump:


Users browsing this thread: 2 Guest(s)