OnPlayerStateChange don't called in vehicle
#1

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.
Reply
#2

Bug, seriously ?

OnPlayerStateChange 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
}
Reply
#3

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.
Reply
#4

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.
Reply
#5

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.
Reply
#6

Listen to the guys above me. People should really stop reporting things that aren't bugs.
Reply
#7

Quote:
Originally Posted by d0
Посмотреть сообщение
Bug, seriously ?

OnPlayerStateChange 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 OnPlayerKeyStateChange is called even if it's the same key but is not same callback yes...
Reply
#8

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
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)