How can I disable exiting a vehicle?
#10

Quote:
Originally Posted by Tommy_Mandaz
Посмотреть сообщение
Код:
if(IsPlayerInVehicle(playerid, 571)) // 571 = KART ID
{
         SetPlayerPos(playerid, Randomspawnx, Randomspawny, Randomspawnz || playerid, Randomspawnx, Randomspawny, Randomspawnz || playerid, Randomspawnx, Randomspawny, Randomspawnz);
         return 1;
}
Ofcoarse change the randomspawnx, randomspawny, randomspawnz to the coords of the spawns... This should work.
^ Once again, don't do this. || (logical OR) operator only works in a 'if' statement, not to be used in random operations.

Below code would be hipotetically the solution, but it's not.
pawn Код:
if(IsPlayerInVehicle(playerid, 571)) // 571 = KART ID
{
    switch (random(3))
    {
        case 0: { SetPlayerPos(playerid, x, y, z); }
        case 1: { SetPlayerPos(playerid, x, y, z); }
        case 2: { SetPlayerPos(playerid, x, y, z); }
    }
}
You are checking if player is in vehicle when player exit it. Is it logical to mind that a player can't be in a vehicle if he exited it. You may want to use OnPlayerStateChange and variables to identify if player is in a kartdm event or not.
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)