how to make this NOS timer system working like in RL?
#1

hey guys,

i have made some things witrh NOS system, but then when i conpiled and started server it constantly crashed... it was very nice but it made the server crash so i removed it...

anyways my question is: how can i make this NOS system like it is in RL? like in fast and furious... when they press the N20 button they get a hughe boost and the screen gets shaky etc...

anyways here is my nos codes:
pawn Код:
if(newkeys & KEY_FIRE)
    {
        if(GetPlayerSpeed(playerid) >= 140)
        {
                new vid = GetPlayerVehicleID(playerid);
                new Float:dis = 0.24;
                new Float:T[4];
                GetVehicleVelocity(vid, T[0], T[1], T[2]);
                GetVehicleZAngle(vid, T[3]);
                SetVehicleVelocity(vid,floatadd(T[0],floatmul(dis,floatsin(-T[3],degrees))), floatadd(T[1],floatmul(dis,floatcos(-T[3],degrees))), T[2]);
                return 1;
        }
        else if(GetPlayerSpeed(playerid) <= 140) return 0;
    }
thats under onplayerkeystatechange

pawn Код:
stock GetPlayerSpeed(playerid)
{
    new Float:ST[4];
    if(IsPlayerInAnyVehicle(playerid))
    GetVehicleVelocity(GetPlayerVehicleID(playerid),ST[0],ST[1],ST[2]);
    else GetPlayerVelocity(playerid,ST[0],ST[1],ST[2]);
    ST[3] = floatsqroot(floatpower(floatabs(ST[0]), 2.0) + floatpower(floatabs(ST[1]), 2.0) + floatpower(floatabs(ST[2]), 2.0)) * 179.28625;
    return floatround(ST[3]);
}
the stock for it

and now i had made with some timers and variables that when they were over 140 kmh they could press LMB and they get a boost, but then after 2 seconds the nos get removed and after 15 seconds they can use their NOS again and they get nos...

and in the code it all seemed to be alright etc, but it made my server crash so i removed it

anyways does anyone can make a small simple code for me that doesnt makes my server crash?

also is it possible to let the screen shake in samp like in gta sa single player when press NOS? it would be really nice

greets niels
Reply
#2

you dont need this line
pawn Код:
else if(GetPlayerSpeed(playerid) <= 140) return 0;
Reply
#3

yeah, but my question is how to make it as i asked... XD
anyways thnx
Reply
#4

pawn Код:
if(newkeys & KEY_FIRE)
{
    if(GetPlayerSpeed(playerid) >= 140)
    {
        new vid = GetPlayerVehicleID(playerid);
        new Float:dis = 0.24;
        new Float:T[4];
        GetVehicleVelocity(vid, T[0], T[1], T[2]);
        GetVehicleZAngle(vid, T[3]);
        SetVehicleVelocity(vid, (T[0]+(dis*floatsin(T[3],degrees)*-1)), (T[1]+(dis*floatcos(T[3],degrees))), T[2]);
        return 1;
    }
    return 0;
}

pawn Код:
stock GetPlayerSpeed(playerid)
{
    new Float:ST[4];
    if(IsPlayerInAnyVehicle(playerid))
    {
        GetVehicleVelocity(GetPlayerVehicleID(playerid),ST[0],ST[1],ST[2]);
    }
    else
    {
        GetPlayerVelocity(playerid,ST[0],ST[1],ST[2]);
    }
    ST[3] = floatsqroot(ST[0]*ST[0] + ST[1]*ST[1] + ST[2]*ST[2]) * 179.28625;
    return floatround(ST[3]);
}
If it still crashes, it's most likely something else.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)