SA-MP Forums Archive
Lift speed? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Lift speed? (/showthread.php?tid=397156)



Lift speed? - Louris - 03.12.2012

I try'ed to make that when lift starts move upwards, speed 2.0, after 1 second 3.0, after 3 seconds 4.0 after 5 seconds 5.0 and after 7 seconds 3.0, but i had many of errors, so i removed this code, can somebody show my how to do that?


Re: Lift speed? - Cypress - 03.12.2012

Using a timer.

pawn Код:
new ELSpeed,
         ELTimer;

ELTimer = SetTimer("ElevatorSpeed", 1000, true);

forward ElevatorSpeed();

public ElevatorSpeed()
{
        ELSpeed ++;
        if(ELSpeed == 1)
        {
             // Set your elevators object Speed
        }
        else if(ELSpeed == 6) // after 6 seconds
        {
             // Set your elevators object speed
        }
        else if(ELSpeed == 10) // after 10 seconds
        {
             // Stop elevator
             KillTimer(ELTimer);
             ELSpeed = 0;
        }
        return 1;
}



Re: Lift speed? - Louris - 04.12.2012

Mhm, lift doesn't accelerating it moves in 2.0 speed only, maybe i something doing wrong?
Код:
new Liftspeed;
new Lifttimer;
Код:
forward Liftspeed();

public Liftospeed()

public OnGameModeInit()
{
Lifttimer = SetTimer("liftspeed", 1000, true);
Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if( newkeys == KEY_HORN )
    {
        if(IsPlayerInRangeOfPoint(playerid, 20.0 , 1477.21, 1750.11, 9.29))
        {
            if(GetPVarInt(playerid, "liftas") == 0)
            {
                MoveDynamicObject(liftas, 1480.31, 1746.09, 96.01, 5.0);
                SetPVarInt(playerid, "liftas", 1);
                GameTextForPlayer(playerid, "~G~ Keliates Aukstyn!", 2000, 5);
            }
        }
        if(IsPlayerInRangeOfPoint(playerid, 20.0 , 1480.31, 1746.09, 96.01))
        {
            if(GetPVarInt(playerid, "liftas") == 1)
            {
                Liftspeed ++;
                if(Liftspeed == 1)
        {
                MoveDynamicObject(liftas, 1481.07, 1744.07, 9.35, 2.0);
        }
                else if(Liftspeed == 6) // after 6 seconds
        {
                MoveDynamicObject(liftas, 1481.07, 1744.07, 9.35, 5.0);
        }
                SetPVarInt(playerid, "liftas", 0);
                GameTextForPlayer(playerid, "~R~ Keliates zemyn!", 2000, 5);
            }
        }
    }
    return 1;
}
And 1 warning C:\Users\Lauryno\Desktop\Servas\filterscripts\obje ktai.pwn(31) : warning 204: symbol is assigned a value that is never used: "Lifttimer"


Re: Lift speed? - Louris - 04.12.2012

BUMP