SA-MP Forums Archive
Freeze car in air? - 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: Freeze car in air? (/showthread.php?tid=297708)



Freeze car in air? - oliverrud - 17.11.2011

Is that possible, just looked through the functions and didn't see any function that would freeze a car.


Re: Freeze car in air? - moadi - 17.11.2011

I use something like this(using zCMD)


EDIT: wasn't paying attention while posting it, I'm not sure if there are a function for that but heres a simple way of freezing a vehicle and unfreezing in air or any other position.
pawn Код:
new
    isfrozen[MAX_PLAYERS],
    ftimer[MAX_PLAYERS];

CMD:freezecar(playerid,params[])
{

    if(isfrozen[playerid] == 1)
    {
        KillTimer(ftimer[playerid]);
        isfrozen[playerid] = 0;
        SCM(playerid,COLOR_LIGHTRED,"Your vehicle has been unfrozen!");
    }
    else if(isfrozen[playerid] == 0 || !isfrozen[playerid])
    {
    if(IsPlayerInAnyVehicle(playerid))
    {
        ftimer[playerid] = SetTimerEx("freeze",1,1,"i",playerid);
        isfrozen[playerid] = 1;
        SCM(playerid,COLOR_LIGHTRED,"Your vehicle has been frozen!");
    }
   
    }
    return 1;
}

forward freeze(playerid);
public freeze(playerid)
{
    SetVehicleVelocity(GetPlayerVehicleID(playerid),0,0,0);
    return 1;
}



Re: Freeze car in air? - oliverrud - 19.11.2011

No way if a player isn't in the car?


Re: Freeze car in air? - MP2 - 19.11.2011

SetVehicleVelocity(vehicleid, 0, 0, 0);

That in OnPlayerUpdate is your best shot, however it's not going to work great due to lag. I'd suggest possibly creating the 5002 object and setting the rx rotation to 180 - it's a massive runway that has no texture underneath so will be an invisible platform for the vehicle to rest on. Just keep it under the vehicle and players will never see it (unless they move the camera under the vehicle, but it's still really the only way.)


Re: Freeze car in air? - oliverrud - 19.11.2011

Nevermind