Players not moving on my Screen
#1

We have noticed in my server that Players are not moving in their Screen, but they could Run,Walk,Shoot and other movements.

I have already check OnPlayerUpdate returning 1

Do you think this cause the problem?

Код:
/* =============================== */
/*   stuntman's Anti-Money Cheat  */
/* =============================== */

stock sGetPlayerMoney( playerid ) return GetPVarInt( playerid, "sMoney" ); //Anti-cheat - Get Player Moneys

stock sGivePlayerMoney( playerid, sMoneyV ) //Anti-cheat - Give Player Moneys
{
	SetPVarInt( playerid, "sMoney", GetPVarInt( playerid, "sMoney" ) + sMoneyV );
	return GivePlayerMoney( playerid, sMoneyV );
}

stock sResetPlayerMoney( playerid ) //Anti-cheat - Reset Player Moneys
{
	SetPVarInt( playerid, "sMoney", 0 );
	return ResetPlayerMoney( playerid );
}

//=================[ Check moneys ]===================

public OnPlayerUpdate( playerid )
{
    if( GetPlayerMoney( playerid ) != GetPVarInt( playerid, "sMoney" ) )
	{
		ResetPlayerMoney( playerid );
		GivePlayerMoney( playerid, GetPVarInt( playerid, "sMoney" ) );
	}
    return CallLocalFunction( "samc_OnPlayerUpdate", "i", playerid );
}
#if defined _ALS_OnPlayerUpdate
    #undef OnPlayerUpdate
#else
    #define _ALS_OnPlayerUpdate
#endif
#define OnPlayerUpdate samc_OnPlayerUpdate
forward samc_OnPlayerUpdate( playerid );

//====================================================

#define GetPlayerMoney sGetPlayerMoney
#define GivePlayerMoney sGivePlayerMoney
#define ResetPlayerMoney sResetPlayerMoney
or this

Код:
public OnPlayerUpdate( playerid )
{
	static
		Float: X, 	Float: Y, 	Float: Z,
		Float: vX,	Float: vY, 	Float: vZ
	;
	GetPlayerPos( playerid, X, Y, Z );

	if( X >= 99999.0 || Y >= 99999.0 || Z >= 99999.0 || X <= -99999.0 || Y <= -99999.0 || Z <= -99999.0 ) {
	  	SendClientMessage( playerid, 0xa9c4e4ff, "Warning: Excessive X, Y, Z has been breached thus last location set." );
		SetPlayerPos( playerid, g_cleoData[ playerid ] [ E_PB_X ], g_cleoData[ playerid ] [ E_PB_Y ], g_cleoData[ playerid ] [ E_PB_Z ] );
	}
	else
	{
	    g_cleoData[ playerid ] [ E_PB_X ] = X;
	    g_cleoData[ playerid ] [ E_PB_Y ] = Y;
	    g_cleoData[ playerid ] [ E_PB_Z ] = Z;
	}

	if( IsPlayerInAnyVehicle( playerid ) && GetPlayerState( playerid ) == PLAYER_STATE_DRIVER )
	{
		GetPlayerPos( playerid, X, Y, Z );
  		GetVehicleVelocity( GetPlayerVehicleID( playerid ), vX, vY, vZ );
		if( ( vX > 3.0 || vY > 3.0 || vZ > 3.0 || vX < -3.0 || vY < -3.0 || vZ < -3.0 ) && ( vX != X && vY != Y && vZ != Z ) )
		{
			CallLocalFunction( "OnPlayerCleoDetected", "dd", playerid, CLEO_CARSWING );
		}
	}
	return ( FC_OPU ) ? CallLocalFunction( "FC_OnPlayerUpdate", "d", playerid ) : 1;
}
Last

Код:
public OnPlayerUpdate(playerid) {
	new
		iVehicle = GetPlayerVehicleID(playerid)
 	;
 	if(GetPlayerVehicleSeat(playerid) != 0) {
 		if(GetPVarInt(playerid, "#ultimoveiculo") != iVehicle) {
  			SetPVarInt(playerid, "#ultimoveiculo", iVehicle);
    		if(GetVehicleModel(iVehicle)) {
     			@ChangeVehicles(playerid, PLAYER_STATE_DRIVER, iVehicle);
       		}
       	}
  	}
  	if(funcidx("flood_controlOnPlayerUpdate") != -1) {
  		return CallLocalFunction("flood_controlOnPlayerUpdate", "i", playerid);
   	}
   	return true;
}
Reply
#2

Quote:
Originally Posted by ******
Посмотреть сообщение
The first callback hook could be the issue - look at the difference between how it and the other one call CallLocalFunction. The second one returns 1 by default, the first doesn't so returns 0 instead.
Thanks ******. I though the returning of the first one was default by 1. So I didn't try to change that.

Now I did this.
Код:
public OnPlayerUpdate( playerid )
{
    if( GetPlayerMoney( playerid ) != GetPVarInt( playerid, "sMoney" ) )
	{
		ResetPlayerMoney( playerid );
		GivePlayerMoney( playerid, GetPVarInt( playerid, "sMoney" ) );
	}
	CallLocalFunction( "samc_OnPlayerUpdate", "i", playerid );
	return 1;
}
And as you can see I have added another Onplayerupdate. Is return true; Correct? or should I change it to 1 instead?

Код:
public OnPlayerUpdate(playerid) {
	new
		iVehicle = GetPlayerVehicleID(playerid)
 	;
 	if(GetPlayerVehicleSeat(playerid) != 0) {
 		if(GetPVarInt(playerid, "#ultimoveiculo") != iVehicle) {
  			SetPVarInt(playerid, "#ultimoveiculo", iVehicle);
    		if(GetVehicleModel(iVehicle)) {
     			@ChangeVehicles(playerid, PLAYER_STATE_DRIVER, iVehicle);
       		}
       	}
  	}
  	if(funcidx("flood_controlOnPlayerUpdate") != -1) {
  		return CallLocalFunction("flood_controlOnPlayerUpdate", "i", playerid);
   	}
   	return true;
}
EDIT: I got it now
Quote:

Theyre both the same. True == 1.

Only with booleans you can ONLY use true/false, and not 1/0.

There is an important distinction no-one else has mentioned. "true" and "false" have a tag of "bool:" which give the compiler hints about where they can be used. 0 and 1 don't (they have the default tag, which is "_:").

Reply
#3

Could anyone tell me if returning is correct? on 3 OnplayerUpdate?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)