[Question] stop vehicle
#8

Quote:
Originally Posted by HellSphinX
Посмотреть сообщение
TogglePlayerControllable will freeze the player and stop his vehicle (if he's in one). Seems like you want the whole code, don't you?


Edit:

You also may declare a timer (like 500 ms) after you freeze the player (to stop his vehicle) to unfreeze him, if you want only the vehicle to be stopped.

Second-Edit: or just use https://sampwiki.blast.hk/wiki/SetVehicleVelocity
Why you want to use TogglePlayerControllable for it? You know that if you freeze a player, the vehicle is still going forward... So the best way to stop a vehicle, is using SetVehicleVelocity...

EDIT:
Try this code:
pawn Код:
#define FILTERSCRIPT
#include <a_samp>

#define PRESSED(%0) \
(((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0)))

#if defined FILTERSCRIPT

public OnFilterScriptInit()
{
    print("\n--------------------------------------");
    print(" Stop vehicle by Example 0.3");
    print("--------------------------------------\n");
    return 1;
}

public OnFilterScriptExit()
{
    return 1;
}

public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if(PRESSED(KEY_CROUCH))
    {
        if(!IsPlayerInAnyVehicle(playerid)) return 1;
        new
            Float:X,
            Float:Y,
            Float:Z,
            VehicleID = GetPlayerVehicleID(playerid);
        GetVehicleVelocity(VehicleID, X, Y, Z);
        SetVehicleVelocity(VehicleID, -X, -Y, -Z);
    }
    return 1;
}
#endif
Reply


Messages In This Thread
topic can delete - by mickos - 09.06.2012, 08:58
Re: [Question] stop vehicle - by [KHK]Khalid - 09.06.2012, 09:00
Re: [Question] stop vehicle - by mickos - 09.06.2012, 09:02
Re: [Question] stop vehicle - by [KHK]Khalid - 09.06.2012, 09:08
topic can delete - by mickos - 09.06.2012, 09:37
Re: [Question] stop vehicle - by [KHK]Khalid - 09.06.2012, 09:47
topic can delete - by mickos - 09.06.2012, 09:55
Re: [Question] stop vehicle - by BlackBank - 09.06.2012, 10:05
Re: [Question] stop vehicle - by [KHK]Khalid - 09.06.2012, 10:05
Re: [Question] stop vehicle - by FalconX - 09.06.2012, 10:13

Forum Jump:


Users browsing this thread: 3 Guest(s)