Job Help.
#1

Hello guys. I have a problem, i try to remove a player from a vehicle if he enter in another car job, not in his car job. If you understand what i mean. Can someone help ? I can't speak more about it becauze isn't something to say.
Reply
#2

pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if(newstate == PLAYER_STATE_DRIVER)
    {
        if(PlayerInfo[playerid][Job] != truck_driver* && GetPlayerVehicleID(playerid) == Truck**)
        {
            SendClientMessage(playerid,-1,"You are not the trucker.");
            RemovePlayerFromVehicle(playerid);
        }
    }
}
*You have to write in your job id, or method you use to determinate job id.
**Truck would be a carid you created before

For bikes, you will have to freeze player for like half second.
Reply
#3

ikey07's example, with this:
pawn Код:
RemovePlayerFromVehicle(playerid)
{
    new Float:t_x, Float:t_y, Float:t_z, Float:t_s, t_v = GetPlayerVehicleID(playerid);

    GetVehicleModelInfo(GetVehicleModel(t_v), VEHICLE_MODEL_INFO_SIZE, t_s, t_s, t_s);
    GetVehiclePos(t_v, t_x, t_y, t_z);

    //Place the player on top of the vehicle...
    SetPlayerPos(playerid, t_x, t_y, t_z + (t_s / 2.0) + 0.5);
}
Reply
#4

U could give us a code.
Reply
#5

(Smartphone)

You cant kick a player from a vehicle while he is entering the car. Because... hes simply not in yet. You got 2 options. I recommend Option one because it will stop the player directly at the Moment he attemp to enter.

1. OnPlayerEnterVehicle
Check if its a jobcar and not bis one. Then just use "ClearAnimations(playerid);" to stop him. Dont use "SetPlayerPos"! To much code.

2. given above
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)