OnPlayerEnterVehicle [+Rep]
#1

Well I've made this thing but aint working. If player enters turismo or infernus and he/she doesnt have 50+ score then he/she will be removed from the vehicle. I've made a code but aint working at all.

PHP код:
    if(GetVehicleModel(vehicleid) == 451)
    {
        if(
GetPlayerScore(playerid) <50) return RemovePlayerFromVehicle(playerid);
        return 
1;
    } 
So if player doesnt have 50 score he will be removed from the vehicle
If he have the required score he/she wont be removed.
Reply
#2

Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
	if(GetVehicleModel(vehicleid) == 451)
    {
        if(GetPlayerScore(playerid) <50)
        RemovePlayerFromVehicle(playerid);
    }
    return 1;
}
should be like this i beleive
Reply
#3

You need to put it in OnPlayerStateChange
Reply
#4

pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if (newstate == PLAYER_STATE_DRIVER || newstate == PLAYER_STATE_PASSENGER) {
        if (GetVehicleModel(GetPlayerVehicleID(playerid)) == 451) {
            if (GetPlayerScore(playerid) < 50)
                RemovePlayerFromVehicle(playerid);
        }
    }
    return 1;
}
Try this
Reply
#5

Uhm still it's basically same lol

Bump: Thanks Nonameman
Reply
#6

I didn't tested it, so I hope it will work.
Reply
#7

Or you could just clear animations when OnPlayerEnterVehicle is called rather than trying to remove them from a vehicle they are not yet in.
Reply
#8

huh error
Quote:

error 017: undefined symbol "newstate"

Reply
#9

try
pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    new vehicleid = GetPlayerVehicleID(playerid);
    if(newstate == PLAYER_STATE_DRIVER)
    {
        if(GetVehicleModel(vehicleid) == 451)
        {
            if(GetPlayerScore(playerid) <50) return RemovePlayerFromVehicle(playerid);
        }
    }
    return 1;
}
Reply
#10

That's the same I wrote, but his problem is with 'newstate', I don't know how to solve this, the code was tested and copied from my editor, there should be nothing like that. :/
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)