OnPlayerEnterVehicle [+Rep] -
Twinki1993 - 07.02.2012
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.
Re: OnPlayerEnterVehicle [+Rep] -
genesis87 - 07.02.2012
Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
if(GetVehicleModel(vehicleid) == 451)
{
if(GetPlayerScore(playerid) <50)
RemovePlayerFromVehicle(playerid);
}
return 1;
}
should be like this i beleive
Re: OnPlayerEnterVehicle [+Rep] -
_ReloadeD_ - 07.02.2012
You need to put it in OnPlayerStateChange
Re: OnPlayerEnterVehicle [+Rep] -
Nonameman - 07.02.2012
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
Re: OnPlayerEnterVehicle [+Rep] -
Twinki1993 - 07.02.2012
Uhm still it's basically same lol
Bump: Thanks Nonameman
Re: OnPlayerEnterVehicle [+Rep] -
Nonameman - 07.02.2012
I didn't tested it, so I hope it will work.
Re: OnPlayerEnterVehicle [+Rep] -
iTorran - 07.02.2012
Or you could just clear animations when OnPlayerEnterVehicle is called rather than trying to remove them from a vehicle they are not yet in.
Re: OnPlayerEnterVehicle [+Rep] -
Twinki1993 - 07.02.2012
huh error
Quote:
error 017: undefined symbol "newstate"
|
Re: OnPlayerEnterVehicle [+Rep] -
Tanush123 - 07.02.2012
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;
}
Re: OnPlayerEnterVehicle [+Rep] -
Nonameman - 08.02.2012
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. :/