OnPlayerStateChange don't called in vehicle -
Kyra - 20.09.2013
This callback is don't called if the player state change on a new vehicle, very important for anticheat/optimization for don't use OnPlayerUpdate please.
Re: OnPlayerStateChange don't called in vehicle -
d0 - 20.09.2013
Bug, seriously ?
OnPlayerState
Change is called when a player changes his state, vehicle to vehicle is no state change.
pawn Код:
new gPlayerVeh[playerid];
public OnPlayerUpdate(playerid)
{
new vehID = GetPlayerVehicleID(playerid);
if(vehID != gPlayerVeh[playerid])
{
OnPlayerVehicleChange(playerid, vehid);
gPlayerVeh[playerid] = vehID;
}
}
public OnPlayerVehicleChange(playerid, vehicleid)
{
// your anti cheat
}
Re: OnPlayerStateChange don't called in vehicle -
JernejL - 20.09.2013
OnPlayerStateChange is only called if state changes, if a cheater changes from one vehicle to another the state is still player_state_driver.
The function is described perfectly and works just fine.
Just use the onplayerupdate and call your own onplayervehicleidchange because that's what you need & want.
Re: OnPlayerStateChange don't called in vehicle -
Jay_ - 20.09.2013
From my understanding, what you're implying is that OnPlayerStateChange is not called when a player is warped from a driving seat of one vehicle, immediately to the driving seat of another. If so, in any event this behaviour is correct. The player's state is not changing as they are still driving a vehicle.
Many servers' scripts heavily rely on player states. If an issue like this was indeed considered legitimate, I'm sure there would be hundreds of complaints all over these forums. Please consider carefully before posting in future.
Re: OnPlayerStateChange don't called in vehicle -
RayW - 20.09.2013
This is not a bug. The callback works correctly. The player state itself does not change going from vehicle to vehicle. However, something like getting out of the vehicle and getting back in a vehicle, that is different, and the callback will actually detect that.
Re: OnPlayerStateChange don't called in vehicle -
dugi - 20.09.2013
Listen to the guys above me. People should really stop reporting things that aren't bugs.
Re: OnPlayerStateChange don't called in vehicle -
Kyra - 20.09.2013
Quote:
Originally Posted by d0
Bug, seriously ?
OnPlayerState Change is called when a player changes his state, vehicle to vehicle is no state change.
pawn Код:
new gPlayerVeh[playerid]; public OnPlayerUpdate(playerid) { new vehID = GetPlayerVehicleID(playerid); if(vehID != gPlayerVeh[playerid]) { OnPlayerVehicleChange(playerid, vehid); gPlayerVeh[playerid] = vehID; } }
public OnPlayerVehicleChange(playerid, vehicleid) { // your anti cheat }
|
Yes i use OnPlayerUpdate, sorry i thought is a bug because example OnPlayerKeyState
Change is called even if it's the same key but is not same callback yes...
Re: OnPlayerStateChange don't called in vehicle -
Basssiiie - 20.09.2013
Quote:
Originally Posted by Kyra
OnPlayerKeyStateChange is called even if it's the same key but is not same callback yes...
|
If you enter a vehicle, leave it and enter it again, OnPlayerStateChange will be called as well. (Three times to be exactly.) OnPlayerKeyStateChange works the same way; it's called for the press of the key, the release of the key and the second press of the (same) key.
I also like how it takes 4 Betatesters and a Turtle-lover to answer this question, you don't see that very often. :P