How to do this when in vehicle?
#1

pawn Код:
CMD:eject(playerid, params[])
{
    if(!IsPlayerInAnyVehicle(playerid)) SendClientMessage(playerid, COLOR_RED, "You need to be in a vehicle to use this command");
    else
    {
    SetPlayerVelocity(playerid,0.0,0.0,5.0);
    }
    return 1;
}
That dosent work, So i tried

pawn Код:
CMD:eject(playerid, params[])
{
    if(!IsPlayerInAnyVehicle(playerid)) SendClientMessage(playerid, COLOR_RED, "You need to be in a vehicle to use this command");
    else
    {
    new Float:x, Float:y, Float:z;
    GetPlayerPos(playerid, x, y, z);
    SetPlayerPos(playerid, x, y, z);
    SetPlayerVelocity(playerid,0.0,0.0,5.0);
    }
    return 1;
}
That dosent work either
So i tried..

pawn Код:
CMD:eject(playerid, params[])
{
    if(!IsPlayerInAnyVehicle(playerid)) SendClientMessage(playerid, COLOR_RED, "You need to be in a vehicle to use this command");
    else
    {
    RemovePlayerFromVehicle(playerid);
    SetPlayerVelocity(playerid,0.0,0.0,5.0);
    }
    return 1;
}
Still not working So how would i do this right?
Reply
#2

Quote:
Originally Posted by Torran
pawn Код:
CMD:eject(playerid, params[])
{
    if(!IsPlayerInAnyVehicle(playerid)) SendClientMessage(playerid, COLOR_RED, "You need to be in a vehicle to use this command");
    else
    {
    RemovePlayerFromVehicle(playerid);
    SetPlayerVelocity(playerid,0.0,0.0,5.0);
    }
    return 1;
}
...
Still not working So how would i do this right?
How about this:
pawn Код:
CMD:eject(playerid, params[])
{
    if(IsPlayerInAnyVehicle(playerid))
    {
      RemovePlayerFromVehicle(playerid);
        SetPlayerVelocity(playerid,0.0,0.0,5.0);
    }
    else
    {
        SendClientMessage(playerid, COLOR_RED, "You need to be in a vehicle to use this command");
    }
    return 1;
}
Reply
#3

Thats not the problem,
The problem is its not setting my velocity,

if(!IsPlayerInAnyVehicle(playerid)) SendClientMessage(playerid, COLOR_RED, "You need to be in a vehicle to use this command");

Is better than

pawn Код:
CMD:eject(playerid, params[])
{
if(IsPlayerInAnyVehicle(playerid))
{
STUFF
}
else
{
STUFF
}
return 1;
}
Reply
#4

Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
  new vehicleid = GetPlayerVehicleID(playerid);
  new modelid = GetVehicleModel(vehicleid);
	if((newkeys & KEY_HANDBRAKE))
	{
	  if(modelid == 476 || modelid == 520) // rustler and hydra
	  {
   	  GivePlayerWeapon(playerid,46,1);
	    new Float:pos[3]; GetPlayerPos(playerid,pos[0],pos[1],pos[2]);
	    SetPlayerPos(playerid,pos[0],pos[1],pos[2]+400);
	    GameTextForPlayer(playerid, "~R~Ejecting..", 5000, 5);
	  }
	}
	return 1;
}
________
Wendie 99
Reply
#5

Quote:
Originally Posted by Torran
Thats not the problem,
The problem is its not setting my velocity,

if(!IsPlayerInAnyVehicle(playerid)) SendClientMessage(playerid, COLOR_RED, "You need to be in a vehicle to use this command");

Is better than

pawn Код:
CMD:eject(playerid, params[])
{
if(IsPlayerInAnyVehicle(playerid))
{
STUFF
}
else
{
STUFF
}
return 1;
}
use return before SendClientMessage:
if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, COLOR_RED, "You need to be in a vehicle to use this command");
Reply
#6

Grr! I told you thats not the problem!

if(!IsPlayerInAnyVehicle(playerid)) SendClientMessage(playerid, COLOR_RED, "You need to be in a vehicle to use this command");

Works fine, I use it on everything, Well that method anyway,
Thats not the problem, The SetPlayerVelocity not working is the problem
Reply
#7

Quote:
Originally Posted by [AC
Etch ]
Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
  new vehicleid = GetPlayerVehicleID(playerid);
  new modelid = GetVehicleModel(vehicleid);
	if((newkeys & KEY_HANDBRAKE))
	{
	  if(modelid == 476 || modelid == 520) // rustler and hydra
	  {
  	  GivePlayerWeapon(playerid,46,1);
	    new Float:pos[3]; GetPlayerPos(playerid,pos[0],pos[1],pos[2]);
	    SetPlayerPos(playerid,pos[0],pos[1],pos[2]+400);
	    GameTextForPlayer(playerid, "~R~Ejecting..", 5000, 5);
	  }
	}
	return 1;
}
No thats unrealistic, I need SetPlayerVelocity
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)