Commands & Vehicles
#1

Sup people.

I've got a very strange problem whilst scripting a gamemode, every command works whilst on foot, but when I enter a vehicle, teleport commands stop working. Even tough, commands like /rules and /help works in a vehicle also..I tried to move around and tweak the IsPlayerInVehicle checks in a teleport, but I still get UNKNOWN COMMAND error while typing a teleport inside a vehicle.

I've added these variables just right under OnPlayerCommandText:
Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
	new vehicleid = GetPlayerVehicleID(playerid);
	new State = GetPlayerState(playerid);
And here is an example of a teleport:
Код:
        if (strcmp("/lv", cmdtext, true, 10) == 0)
	{
	SetPlayerInterior(playerid, 0);
	if(IsPlayerInAnyVehicle(playerid) && State == PLAYER_STATE_DRIVER)
	{
	GameTextForPlayer(playerid,"Las Venturas",4000,6);
	return SetVehiclePos(vehicleid,2039.5549,1625.7263,10.6719);
	}
	SetPlayerPos(playerid,2039.5549,1625.7263,10.6719);
	GameTextForPlayer(playerid,"Las Venturas",4000,6);
	return 1;
}
Reply
#2

Create your variables in a more local scope (the if statement) for clarity, and make sure that you haven't added any redundant checks or have any broken commands (that retain missing curly brackets).
Reply
#3

Quote:
Originally Posted by __
Посмотреть сообщение
Create your variables in a more local scope (the if statement) for clarity, and make sure that you haven't added any redundant checks or have any broken commands (that retain missing curly brackets).
What do you mean by that? Could you give me an example of that? And I'll check the brackets.
Reply
#4

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    new vehicleid = GetPlayerVehicleID(playerid);
    new State = GetPlayerState(playerid);
         if (strcmp("/lv", cmdtext, true, 10) == 0)
    {
    if(IsPlayerInAnyVehicle(playerid) && State == PLAYER_STATE_DRIVER)
    {
    GameTextForPlayer(playerid,"Las Venturas",4000,6);
    SetPlayerInterior(playerid, 0);
        SetVehiclePos(vehicleid,2039.5549,1625.7263,10.6719);
    }

        else
{
    SetPlayerPos(playerid,2039.5549,1625.7263,10.6719);
    GameTextForPlayer(playerid,"Las Venturas",4000,6);
}
    return 1;
}
return 0;
}
Reply
#5

It's still unknown command with your method o.O.

EDIT: Fixed, problem was my animations.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)