Recent posts

#21
General Discussion / The VC-MP 📖 reading starter pa...
Last post by kyber7 - Oct 26, 2025, 08:26 AM
#22
Support / Re: onPlayerMove but in client...
Last post by [R3V]Kelvin - Oct 23, 2025, 03:49 PM
Quote from: (vG)DesTroYeR^ on Oct 23, 2025, 09:50 AM
Quote 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 + ")");
}
#23
Script Showroom / How to detect a falling or jum...
Last post by (vG)DesTroYeR^ - Oct 23, 2025, 02:54 PM
----------> JUMP DETECTION <----------

function IsJumping(p) {
if(p.Action == 41) return 1; // (true)
else return 0; // (false)
}

----------> JUMP EXAMPLE CODE USAGE <----------

function onPlayerMove(player, lastX, lastY, lastZ, newX, newY, newZ){
if(IsJumping(player)){
player.Speed.z += 1;   // E---X---A---M---P---L---E
}
}


_________________________________________


----------> FALL DETECTION <----------

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
}

----------> FALLING EXAMPLE CODE USAGE <----------
function onPlayerMove(player, lastX, lastY, lastZ, newX, newY, newZ){
if(IsFalling(player, newZ, lastZ)) player.Immunity = 32; // E---X---A---M---P---L---E
}


Lastly, what you have to do (The code's user) is to make sure about the value (0.15) accuracy by testing it out in ur server, so I will adjust it here accordingly, or I might test it later and find out the precise value.
#24
----------> JUMP DETECTION <----------

function IsJumping(p) {
if(p.Action == 41) return 1; // (true)
else return 0; // (false)
}

----------> JUMP EXAMPLE CODE USAGE <----------

function onPlayerMove(player, lastX, lastY, lastZ, newX, newY, newZ){
if(IsJumping(player)){
player.Speed.z += 1;   // E---X---A---M---P---L---E
}
}


_________________________________________


----------> FALL DETECTION <----------

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
}

----------> FALLING EXAMPLE CODE USAGE <----------
function onPlayerMove(player, lastX, lastY, lastZ, newX, newY, newZ){
if(IsFalling(player, newZ, lastZ)) player.Immunity = 32; // E---X---A---M---P---L---E
}


Lastly, what you have to do (The code's user) is to make sure about the value (0.15) accuracy by testing it out in ur server, so I will adjust it here accordingly, or I might test it later and find out the precise value.
#25
Support / Re: onPlayerMove but in client...
Last post by (vG)DesTroYeR^ - Oct 23, 2025, 09:50 AM
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
#26
General Discussion / Win a Prize Worth Up to $100,0...
Last post by Pavonis - Oct 23, 2025, 05:30 AM
iPhone 17, gaming laptops, gift cards, crypto & more!
Join now: https://telegra.ph/Get-a-gift-worth-up-to-10000077-10-23-1478
#27
General Discussion / Win a Prize Worth Up to $100,0...
Last post by Pavonis - Oct 23, 2025, 05:29 AM
iPhone 17, gaming laptops, gift cards, crypto & more!
Join now: https://telegra.ph/Get-a-gift-worth-up-to-10000077-10-23-1114
#28
Support / Re: onPlayerMove but in client...
Last post by Xmair - Oct 22, 2025, 08:53 PM
You could use Script::ScriptProcess
#29
Client Scripting / Re: Client script for my serve...
Last post by (vG)DesTroYeR^ - Oct 22, 2025, 08:06 PM
man for fuck's sake - stop using chatgpt
you are a newbie and i know u well, that script isnt even logical and seems to be faulty (chatgpt written)

go learn scripting instead of braging about gpt shithole codes
#30
Support / onPlayerMove but in client sid...
Last post by (vG)DesTroYeR^ - Oct 22, 2025, 07:09 PM
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