function Player::PlayerMove(oldpos, newpos){
}
Quote from: vitovc on Oct 21, 2025, 03:44 PMthere is no clientside player.Angle but you can 1) get it from server (with lag) with Stream function 2) or you can guess player's camera angle (it almost same as player.Angle when player is not looking back)get_angle <- function(x, y, x2, y2){untested, I took code from Get player Camera zoom
return ::atan2(y2 - y, x2 - x);
}
get_player_angle <- function(){
local screen_size = ::GUI.GetScreenSize();
local cam_from = ::GUI.ScreenPosToWorld(::Vector(screen_size.X * 0.5, screen_size.Y * 0.5, -1));
local cam_to = ::GUI.ScreenPosToWorld(::Vector(screen_size.X * 0.5, screen_size.Y * 0.5, 1));
return ::get_angle(cam_from.X, cam_from.Y, cam_to.X, cam_to.Y);
}local angle = ::get_player_angle();also maybe you will need to add some offset to result of angle to make it similar as serverside angle, to do it correctly usenormalize_angle <- function (a){
return ::atan2(::sin(a), ::cos(a));
}
::normalize_angle(angle + 1.57079);
get_angle <- function(x, y, x2, y2){
return ::atan2(y2 - y, x2 - x);
}
get_player_angle <- function(){
local screen_size = ::GUI.GetScreenSize();
local cam_from = ::GUI.ScreenPosToWorld(::Vector(screen_size.X * 0.5, screen_size.Y * 0.5, -1));
local cam_to = ::GUI.ScreenPosToWorld(::Vector(screen_size.X * 0.5, screen_size.Y * 0.5, 1));
return ::get_angle(cam_from.X, cam_from.Y, cam_to.X, cam_to.Y);
}
untested, I took code from Get player Camera zoom local angle = ::get_player_angle();also maybe you will need to add some offset to result of angle to make it similar as serverside angle, to do it correctly usenormalize_angle <- function (a){
return ::atan2(::sin(a), ::cos(a));
}
::normalize_angle(angle + 1.57079);function ToLower(num) { // (Floor)
local fltdot = ".";
local numstr = num+"";
local checkflt = split(numstr, fltdot);
if(checkflt.len() > 2) return print("Wrong float value detected.");
if(checkflt.len() == 2){
local w = checkflt[0].tointeger(); \\ before the dot. like 34(.)5 - it will return 34
return w;
}
return print("Invalid input (ToLower)");
}
function ToGreater(num) { // (Ceil)
local fltdot = ".";
local numstr = num+"";
local checkflt = split(numstr, fltdot);
if(checkflt.len() > 2)return print("Invalid input - ToGreater()"); // must be 1 dot.
if(checkflt.len() <= 1)return print("Invalid input - ToGreater()"); // no integers. or (34.) so the dot in 34 is not a valid input
local floats = "0."+checkflt[1];
local integers = checkflt[0];
if (checkflt[1].tointeger() == 0) return integers.tointeger(); // if 34.0 return 34
local subTracT = floats.tofloat() - 1;
local subT = abs(subTracT); // (+)
local result = num + subT; // 34.3 + 0.7 = 35
return result;
}


