SetPlayerSkin freezes player if entering vehicle
#1

Well as the title says. If SetPlayerSkin is used when a player is entering a vehicle the player will become frozen (like TogglePlayerControllable) I know the easy solution is to not set a player's skin when they are entering a vehicle but there is no way of detecting if a player is entering a vehicle or not. SetPlayerSkin also freezes a player if they are jumping.
Reply
#2

Quote:
Originally Posted by BeckzyBoi
there is no way of detecting if a player is entering a vehicle or not.
PLATER_STATE_ENTER_VEHICLE_DRIVER/PASSENGER ?
Reply
#3

Quote:
Originally Posted by Jay_
Quote:
Originally Posted by BeckzyBoi
there is no way of detecting if a player is entering a vehicle or not.
PLATER_STATE_ENTER_VEHICLE_DRIVER/PASSENGER ?
Those state changes are never sent to OnPlayerStateChange.
Reply
#4

So? You don't need OnPlayerStateChange, before you set the skin, just use GetPlayerState, if they're entering a vehicle, cancel the skin change or unfreeze them after the skin has been set.
Reply
#5

When I said they aren't used in OnPlayerStateChange I meant GetPlayerState too
Reply
#6

Yes they do.

OnPlayerEnterVehicle is called when player presses ENTER and starts running towards the vehicle and player's state is changed to PLAYER_STATE_DRIVER when the player is in the vehicle.

If you mean SetPlayerSkin freezes the player when pressing ENTER, just check that OnPlayerEnterVehicle-callback hasn't been called, if it has, don't let him change the skin.

If you mean it freezes when the player is inside the vehicle, do the same thing with OnPlayerStateChange and PLAYER_STATE_DRIVER.
Reply
#7

Quote:
Originally Posted by Finn
Yes they do.

OnPlayerEnterVehicle is called when player presses ENTER and starts running towards the vehicle and player's state is changed to PLAYER_STATE_DRIVER when the player is in the vehicle.

If you mean SetPlayerSkin freezes the player when pressing ENTER, just check that OnPlayerEnterVehicle-callback hasn't been called, if it has, don't let him change the skin.

If you mean it freezes when the player is inside the vehicle, do the same thing with OnPlayerStateChange and PLAYER_STATE_DRIVER.
I mean when the player is entering the vehicle. And if I do what you are suggesting then what if the player decides not to enter the vehicle and walks away from it? There is no way of detecting that.

So basically I have reported this bug. It would be good if people could stop pretending they are trying to help me when all they are doing is criticising everything I say.

SetPlayerSkin freezes the player if he is entering a vehicle. That is the bug. On the talk of getting around it, you can not detect if a player is entering a vehicle or not.
Reply
#8

Who said it is not a bug? We're just trying to help you get around the bug so you can keep scripting whatever you do.

Detect if a player presses ENTER, but doesn't get in the car:

pawn Code:
forward CheckTimer(playerid);
new bool:playerenteringvehicle[MAX_PLAYERS];
pawn Code:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
    playerenteringvehicle[playerid] = true;
    SetTimerEx("CheckTimer", 5000, 0, "d", playerid);
    return 1;
}
pawn Code:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if(newstate == PLAYER_STATE_DRIVER && playerenteringvehicle[playerid] == true) playerenteringvehicle[playerid] = false;
    return 1;
}
pawn Code:
public CheckTimer(playerid)
{
    if(playerenteringvehicle[playerid] == true)
    {
        playerenteringvehicle[playerid] = false;
        // Player pressed enter, but walked away. Put your code here.
    }
    return 1;
}
Edit: I know this is a bug that NEEDS to be fixed in the future versions, but as you know the client updates ain't popping up that fast, so you gotta think about ways to get around the bugs while they're still not-fixed. When the update comes out with the bug fixed, it is not that big job to remove the code you've written and use the bug-free function in happiness.
Reply
#9

Thanks anyway but I am more than capable of making such workarounds I will just leave it how it is until it gets fixed.
Reply
#10

I know this topic hasn't been posted in for a while, I didn't think it was worth making a new topic though. SetPlayerSkin also freezes the player if they are exiting a vehicle.

You can now detect if a player is entering a vehicle using GetPlayerSpecialAction and SPECIAL_ACTION_ENTER_VEHICLE. There is also SPECIAL_ACTION_EXIT_VEHICLE for exiting a vehicle but that doesn't seem to work in 0.3.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)