01.11.2015, 22:45
Hmm, 30+ calls to SetPlayerAttachedObject per player, per second?
OnPlayerUpdate should only be used to create custom callbacks, never for plain code. It is not a general purpose timer. Like:
OnPlayerUpdate should only be used to create custom callbacks, never for plain code. It is not a general purpose timer. Like:
PHP код:
public OnPlayerUpdate(playerid)
{
static oldCameraMode[MAX_PLAYERS]; // important that this be static because value needs to be retained
new newCameraMode = GetPlayerCameraMode(playerid);
if(oldCameraMode[playerid] != newCameraMode)
{
OnPlayerCameraModeChange(playerid, newCameraMode, oldCameraMode);
return 1;
}
return 1;
}
OnPlayerCameraModeChange(playerid, newmode, oldmode);
{
if(newmode == 53) // aiming weapon (excluding sniper/rpg)
{
// player started aiming, do stuff
}
if(oldmode == 53)
{
// player stopped aiming, do stuff
}
return;
}