Help with exit vehicle while in air.
#1

Ok I made a command that if on foot or in car /dive will give you a parachute and add 550 to your Z . It all works fine but when in air with car if i press enter to exit it doesnt until it hits the ground. How can i go around this?

Anyways heres my code for the /dive.
Код:
if(strcmp("/dive", cmdtext, true) == 0)
{
	if(IsPlayerInAnyVehicle(playerid))
	{
		new cdid;
		cdid = GetPlayerVehicleID(playerid); // Get the vehicle id
		new Float:cdx, Float:cdy, Float:cdz; // Variable for vehicle x,y,z
		GetVehiclePos(cdid,cdx,cdy,cdz); // Get the vehicle's x,y,z
		if(GetPlayerMoney(playerid) > 1000)
		{
			new Float:cdnz;
			cdnz = cdz + 550.0;
			GivePlayerMoney(playerid,-1000);
			GivePlayerWeapon(playerid,46,1);
			SetVehiclePos(cdid,cdx,cdy,cdnz);
			SendClientMessage(playerid, COLOR_ORANGE, "** Going Down? Enjoy The Fall **");
			return 1;
		}
		else
		{
    			SendClientMessage(playerid, COLOR_ORANGE, "** Don't Have Enough $ **");
    			return 1;
		}
	}
	else
	{
    		new Float:pdx, Float:pdy, Float:pdz;
		new Float:pdnz;
		GetPlayerPos(playerid, pdx, pdy, pdz);
		pdnz = pdz + 550.0;
		if(GetPlayerMoney(playerid) > 1000)
		{
      		GivePlayerMoney(playerid,-1000);
			GivePlayerWeapon(playerid,46,1);
			SetPlayerPos(playerid,pdx,pdy,pdnz);
			SendClientMessage(playerid, COLOR_ORANGE, "** Going Down? Enjoy The Fall **");
			return 1;
		}
		else
		{
			SendClientMessage(playerid, COLOR_ORANGE, "** Don't Have Enough $ **");
			return 1;
		}
	}

}
Reply
#2

pawn Код:
if (strcmp(cmdtext, "/exit", true)== 0)
    {
        if(IsPlayerInAnyVehicle(playerid))
        {
            RemovePlayerFromVehicle(playerid);
        }
        else
        {
            SendClientMessage(playerid, 0xFF0000AA, "Not in a vehicle");
        }
        return 1;
    }
Untested
Reply
#3

Yeah I tried that example and now what it does is waits til the vehicle is on the ground then it exits. I want to exit while in air.
Reply
#4

type /exit in air
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)