[Request] serverside - onPlayerUpdate

Started by Ankris, Sep 12, 2016, 06:53 AM

Previous topic - Next topic

Ankris

Title says enough.

function onPlayerUpdate(player);

KAKAN

I still don't understand. What does the update function do? A player will join your server with the version of server you're using( if that's the case )
oh no

Ankris

Quote from: KAKAN on Sep 12, 2016, 06:54 AMI still don't understand. What does the update function do? A player will join your server with the version of server you're using( if that's the case )

onPlayerUpdate event is triggered if something in the player is updated like can be ping, position, speed. See: https://wiki.sa-mp.com/wiki/OnPlayerUpdate & http://liberty-unleashed.co.uk/LUWiki/Squirrel/Server/Events/Player/onPlayerUpdate

KAKAN

for postion: onPlayerMove
Still running a 1sec timer is much more efficient than using that shitty callback.
For ex: Put this line in onPlayerMove: print("pos changed"); and see the spam. Do the same with 1/0.5 sec timer and notice the thing. Your function needs to execute that fast, which you can't do efficiently with Squirrel
oh no

Ankris

Quote from: KAKAN on Sep 12, 2016, 07:04 AMfor postion: onPlayerMove
Still running a 1sec timer is much more efficient than using that shitty callback.
For ex: Put this line in onPlayerMove: print("pos changed"); and see the spam. Do the same with 1/0.5 sec timer and notice the thing. Your function needs to execute that fast, which you can't do efficiently with Squirrel

onPlayerMove is triggered only when you are in vehicle as driver or on foot.

The reason I want this function is because has been used for long time for anticheats.

Shadow

#5
There's already something like that in the plugin header defined as

void(*OnPlayerUpdate) (int32_t playerId, vcmpPlayerUpdate updateType);
with the possible updates being

typedef enum {
vcmpPlayerUpdateNormal = 0,
vcmpPlayerUpdateAiming = 1,
vcmpPlayerUpdateDriver = 2,
vcmpPlayerUpdatePassenger = 3,
forceSizeVcmpPlayerUpdate = INT32_MAX
} vcmpPlayerUpdate;

You can decide whether it is a position change or a ping change in that event.
QuotePS:is trash is ur home language??

Kewun


KAKAN

Quote from: Kewun on Sep 12, 2016, 03:56 PMonPlayerActionChange maybe
it's not called when the ping/speed changes.
oh no

vito

Create your own event from events you need, why its a problem?

Ankris

They were examples.



Quote from: Shadow on Sep 12, 2016, 03:52 PMThere's already something like that in the plugin header defined as

void(*OnPlayerUpdate) (int32_t playerId, vcmpPlayerUpdate updateType);
with the possible updates being

typedef enum {
vcmpPlayerUpdateNormal = 0,
vcmpPlayerUpdateAiming = 1,
vcmpPlayerUpdateDriver = 2,
vcmpPlayerUpdatePassenger = 3,
forceSizeVcmpPlayerUpdate = INT32_MAX
} vcmpPlayerUpdate;

You can decide whether it is a position change or a ping change in that event.

This is the Player.State