[HELP] OnPlayerEnterVehicle
#1

Here's a script:

pawn Код:
public OnPlayerEnterVehicle( playerid, vehicleid, ispassenger )
{
    new PlayerVehicle = GetVehicleFileID( GetPlayerVehicleID( playerid ) );
    if (Vehicles[PlayerVehicle][CarTeam] != 0 && Vehicles[PlayerVehicle][CarTeam] != Player[playerid][Team] && !ispassenger)
    {
    //clear
    }
    else
    {
        new Float:cx, Float:cy, Float:cz;
        GetPlayerPos(playerid, cx, cy, cz);
        SetPlayerPos(playerid, cx,  cy, cz);
    }
    return 1;
}
And the problem is:
If I am setted in 1st Team, I can't enter car, if Im in other Teams I still can't enter those cars. And I'm sure I have setted those cars for Team 1. So what I have done wrong?
Reply
#2

pawn Код:
public OnPlayerEnterVehicle( playerid, vehicleid, ispassenger )
{
    new PlayerVehicle = GetVehicleFileID( GetPlayerVehicleID( playerid ) );
    if ((Vehicles[PlayerVehicle][CarTeam] != 0) && (Vehicles[PlayerVehicle][CarTeam] != Player[playerid][Team]) && !ispassenger)
        RemovePlayerFromVehicle( playerid );
    return 1;
}
Just for fun, try that.
Reply
#3

pawn Код:
new PlayerVehicle = GetVehicleFileID( GetPlayerVehicleID( playerid ) );
    if ((Vehicles[PlayerVehicle][CarTeam] != 0) && (Vehicles[PlayerVehicle][CarTeam] != Player[playerid][Team]) && !ispassenger)
        RemovePlayerFromVehicle( playerid );
    SendClientMessage( playerid, WHITE, "Test" );
Same...
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)