SA-MP Forums Archive
OnPlayerUpdate dont called when passenger Drive-By - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP (https://sampforum.blast.hk/forumdisplay.php?fid=3)
+--- Forum: Bug Reports (https://sampforum.blast.hk/forumdisplay.php?fid=20)
+--- Thread: OnPlayerUpdate dont called when passenger Drive-By (/showthread.php?tid=497427)



OnPlayerUpdate dont called when passenger Drive-By - spell - 26.02.2014

when you're a passenger and press "Block mayus" for passenger drive-by, OnPlayerUpdate is called only when you fire a gun, if you dont fire OnPlayerUpdate is called every ~5 seconds, and other players see you on pause. Also, hits are desynced here.

test it:
Enter a vehicle as passenger, give a gun, and test using this code:
pawn Код:
public OnPlayerUpdate (playerid)
{
    static
        lastOPU [MAX_PLAYERS];
       
    new
        string [60];
       
    format (string, sizeof (string), "OnPlayerUpdate: Last call was %d ms ago", GetTickCount() - lastOPU [playerid]);
    SendClientMessage (playerid, -1, string);
   
    lastOPU [playerid] = GetTickCount();
    return 1;
}
Other bug:
OnPlayerWeaponShot is called with "weaponid" = 0 when you're a passenger, and get a weapon while you are in a vehнcle.

Test it: enter a vehicle as passenger, get a weapon, and debug OnPlayerWeaponShot, you will see it

pawn Код:
public OnPlayerWeaponShot(playerid, weaponid, hittype, hitid, Float:fX, Float:fY, Float:fZ)
{
    new szString[144];
    format(szString, sizeof(szString), "Weapon %i fired. hittype: %i   hitid: %i   pos: %f, %f, %f", weaponid, hittype, hitid, fX, fY, fZ);
    SendClientMessage(playerid, -1, szString);

    return 1;
}
Also, GetPlayerWeapon return 0 when you get a weapon when your state is passenger. Passenger state is really bugged. Sorry for my english


Re: OnPlayerUpdate dont called when passenger Drive-By - MP2 - 26.02.2014

OnPlayerUpdate gets called when a client syncs something to the server. If a player is the passenger of a vehicle, they don't need to sync anything (because they can't move, and their state is constant), apart from when they shoot.

IIRC this only affects OnPlayerUpdate, and it doesn't actually show that they are paused with SA-MP's hourglass thing.


Re: OnPlayerUpdate dont called when passenger Drive-By - spell - 26.02.2014

I guess this is a problem, because it should synchronize the movement and animation when a player being passenger drive-by (because the animation depends on the mouse position).