Constant speed function
#1

I need something like this, WHen a player has true for certain variable and drives a car , the speed should automatically boost (like 2x or 1.5x) without a need for tapping a specific button, How can i do this plz help
Reply
#2

OnPlayerUpdate
What u looking for just Put ur code there and it will automatickpy update
Reply
#3

Try this on for size.

pawn Код:
forward BoostTime(playerid);

//When you start the boost
SetPVarInt(playerid,"BoostTime",SetTimerEx("BoostTime",2000,1,"d",playerid));

public BoostTime(playerid)
{
    new
        Float:x,
        Float:y,
        Float:z,
        Float:v = GetPlayerVehicleID(playerid);
       
    GetVehicleVelocity(v,x,y,z);
    SetVehicleVelocity(v,x*1.3,y*1.3,z*1.3);
    return 1;
}

//When you stop the boost
KillTimer(GetPVarInt(playerid,"BoostTime"));
You'll probably want to play around with the time on the timer so he doesn't just constantly accelerate until he goes way too fast.
Reply
#4

If i have about 30 players driving at a time, will all those timers cause me lag? and i need to add that function under onplayerstatechange (driver state) right? and how can i set like it should speed after reaching certain speed? Like where should i use getvehiclespeed function and know if speed if greater than certain limit and if so add that function. So where to add?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)