Car exiting
#1

Hi.

How do make it:

If you want exit car, but car is driving still, then you need wait while car isn't driving or stopped and you can exit car.

Is that possible or not?
Reply
#2

PHP код:
new MPH[MAX_PLAYERS]
public 
OnPlayerKeyStateChange(playeridnewkeysoldkeys)
{
if(
newkeys == KEY_ENTER)//maybe :S
    
{
     new 
MPH[playerid] = GetPlayerSpeed(playerid,bool:kmh);
            if(
MPH[playerid] == 0) {
            
//vehicle left, i don't know :D
            
}
return 
1;

PHP код:
stock GetPlayerSpeed(playerid,bool:kmh)
{
  new 
Float:Vx,Float:Vy,Float:Vz,Float:rtn;
  if(
IsPlayerInAnyVehicle(playerid)) GetVehicleVelocity(GetPlayerVehicleID(playerid),Vx,Vy,Vz); else GetPlayerVelocity(playerid,Vx,Vy,Vz);
  
rtn floatsqroot(floatabs(floatpower(Vx Vy Vz,2)));
  return 
kmh?floatround(rtn 100 1.61):floatround(rtn 100);

if the enter key is delefined it's possible
Reply
#3

Isn't it KEY_EXIT_VEHICLE?
Reply
#4

yes. maybe.
Reply
#5

maybe means yes or no + dont use php tag does pawn look like php coding to u? its pawn
[
pawn]


[
/pawn]
Reply
#6

KEY_SECONDARY_ATTACK is the key you use to enter and exit a vehicle(Enter & 'F').

pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if(IsPlayerInAnyVehicle(playerid) && (newkeys & KEY_SECONDARY_ATTACK))
    {
        new mph = GetPlayerSpeed(playerid, false);
        if(mph > 0)
        {
            GameTextForPlayer(playerid, "~r~Exit when car is stopped", 3000, 6);
            PutPlayerInVehicle(playerid, GetPlayerVehicleID(playerid), GetPlayerVehicleSeat(playerid));
        }
    }
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)