Quote from: (vG)DesTroYeR^ on Oct 23, 2025, 09:50 AMAnd 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_FunctionsQuote from: Xmair on Oct 22, 2025, 08:53 PMYou could use Script::ScriptProcess
this doesn't have the desired parameters
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 + ")");
}
function IsJumping(p) {
if(p.Action == 41) return 1; // (true)
else return 0; // (false)
}
function onPlayerMove(player, lastX, lastY, lastZ, newX, newY, newZ){
if(IsJumping(player)){
player.Speed.z += 1; // E---X---A---M---P---L---E
}
}
function IsFalling(p, Znew, Zlast) {
if(IsJumping(p)) return false;
if(Znew == Zlast) return false; // rarely happens if the player is continually moving, since you can barely find a straightforward surface so Z positions are almost always dynamic
local newZlower = (Znew < Zlast ? true : false);
if(newZlower) {
if(Zlast - Znew < 0.15) return false; // Not Falling (e.g, 11.3 - 11.2 = 0.1 is not a fall)
else return true; // > 0.15 is a fall (Approximate numbers - I didn't really calculate it precisely)
}
else {return false;} // Znew is bigger -> so climbing or going up somehow
}
function onPlayerMove(player, lastX, lastY, lastZ, newX, newY, newZ){
if(IsFalling(player, newZ, lastZ)) player.Immunity = 32; // E---X---A---M---P---L---E
}
function IsJumping(p) {
if(p.Action == 41) return 1; // (true)
else return 0; // (false)
}
function onPlayerMove(player, lastX, lastY, lastZ, newX, newY, newZ){
if(IsJumping(player)){
player.Speed.z += 1; // E---X---A---M---P---L---E
}
}
function IsFalling(p, Znew, Zlast) {
if(IsJumping(p)) return false;
if(Znew == Zlast) return false; // rarely happens if the player is continually moving, since you can barely find a straightforward surface so Z positions are almost always dynamic
local newZlower = (Znew < Zlast ? true : false);
if(newZlower) {
if(Zlast - Znew < 0.15) return false; // Not Falling (e.g, 11.3 - 11.2 = 0.1 is not a fall)
else return true; // > 0.15 is a fall (Approximate numbers - I didn't really calculate it precisely)
}
else {return false;} // Znew is bigger -> so climbing or going up somehow
}
function onPlayerMove(player, lastX, lastY, lastZ, newX, newY, newZ){
if(IsFalling(player, newZ, lastZ)) player.Immunity = 32; // E---X---A---M---P---L---E
}
Quote from: Xmair on Oct 22, 2025, 08:53 PMYou could use Script::ScriptProcess