Little Help
#1

Hello everybody, I made special weapon for my server, called shield, it`s DFT with attached objects, but problem is when player exit vehicle, player`s position changed too far from the truck, maybe it`s becouse of attached objects. So I found the way how to fix it, but problem is in that, that my fix doesn`t work. Here is the code, I don`t see anything wrong. Please check it

pawn Код:
if(oldstate == PLAYER_STATE_DRIVER && newstate == PLAYER_STATE_ONFOOT)
    {
        new Float:X, Float:Y, Float:Z;
        if(IsPlayerInVehicle(playerid, vehicleid1))
        {
            GetVehiclePos(vehicleid1, X, Y, Z);
            SetPlayerPos(playerid, X, Y+5, Z);
        }
        else if(IsPlayerInVehicle(playerid, vehicleid2))
        {
            GetVehiclePos(vehicleid2, X, Y, Z);
            SetPlayerPos(playerid, X, Y+5, Z);
        }
    }
Reply
#2

The problem is obvious. You are not getting the players last vehicle. The IsPlayerInVehicle function is always going to return invalid because the player's state is already PLAYER_STATE_ONFOOT (he's no longer driving, so he's obviously not in a vehicle).
Reply


Forum Jump:


Users browsing this thread: