SA-MP Forums Archive
Job Help. - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Job Help. (/showthread.php?tid=600555)



Job Help. - LaLy17 - 09.02.2016

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.


Re: Job Help. - ikey07 - 09.02.2016

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.


Re: Job Help. - Crayder - 09.02.2016

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);
}



Re: Job Help. - N0FeaR - 10.02.2016

U could give us a code.


Re: Job Help. - GangstaSunny - 10.02.2016

(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