Help plox
#1

Hey guys.

I have a question.
Like when I do SetPlayerPos the player automaticly gets out of the vehicle. How to let him stay in the car?
Thanks
Reply
#2

pawn Код:
if(IsPlayerInAnyVehicle(playerid))
{
    SetPlayerPos(.....)
}
else
{
    SetPlayerPos(.....)
}
Reply
#3

If their in the driver seat I think you need to do RemovePlayerFromVehicle(playerid); but, I am unsure.
Reply
#4

He must stay in the vehicle. So the vehicle and himself will both fly.
Reply
#5

Oh, So you wan't to make it so they can't exit the vehicle. Well you could make it so... You set a variable like "InFlight" and when they exit the vehicle if their "InFlight" == 1 it will PutPlayerInVehicle(playerid, vehicleid, 0);

0 = Driver Seat btw
Reply
#6

Well i don't think I need that :P I just want that the player stays in the vehicle when I set his pos.
Reply
#7

return 0. if id == in vehicle then return 0

wow .. L<.<@ mister
Reply
#8

I'll try
Reply
#9

Quote:
Originally Posted by bartje01
Посмотреть сообщение
Well i don't think I need that :P I just want that the player stays in the vehicle when I set his pos.
Exactly, And that insures if they tried to exit it would put them right back. I believe.

Quote:
Originally Posted by Kar
Посмотреть сообщение
return 0. if id == in vehicle then return 0

wow .. L<.<@ mister
Don't be rude now. I was thinking of that but, I assumed that was outside of SAMP and when you press F it will make you exit the vehicle anyway and OnPlayerExitVehicle was just a public to check when you actually did.
Reply
#10

It takes a delay for users to exit the vehicle so you would have to start a timer and make them re-enter it.

pawn Код:
new MyVehicle[MAX_PLAYERS];

public OnPlayerStateChange(playerid, newstate, oldstate) {
     if(newstate == PLAYER_STATE_DRIVER) MyVehicle[playerid] = GetPlayerVehicleID(playerid);
     return 1;
}

public OnPlayerExitVehicle(playerid, vehicle) {
     // SendClientMessage(playerid, 0xFFFFFFFF, "You can't exit >:]");
     SetTimerEx("PlacePlayerBackInVehicle", 5000, 0, "i", playerid);
     return 1;
}

forward PlacePlayerBackInVehicle(playerid);
public PlacePlayerBackInVehicle(playerid) {
     PutPlayerInVehicle(playerid, MyVehicle[playerid], 0);
     return 1;
}
I just coded this at the spot, so if you find any bugs, post it.

Edit: There's no function to force a player to stay in the vehicle.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)