Need a little help.
#1

When the passengers get into the taxi (instead of the driver), the command refused to enter the taxi and it says "You are not a Taxi Driver" it means that you have to become the taxi driver first to get into the vehicle. How to make it possible for a passengers to get into the taxi without joining the Taxi Driver job first, and forbidden for them to enter the 1st seat driver.

my public OnPlayerEnterVehicle
PHP код:
    if(PlayerInfo[playerid][pJobTaxi] == 1)
    {
        }
    else {
        if(
modelid == 420 || modelid == 438)
        {
            
RemovePlayerFromVehicle(playerid);
            
ClearAnimations(playerid);
            return 
SendClientMessage(playerid0xFF0000FF"You are not a Taxi Driver");
        }
        else if(
modelid == 420 || modelid == 438){
             
PutPlayerInVehicle(playeridvehicleid1);
        }
    } 
Thanks before.
Reply
#2

Use a state check... You've obviously got this code in the callback, but you aren't checking if they are a driver or a passenger.

You should almost be using OnPlayerStateChange as it's more reliable, but it could be done OnPlayerEnterVehicle by checking "ispassenger".
Reply
#3

Quote:
Originally Posted by Sew_Sumi
Посмотреть сообщение
Use a state check... You've obviously got this code in the callback, but you aren't checking if they are a driver or a passenger.

You should almost be using OnPlayerStateChange as it's more reliable, but it could be done OnPlayerEnterVehicle by checking "ispassenger".
can you give example ?
Reply
#4

Try this.

Код HTML:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
	if(newstate == PLAYER_STATE_DRIVER || newstate == PLAYER_STATE_PASSENGER)
	{
	    switch(GetVehicleModel(GetPlayerVehicleID(playerid)))
	    {
	        case 420, 438:
	        {
	            if(PlayerData[playerid][pJobTaxi])
	            {
	                //start a job
				}
				else
				{
				    RemovePlayerFromVehicle(playerid); //player is not a taxi driver, then remove him from vehicle
				    
				    SendClientMessage(playerid, 0xFF0000FF, "You are not a Taxi Driver");
				}
			}
		}
	}
	return true;
}
Reply
#5

Quote:
Originally Posted by Feynman
Посмотреть сообщение
Try this.

Код HTML:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
	if(newstate == PLAYER_STATE_DRIVER || newstate == PLAYER_STATE_PASSENGER)
	{
	    switch(GetVehicleModel(GetPlayerVehicleID(playerid)))
	    {
	        case 420, 438:
	        {
	            if(PlayerData[playerid][pJobTaxi])
	            {
	                //start a job
				}
				else
				{
				    RemovePlayerFromVehicle(playerid); //player is not a taxi driver, then remove him from vehicle
				    
				    SendClientMessage(playerid, 0xFF0000FF, "You are not a Taxi Driver");
				}
			}
		}
	}
	return true;
}
Solved Thanks
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)