Title says enough.
function onPlayerUpdate(player);
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 )
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
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
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.
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.
onPlayerActionChange maybe
Quote from: Kewun on Sep 12, 2016, 03:56 PMonPlayerActionChange maybe
it's not called when the ping/speed changes.
Create your own event from events you need, why its a problem?
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 (http://wiki.vc-mp.org/wiki/Scripting/Squirrel/Functions/Player.State)