Train passenger
#1

Heey guys
How can i make that players need to buy first a ticket before they can enter a train as passenger?
I think something with Removeplayerfromvehicle but dont work at me!
Код:
for(new i = 0; i < GetMaxPlayers(); i++)
  	{
    if (IsPlayerInVehicle(i, 538) && GetPlayerState(i) == PLAYER_STATE_DRIVER)//I dont know how to make it in passenger:S
    {
            RemovePlayerFromVehicle(playerid);
            SendClientMessage(playerid,COLOR_RED,"You need to buy a ticket first!!.");
    }
Pls help
Thanks admigo
Reply
#2

add a variable like
at start
new Gotticket[MAX_PLAYERS];

and use Gotticket[playerid] =0; // 0 - disable , 1 - enable..
use control statements
Reply
#3

How can i do this?
Reply
#4

pawn Код:
new GotTrainTicket[MAX_PLAYERS];

public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if(oldstate == PLAYER_STATE_ONFOOT && newstate == PLAYER_STATE_PASSENGER)
    {
        if(GotTrainTicket[playerid] == 1)
        {
            SendClientMessage(playerid, 0xFFFFFFAA, "Enjoy the trip");
        }
        else
        {
            RemovePlayerFromVehicle(playerid);
            SendClientMessage(playerid, 0xFFFFFFAA, "You need a tricked to take this train!");
        }
    }
    return 1;
}
Reply
#5

Dont work It says that you need ticket but he dont removes you out the train:S
Reply
#6

Soooooooooo funny. I did a code exactly like this YESTERDAY!!!

Yeah, doesn't work. Set the player position like:

Код:
GetPlayerPos(playerid,x,y,z);
SetPlayerPos(playerid,x+2,y+2,z+2);
That seems like the only possible thing to do.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)