My friend
@gamingpro told me that there's a function in client side written like this:
function Player::PlayerMove(oldpos, newpos){
}
But I am not sure of this, can someone tell me if there's a function like this in client side? Sending high rate timers to client side frequently is laggy -> not only is it lagging for the sprite angle degrees im sending but is also cpu-bound of the panel.
I am now using local player = World.findlocalplayer(); // player.Position vector --- but it needs more precision to get rid of lag, thats why im searching for a function like playermove in server side.
I basically want it works same as
Player's default tag name that incessantly follows him precisely
Quote from: Xmair on Oct 22, 2025, 08:53 PMYou could use Script::ScriptProcess
this doesn't have the desired parameters, I am already tracking player's position via Server::ServerData(stream); function, I guess that if there's a function like on player move would be precise
Quote from: (vG)DesTroYeR^ on Oct 23, 2025, 09:50 AMQuote from: Xmair on Oct 22, 2025, 08:53 PMYou could use Script::ScriptProcess
this doesn't have the desired parameters
And you don't need any! All you gotta do is use your imagination. Just refer to the wiki for reference when coding: https://wiki.vc-mp.org/wiki/Scripting/Squirrel/Client_Functions
localPlayerPos <- null;
lastLocalPlayerPos <- null;
function Script::ScriptLoad()
{
::localPlayerPos = ::World.FindLocalPlayer().Position; // By reference (auto updated)
::lastLocalPlayerPos = ::Vector(::localPlayerPos); // We need a copy, not a reference
}
function Script::ScriptProcess()
{
// Because we made a copy these will effectively differ from each other
if ((::localPlayerPos.X != ::lastLocalPlayerPos.X) ||
(::localPlayerPos.Y != ::lastLocalPlayerPos.Y) ||
(::localPlayerPos.Z != ::lastLocalPlayerPos.Z))
{
::OnLocalPlayerMove();
::lastLocalPlayerPos = ::Vector(::localPlayerPos);
}
}
// -----------------------------------------------------------------------------
// No need for parameters at all! Just make use of the globals we already defined
function OnLocalPlayerMove()
{
Console.Print("lastPos: (" + lastLocalPlayerPos.X + ", " + lastLocalPlayerPos.Y + ", " + lastLocalPlayerPos.Z +
")\t|\tnewPos: (" + localPlayerPos.X + ", " + localPlayerPos.Y + ", " + localPlayerPos.Z + ")");
}