Help Me - how to add custom weapons in Yyg's PUB-G server?

Started by MRSK143, May 20, 2021, 10:23 AM

Previous topic - Next topic

MRSK143

Quote from: Yyg on May 26, 2021, 01:58 AMI tested the weapon modification on the local server, and I'll show you how I did it:

For example, I want to add a sniper rifle with ID=29 (which is not available by default in the current server version).
1. Open store\script\main.nut
2. Modify the g_WEAPONPOOLS array (keep the array count, replacing only the ID), e.g. 28 to 29
3. Open the store\sprites\Gamemenu\CMenu_Backpack\WeaponItems folder, add an image with the name 29.png

If there is no problem, then the Weapon should be added. Custom Weapon also operates the same way, but the ID may be more than 100+ (VCMP feature).

at least you can try to add the weapon plz bro
@mR_Sk@

Yyg

Please try to modify it according to what I said. I have tested it locally and found no problems.
It is recommended that you modify your weapon ID using the built-in weapon ID in VCMP and make sure the WeaponItems directory contains the weaponID.PNG

MRSK143

Quote from: Yyg on May 27, 2021, 03:45 AMPlease try to modify it according to what I said. I have tested it locally and found no problems.
It is recommended that you modify your weapon ID using the built-in weapon ID in VCMP and make sure the WeaponItems directory contains the weaponID.PNG

bro i already confirmed that bruh you should try in your server not in local server and bro when i added the weapon then i get same error but when i open debug.log and i see something weird they said "Main.nut File Is Wrong When I add The Weapon" wtf was that?
@mR_Sk@

MRSK143

Quote from: Yyg on May 27, 2021, 03:45 AMPlease try to modify it according to what I said. I have tested it locally and found no problems.
It is recommended that you modify your weapon ID using the built-in weapon ID in VCMP and make sure the WeaponItems directory contains the weaponID.PNG

bruh plz to understand plz add the weapon and give me tutorial and add the weapon in your pubg dm server plz
@mR_Sk@

Yyg

Quote from: MRSK143 on May 28, 2021, 07:29 AM
Quote from: Yyg on May 27, 2021, 03:45 AMPlease try to modify it according to what I said. I have tested it locally and found no problems.
It is recommended that you modify your weapon ID using the built-in weapon ID in VCMP and make sure the WeaponItems directory contains the weaponID.PNG

bruh plz to understand plz add the weapon and give me tutorial and add the weapon in your pubg dm server plz

After my testing, I think this topic has solved this problem, and maybe you still need to try some

For example, you can try changing the file store\script\main.nut, for example, changing g_WEAPONPOOLS to:

g_WEAPONPOOLS <- [7, 8, 10, 11, 12, 13 ,26 ,26, 26, 26, 26, 26, 26, 26]; //26 is M4A1

You will see a lot of M4A1 in the game menu. This is just an example. To change other weapons, just change the ID to the Weapon ID.
and make sure the store\sprites\GameMenu\CMenu_Backpack\WeaponItems directory contains the weaponID.PNG

It is worth noting that, perhaps, you should not add or remove any members of g_WEAPONPOOLS; please maintain their total number

MRSK143

Quote from: Yyg on May 28, 2021, 07:49 AM
Quote from: MRSK143 on May 28, 2021, 07:29 AM
Quote from: Yyg on May 27, 2021, 03:45 AMPlease try to modify it according to what I said. I have tested it locally and found no problems.
It is recommended that you modify your weapon ID using the built-in weapon ID in VCMP and make sure the WeaponItems directory contains the weaponID.PNG

bruh plz to understand plz add the weapon and give me tutorial and add the weapon in your pubg dm server plz

After my testing, I think this topic has solved this problem, and maybe you still need to try some

For example, you can try changing the file store\script\main.nut, for example, changing g_WEAPONPOOLS to:

g_WEAPONPOOLS <- [7, 8, 10, 11, 12, 13 ,26 ,26, 26, 26, 26, 26, 26, 26]; //26 is M4A1

You will see a lot of M4A1 in the game menu. This is just an example. To change other weapons, just change the ID to the Weapon ID.
and make sure the store\sprites\GameMenu\CMenu_Backpack\WeaponItems directory contains the weaponID.PNG

It is worth noting that, perhaps, you should not add or remove any members of g_WEAPONPOOLS; please maintain their total number

MSG: Main Script line = (1) column = (1) : error expression expected

Warning in CScripting::Initialise: Loading main script file failed with error message: expression expected.
Warning in CScripting::Initialise: Attempting manual closure load.
Error in CScripting::Initialise: Loading bytecode stream failed with error message: invalid stream.

bruh when i add your Weapon pool array then i got this error in debuglog.txt plz help me
@mR_Sk@

Yyg

Quote from: MRSK143 on May 28, 2021, 09:41 AM
Quote from: Yyg on May 28, 2021, 07:49 AM
Quote from: MRSK143 on May 28, 2021, 07:29 AM
Quote from: Yyg on May 27, 2021, 03:45 AMPlease try to modify it according to what I said. I have tested it locally and found no problems.
It is recommended that you modify your weapon ID using the built-in weapon ID in VCMP and make sure the WeaponItems directory contains the weaponID.PNG

bruh plz to understand plz add the weapon and give me tutorial and add the weapon in your pubg dm server plz

After my testing, I think this topic has solved this problem, and maybe you still need to try some

For example, you can try changing the file store\script\main.nut, for example, changing g_WEAPONPOOLS to:

g_WEAPONPOOLS <- [7, 8, 10, 11, 12, 13 ,26 ,26, 26, 26, 26, 26, 26, 26]; //26 is M4A1

You will see a lot of M4A1 in the game menu. This is just an example. To change other weapons, just change the ID to the Weapon ID.
and make sure the store\sprites\GameMenu\CMenu_Backpack\WeaponItems directory contains the weaponID.PNG

It is worth noting that, perhaps, you should not add or remove any members of g_WEAPONPOOLS; please maintain their total number

MSG: Main Script line = (1) column = (1) : error expression expected

Warning in CScripting::Initialise: Loading main script file failed with error message: expression expected.
Warning in CScripting::Initialise: Attempting manual closure load.
Error in CScripting::Initialise: Loading bytecode stream failed with error message: invalid stream.

bruh when i add your Weapon pool array then i got this error in debuglog.txt plz help me
I copied the WeaponPool code directly from my script. This should not be a problem. I may not know how to help you, I suggest you download a new server and try the method changes in the topic
This is really weird, but if you just changed an ID to happen this problem, maybe you can also check the encoding format (and text encoding) and programming specification

Yyg

This is my main.nut file and it runs without any problems with me



[spoiler][noae]g_MAXPLAYER <- 64;

g_MAPPOINTCOUNT <- 5
g_ANIMMENUCOUNT <- 13;
//g_WEAPONPOOLS <- [7, 8, 10, 11, 12, 13 ,15 ,18, 19, 21, 22, 25, 26, 28]; //31
g_WEAPONPOOLS <- [26, 26, 26, 11, 12, 26,26 ,26, 19, 26, 22, 25, 26, 28]; //31
g_EQUIPPOOLS <- [0, 1, 2, 3, 4];

g_ZeroVector <- VectorScreen(0, 0);
g_FullColour <- Colour(255, 255, 255, 255);
g_ZeroColour <- Colour(0, 0, 0, 0);

g_MainColour_0 <- Colour(255, 164, 26, 235);
g_MainColour_1 <- Colour(0, 0, 0, 240);
g_MainColour_2 <- Colour(15, 15, 15, 220);

g_BackgroundSprite <- "Inside/Background.png";
g_AlphaSprite <- "Inside/ZeroAlpha.png";

Global <-
{
LocalPlayer = null
LocalPlayerUIDGroup = ""
LocalVehicle = null

IsPlayerSpawnJumping = false

IsLogined = false
GameAnnounceAwakeTime = 0
}

GlobalUI <-
{
BackgroundMask_0 = GUISprite("Inside/BackgroundMask_0.png", g_ZeroVector, g_ZeroColour)
ServerCopyright = GUISprite("Inside/Copyright.png", g_ZeroVector, g_FullColour)
GameAnnounce = GUISprite("Inside/ZeroAlpha.png", g_ZeroVector, Colour(255, 255, 255, 0))
HealthBackground = GUISprite(g_BackgroundSprite, g_ZeroVector, Colour(255, 0, 0, 0))
}

keyEnter <- KeyBind( 0x0D );
keyEsc <- KeyBind( 0x1B );
keySpace <- KeyBind( 0x20 );
keyOEM <- KeyBind( 0xC0 );
keyRMouse <- KeyBind( 0x02 );
m_KeyAltEnter <- KeyBind( 0x12, 0x0D );

include( "3dchat.nut" );
include( "windows_mem.nut" );
include( "scenemanager_mem.nut" );
include( "account_mem.nut" );
include( "client_mem.nut" );
include( "gamemenu_mem.nut" );
include( "smallmap_mem.nut" );
include( "dashboard_mem.nut" );

function Script::ScriptLoad(){
Global.LocalPlayer = World.FindLocalPlayer();

AwakeAndCheckGameWindows();
AwakeClientScript();

GlobalUI.ServerCopyright.SendToTop();
GUI.GameResize(GUI.GetScreenSize().X, GUI.GetScreenSize().Y);
}

function Script::ScriptProcess(){
WindowsClassProc();
SceneManagerProc();
AccountClassProc();
ChatBubbleProc();
ClientScriptProc();
VehicleDashboardProc();
}

function Server::ServerData(stream)
{
local StreamReadInt = stream.ReadInt(),
StreamReadString = stream.ReadString();

ClientServerData(StreamReadInt, StreamReadString);
}

function KeyBind::OnDown(key)
{
SceneManagerKeyDown(key);
}

function KeyBind::OnUp(key)
{

}

function GUI::GameResize(width, height){
UpdateGlobalUIResize();

UpdateWindowsClassResize();
UpdateDashboardClassResize();
UpdateSceneManagerResize();
UpdateAccountPanelResize();
UpdateClientClassResize();
UpdateRankingMenuUIsResize();
}

function GUI::ElementHoverOver(element)
{
AccountPanelElementHoverOver(element);
ClientClassElementHoverOver(element);
}

function GUI::ElementHoverOut(element)
{
AccountPanelElementHoverOut(element);
ClientClassElementHoverOut(element);
}

function GUI::ElementClick(element, mouseX, mouseY)
{
AccountPanelElementClick(element, mouseX, mouseY);
}

function GUI::ElementRelease(element, mouseX, mouseY)
{
ClientClassElementRelease(element, mouseX, mouseY);
}

function GUI::InputReturn(editbox)
{
AccountPanelInputReturn(editbox);
}

function GUI::WindowClose(window)
{
ClientClassWindowClose(window);
}

function GUI::CheckboxToggle(checkbox, checked)
{

}

function GUI::ScrollbarScroll(scrollbar, position, change)
{

}

function GUI::ElementDrag(element, mouseX, mouseY)
{

}

function UpdateGlobalUIResize(){
local width = GUI.GetScreenSize().X, height = GUI.GetScreenSize().Y;

GlobalUI.HealthBackground.Size = GUI.GetScreenSize();

GlobalUI.GameAnnounce.Size = VectorScreen(width * 0.3, height * 0.1);
GlobalUI.GameAnnounce.Pos = VectorScreen(width / 2 - (GlobalUI.GameAnnounce.Size.X / 2), height * 0.3);

if(GlobalUI.BackgroundMask_0) GlobalUI.BackgroundMask_0.Size = VectorScreen(width, height);
if(GlobalUI.ServerCopyright)
{
GlobalUI.ServerCopyright.Size = VectorScreen(width * 0.45, height * 0.06);
GlobalUI.ServerCopyright.Pos = VectorScreen(width * 0.545, height * 0.925);
}
}

function SendData(str, int)
{
local message = Stream();
message.WriteInt(int.tointeger());
message.WriteString(str);
Server.SendData(message);
}

function ShowScreenMask(){
GlobalUI.BackgroundMask_0.Alpha = 150;
}

function HideScreenMask(){
GlobalUI.BackgroundMask_0.Alpha = 0;
}

function ShowElement(element)
{
if(element == null) return;

element.RemoveFlags(GUI_FLAG_DISABLED);
element.AddFlags(GUI_FLAG_VISIBLE);
}

function HideElement(element)
{
if(element == null) return;

element.AddFlags(GUI_FLAG_DISABLED);
element.RemoveFlags(GUI_FLAG_VISIBLE);
}

function Distance( x1, y1, z1, x2, y2, z2 )
{
    return sqrt( (x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2) + (z1 - z2) * (z1 - z2) );
}

function Abs(a)
{
if(a < 0)
{
a = a * -1;
}

return a;
}

function Minus(a)
{
if(a > 0)
{
a = a * -1;
}

return a;
}

function Lerp( a, b, t )
{
return a+(b-a)*t;
}

function Clamp( value, min, max )
{
if(value < min) return min;
else if(value > max) return max;
else return value;
}

function Random(min=0, max=RAND_MAX)
{
local r = rand();
srand(System.GetTimestamp() * r);
return (r % ((max + 1) - min)) + min;
}

function NumberReturnZero(num, length){
return ( "0000000000" + num ).slice( -length ); 
}
[/noae][/spoiler]

MRSK143

Quote from: Yyg on May 28, 2021, 11:01 AMThis is my main.nut file and it runs without any problems with me



[spoiler][noae][noae][noae]g_MAXPLAYER <- 64;

g_MAPPOINTCOUNT <- 5
g_ANIMMENUCOUNT <- 13;
//g_WEAPONPOOLS <- [7, 8, 10, 11, 12, 13 ,15 ,18, 19, 21, 22, 25, 26, 28]; //31
g_WEAPONPOOLS <- [26, 26, 26, 11, 12, 26,26 ,26, 19, 26, 22, 25, 26, 28]; //31
g_EQUIPPOOLS <- [0, 1, 2, 3, 4];

g_ZeroVector <- VectorScreen(0, 0);
g_FullColour <- Colour(255, 255, 255, 255);
g_ZeroColour <- Colour(0, 0, 0, 0);

g_MainColour_0 <- Colour(255, 164, 26, 235);
g_MainColour_1 <- Colour(0, 0, 0, 240);
g_MainColour_2 <- Colour(15, 15, 15, 220);

g_BackgroundSprite <- "Inside/Background.png";
g_AlphaSprite <- "Inside/ZeroAlpha.png";

Global <-
{
LocalPlayer = null
LocalPlayerUIDGroup = ""
LocalVehicle = null

IsPlayerSpawnJumping = false

IsLogined = false
GameAnnounceAwakeTime = 0
}

GlobalUI <-
{
BackgroundMask_0 = GUISprite("Inside/BackgroundMask_0.png", g_ZeroVector, g_ZeroColour)
ServerCopyright = GUISprite("Inside/Copyright.png", g_ZeroVector, g_FullColour)
GameAnnounce = GUISprite("Inside/ZeroAlpha.png", g_ZeroVector, Colour(255, 255, 255, 0))
HealthBackground = GUISprite(g_BackgroundSprite, g_ZeroVector, Colour(255, 0, 0, 0))
}

keyEnter <- KeyBind( 0x0D );
keyEsc <- KeyBind( 0x1B );
keySpace <- KeyBind( 0x20 );
keyOEM <- KeyBind( 0xC0 );
keyRMouse <- KeyBind( 0x02 );
m_KeyAltEnter <- KeyBind( 0x12, 0x0D );

include( "3dchat.nut" );
include( "windows_mem.nut" );
include( "scenemanager_mem.nut" );
include( "account_mem.nut" );
include( "client_mem.nut" );
include( "gamemenu_mem.nut" );
include( "smallmap_mem.nut" );
include( "dashboard_mem.nut" );

function Script::ScriptLoad(){
Global.LocalPlayer = World.FindLocalPlayer();

AwakeAndCheckGameWindows();
AwakeClientScript();

GlobalUI.ServerCopyright.SendToTop();
GUI.GameResize(GUI.GetScreenSize().X, GUI.GetScreenSize().Y);
}

function Script::ScriptProcess(){
WindowsClassProc();
SceneManagerProc();
AccountClassProc();
ChatBubbleProc();
ClientScriptProc();
VehicleDashboardProc();
}

function Server::ServerData(stream)
{
local StreamReadInt = stream.ReadInt(),
StreamReadString = stream.ReadString();

ClientServerData(StreamReadInt, StreamReadString);
}

function KeyBind::OnDown(key)
{
SceneManagerKeyDown(key);
}

function KeyBind::OnUp(key)
{

}

function GUI::GameResize(width, height){
UpdateGlobalUIResize();

UpdateWindowsClassResize();
UpdateDashboardClassResize();
UpdateSceneManagerResize();
UpdateAccountPanelResize();
UpdateClientClassResize();
UpdateRankingMenuUIsResize();
}

function GUI::ElementHoverOver(element)
{
AccountPanelElementHoverOver(element);
ClientClassElementHoverOver(element);
}

function GUI::ElementHoverOut(element)
{
AccountPanelElementHoverOut(element);
ClientClassElementHoverOut(element);
}

function GUI::ElementClick(element, mouseX, mouseY)
{
AccountPanelElementClick(element, mouseX, mouseY);
}

function GUI::ElementRelease(element, mouseX, mouseY)
{
ClientClassElementRelease(element, mouseX, mouseY);
}

function GUI::InputReturn(editbox)
{
AccountPanelInputReturn(editbox);
}

function GUI::WindowClose(window)
{
ClientClassWindowClose(window);
}

function GUI::CheckboxToggle(checkbox, checked)
{

}

function GUI::ScrollbarScroll(scrollbar, position, change)
{

}

function GUI::ElementDrag(element, mouseX, mouseY)
{

}

function UpdateGlobalUIResize(){
local width = GUI.GetScreenSize().X, height = GUI.GetScreenSize().Y;

GlobalUI.HealthBackground.Size = GUI.GetScreenSize();

GlobalUI.GameAnnounce.Size = VectorScreen(width * 0.3, height * 0.1);
GlobalUI.GameAnnounce.Pos = VectorScreen(width / 2 - (GlobalUI.GameAnnounce.Size.X / 2), height * 0.3);

if(GlobalUI.BackgroundMask_0) GlobalUI.BackgroundMask_0.Size = VectorScreen(width, height);
if(GlobalUI.ServerCopyright)
{
GlobalUI.ServerCopyright.Size = VectorScreen(width * 0.45, height * 0.06);
GlobalUI.ServerCopyright.Pos = VectorScreen(width * 0.545, height * 0.925);
}
}

function SendData(str, int)
{
local message = Stream();
message.WriteInt(int.tointeger());
message.WriteString(str);
Server.SendData(message);
}

function ShowScreenMask(){
GlobalUI.BackgroundMask_0.Alpha = 150;
}

function HideScreenMask(){
GlobalUI.BackgroundMask_0.Alpha = 0;
}

function ShowElement(element)
{
if(element == null) return;

element.RemoveFlags(GUI_FLAG_DISABLED);
element.AddFlags(GUI_FLAG_VISIBLE);
}

function HideElement(element)
{
if(element == null) return;

element.AddFlags(GUI_FLAG_DISABLED);
element.RemoveFlags(GUI_FLAG_VISIBLE);
}

function Distance( x1, y1, z1, x2, y2, z2 )
{
    return sqrt( (x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2) + (z1 - z2) * (z1 - z2) );
}

function Abs(a)
{
if(a < 0)
{
a = a * -1;
}

return a;
}

function Minus(a)
{
if(a > 0)
{
a = a * -1;
}

return a;
}

function Lerp( a, b, t )
{
return a+(b-a)*t;
}

function Clamp( value, min, max )
{
if(value < min) return min;
else if(value > max) return max;
else return value;
}

function Random(min=0, max=RAND_MAX)
{
local r = rand();
srand(System.GetTimestamp() * r);
return (r % ((max + 1) - min)) + min;
}

function NumberReturnZero(num, length){
return ( "0000000000" + num ).slice( -length ); 
}
[/noae][/noae][/noae][/spoiler]

Bruh I Added The Weapon Successfully I Forget That I am using notepad for editing the file and i should use notepad c++ or Visual Studio Code.
but i had some problem when i aqquire that weapon then the server kicked me and I see error on console wtf was that you can see the error
https://ibb.co/JHVKWbD
now plz help me with this
@mR_Sk@

MRSK143

Quote from: Yyg on May 28, 2021, 11:01 AMThis is my main.nut file and it runs without any problems with me



[spoiler][noae][noae][noae]g_MAXPLAYER <- 64;

g_MAPPOINTCOUNT <- 5
g_ANIMMENUCOUNT <- 13;
//g_WEAPONPOOLS <- [7, 8, 10, 11, 12, 13 ,15 ,18, 19, 21, 22, 25, 26, 28]; //31
g_WEAPONPOOLS <- [26, 26, 26, 11, 12, 26,26 ,26, 19, 26, 22, 25, 26, 28]; //31
g_EQUIPPOOLS <- [0, 1, 2, 3, 4];

g_ZeroVector <- VectorScreen(0, 0);
g_FullColour <- Colour(255, 255, 255, 255);
g_ZeroColour <- Colour(0, 0, 0, 0);

g_MainColour_0 <- Colour(255, 164, 26, 235);
g_MainColour_1 <- Colour(0, 0, 0, 240);
g_MainColour_2 <- Colour(15, 15, 15, 220);

g_BackgroundSprite <- "Inside/Background.png";
g_AlphaSprite <- "Inside/ZeroAlpha.png";

Global <-
{
LocalPlayer = null
LocalPlayerUIDGroup = ""
LocalVehicle = null

IsPlayerSpawnJumping = false

IsLogined = false
GameAnnounceAwakeTime = 0
}

GlobalUI <-
{
BackgroundMask_0 = GUISprite("Inside/BackgroundMask_0.png", g_ZeroVector, g_ZeroColour)
ServerCopyright = GUISprite("Inside/Copyright.png", g_ZeroVector, g_FullColour)
GameAnnounce = GUISprite("Inside/ZeroAlpha.png", g_ZeroVector, Colour(255, 255, 255, 0))
HealthBackground = GUISprite(g_BackgroundSprite, g_ZeroVector, Colour(255, 0, 0, 0))
}

keyEnter <- KeyBind( 0x0D );
keyEsc <- KeyBind( 0x1B );
keySpace <- KeyBind( 0x20 );
keyOEM <- KeyBind( 0xC0 );
keyRMouse <- KeyBind( 0x02 );
m_KeyAltEnter <- KeyBind( 0x12, 0x0D );

include( "3dchat.nut" );
include( "windows_mem.nut" );
include( "scenemanager_mem.nut" );
include( "account_mem.nut" );
include( "client_mem.nut" );
include( "gamemenu_mem.nut" );
include( "smallmap_mem.nut" );
include( "dashboard_mem.nut" );

function Script::ScriptLoad(){
Global.LocalPlayer = World.FindLocalPlayer();

AwakeAndCheckGameWindows();
AwakeClientScript();

GlobalUI.ServerCopyright.SendToTop();
GUI.GameResize(GUI.GetScreenSize().X, GUI.GetScreenSize().Y);
}

function Script::ScriptProcess(){
WindowsClassProc();
SceneManagerProc();
AccountClassProc();
ChatBubbleProc();
ClientScriptProc();
VehicleDashboardProc();
}

function Server::ServerData(stream)
{
local StreamReadInt = stream.ReadInt(),
StreamReadString = stream.ReadString();

ClientServerData(StreamReadInt, StreamReadString);
}

function KeyBind::OnDown(key)
{
SceneManagerKeyDown(key);
}

function KeyBind::OnUp(key)
{

}

function GUI::GameResize(width, height){
UpdateGlobalUIResize();

UpdateWindowsClassResize();
UpdateDashboardClassResize();
UpdateSceneManagerResize();
UpdateAccountPanelResize();
UpdateClientClassResize();
UpdateRankingMenuUIsResize();
}

function GUI::ElementHoverOver(element)
{
AccountPanelElementHoverOver(element);
ClientClassElementHoverOver(element);
}

function GUI::ElementHoverOut(element)
{
AccountPanelElementHoverOut(element);
ClientClassElementHoverOut(element);
}

function GUI::ElementClick(element, mouseX, mouseY)
{
AccountPanelElementClick(element, mouseX, mouseY);
}

function GUI::ElementRelease(element, mouseX, mouseY)
{
ClientClassElementRelease(element, mouseX, mouseY);
}

function GUI::InputReturn(editbox)
{
AccountPanelInputReturn(editbox);
}

function GUI::WindowClose(window)
{
ClientClassWindowClose(window);
}

function GUI::CheckboxToggle(checkbox, checked)
{

}

function GUI::ScrollbarScroll(scrollbar, position, change)
{

}

function GUI::ElementDrag(element, mouseX, mouseY)
{

}

function UpdateGlobalUIResize(){
local width = GUI.GetScreenSize().X, height = GUI.GetScreenSize().Y;

GlobalUI.HealthBackground.Size = GUI.GetScreenSize();

GlobalUI.GameAnnounce.Size = VectorScreen(width * 0.3, height * 0.1);
GlobalUI.GameAnnounce.Pos = VectorScreen(width / 2 - (GlobalUI.GameAnnounce.Size.X / 2), height * 0.3);

if(GlobalUI.BackgroundMask_0) GlobalUI.BackgroundMask_0.Size = VectorScreen(width, height);
if(GlobalUI.ServerCopyright)
{
GlobalUI.ServerCopyright.Size = VectorScreen(width * 0.45, height * 0.06);
GlobalUI.ServerCopyright.Pos = VectorScreen(width * 0.545, height * 0.925);
}
}

function SendData(str, int)
{
local message = Stream();
message.WriteInt(int.tointeger());
message.WriteString(str);
Server.SendData(message);
}

function ShowScreenMask(){
GlobalUI.BackgroundMask_0.Alpha = 150;
}

function HideScreenMask(){
GlobalUI.BackgroundMask_0.Alpha = 0;
}

function ShowElement(element)
{
if(element == null) return;

element.RemoveFlags(GUI_FLAG_DISABLED);
element.AddFlags(GUI_FLAG_VISIBLE);
}

function HideElement(element)
{
if(element == null) return;

element.AddFlags(GUI_FLAG_DISABLED);
element.RemoveFlags(GUI_FLAG_VISIBLE);
}

function Distance( x1, y1, z1, x2, y2, z2 )
{
    return sqrt( (x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2) + (z1 - z2) * (z1 - z2) );
}

function Abs(a)
{
if(a < 0)
{
a = a * -1;
}

return a;
}

function Minus(a)
{
if(a > 0)
{
a = a * -1;
}

return a;
}

function Lerp( a, b, t )
{
return a+(b-a)*t;
}

function Clamp( value, min, max )
{
if(value < min) return min;
else if(value > max) return max;
else return value;
}

function Random(min=0, max=RAND_MAX)
{
local r = rand();
srand(System.GetTimestamp() * r);
return (r % ((max + 1) - min)) + min;
}

function NumberReturnZero(num, length){
return ( "0000000000" + num ).slice( -length ); 
}
[/noae][/noae][/noae][/spoiler]

bruh plz tell me how i got kicked when i aqquire the custom weapon plz tell me bruh
@mR_Sk@

MRSK143

Quote from: MRSK143 on May 28, 2021, 02:58 PM
Quote from: Yyg on May 28, 2021, 11:01 AMThis is my main.nut file and it runs without any problems with me



[spoiler][noae][noae][noae][noae]g_MAXPLAYER <- 64;

g_MAPPOINTCOUNT <- 5
g_ANIMMENUCOUNT <- 13;
//g_WEAPONPOOLS <- [7, 8, 10, 11, 12, 13 ,15 ,18, 19, 21, 22, 25, 26, 28]; //31
g_WEAPONPOOLS <- [26, 26, 26, 11, 12, 26,26 ,26, 19, 26, 22, 25, 26, 28]; //31
g_EQUIPPOOLS <- [0, 1, 2, 3, 4];

g_ZeroVector <- VectorScreen(0, 0);
g_FullColour <- Colour(255, 255, 255, 255);
g_ZeroColour <- Colour(0, 0, 0, 0);

g_MainColour_0 <- Colour(255, 164, 26, 235);
g_MainColour_1 <- Colour(0, 0, 0, 240);
g_MainColour_2 <- Colour(15, 15, 15, 220);

g_BackgroundSprite <- "Inside/Background.png";
g_AlphaSprite <- "Inside/ZeroAlpha.png";

Global <-
{
LocalPlayer = null
LocalPlayerUIDGroup = ""
LocalVehicle = null

IsPlayerSpawnJumping = false

IsLogined = false
GameAnnounceAwakeTime = 0
}

GlobalUI <-
{
BackgroundMask_0 = GUISprite("Inside/BackgroundMask_0.png", g_ZeroVector, g_ZeroColour)
ServerCopyright = GUISprite("Inside/Copyright.png", g_ZeroVector, g_FullColour)
GameAnnounce = GUISprite("Inside/ZeroAlpha.png", g_ZeroVector, Colour(255, 255, 255, 0))
HealthBackground = GUISprite(g_BackgroundSprite, g_ZeroVector, Colour(255, 0, 0, 0))
}

keyEnter <- KeyBind( 0x0D );
keyEsc <- KeyBind( 0x1B );
keySpace <- KeyBind( 0x20 );
keyOEM <- KeyBind( 0xC0 );
keyRMouse <- KeyBind( 0x02 );
m_KeyAltEnter <- KeyBind( 0x12, 0x0D );

include( "3dchat.nut" );
include( "windows_mem.nut" );
include( "scenemanager_mem.nut" );
include( "account_mem.nut" );
include( "client_mem.nut" );
include( "gamemenu_mem.nut" );
include( "smallmap_mem.nut" );
include( "dashboard_mem.nut" );

function Script::ScriptLoad(){
Global.LocalPlayer = World.FindLocalPlayer();

AwakeAndCheckGameWindows();
AwakeClientScript();

GlobalUI.ServerCopyright.SendToTop();
GUI.GameResize(GUI.GetScreenSize().X, GUI.GetScreenSize().Y);
}

function Script::ScriptProcess(){
WindowsClassProc();
SceneManagerProc();
AccountClassProc();
ChatBubbleProc();
ClientScriptProc();
VehicleDashboardProc();
}

function Server::ServerData(stream)
{
local StreamReadInt = stream.ReadInt(),
StreamReadString = stream.ReadString();

ClientServerData(StreamReadInt, StreamReadString);
}

function KeyBind::OnDown(key)
{
SceneManagerKeyDown(key);
}

function KeyBind::OnUp(key)
{

}

function GUI::GameResize(width, height){
UpdateGlobalUIResize();

UpdateWindowsClassResize();
UpdateDashboardClassResize();
UpdateSceneManagerResize();
UpdateAccountPanelResize();
UpdateClientClassResize();
UpdateRankingMenuUIsResize();
}

function GUI::ElementHoverOver(element)
{
AccountPanelElementHoverOver(element);
ClientClassElementHoverOver(element);
}

function GUI::ElementHoverOut(element)
{
AccountPanelElementHoverOut(element);
ClientClassElementHoverOut(element);
}

function GUI::ElementClick(element, mouseX, mouseY)
{
AccountPanelElementClick(element, mouseX, mouseY);
}

function GUI::ElementRelease(element, mouseX, mouseY)
{
ClientClassElementRelease(element, mouseX, mouseY);
}

function GUI::InputReturn(editbox)
{
AccountPanelInputReturn(editbox);
}

function GUI::WindowClose(window)
{
ClientClassWindowClose(window);
}

function GUI::CheckboxToggle(checkbox, checked)
{

}

function GUI::ScrollbarScroll(scrollbar, position, change)
{

}

function GUI::ElementDrag(element, mouseX, mouseY)
{

}

function UpdateGlobalUIResize(){
local width = GUI.GetScreenSize().X, height = GUI.GetScreenSize().Y;

GlobalUI.HealthBackground.Size = GUI.GetScreenSize();

GlobalUI.GameAnnounce.Size = VectorScreen(width * 0.3, height * 0.1);
GlobalUI.GameAnnounce.Pos = VectorScreen(width / 2 - (GlobalUI.GameAnnounce.Size.X / 2), height * 0.3);

if(GlobalUI.BackgroundMask_0) GlobalUI.BackgroundMask_0.Size = VectorScreen(width, height);
if(GlobalUI.ServerCopyright)
{
GlobalUI.ServerCopyright.Size = VectorScreen(width * 0.45, height * 0.06);
GlobalUI.ServerCopyright.Pos = VectorScreen(width * 0.545, height * 0.925);
}
}

function SendData(str, int)
{
local message = Stream();
message.WriteInt(int.tointeger());
message.WriteString(str);
Server.SendData(message);
}

function ShowScreenMask(){
GlobalUI.BackgroundMask_0.Alpha = 150;
}

function HideScreenMask(){
GlobalUI.BackgroundMask_0.Alpha = 0;
}

function ShowElement(element)
{
if(element == null) return;

element.RemoveFlags(GUI_FLAG_DISABLED);
element.AddFlags(GUI_FLAG_VISIBLE);
}

function HideElement(element)
{
if(element == null) return;

element.AddFlags(GUI_FLAG_DISABLED);
element.RemoveFlags(GUI_FLAG_VISIBLE);
}

function Distance( x1, y1, z1, x2, y2, z2 )
{
    return sqrt( (x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2) + (z1 - z2) * (z1 - z2) );
}

function Abs(a)
{
if(a < 0)
{
a = a * -1;
}

return a;
}

function Minus(a)
{
if(a > 0)
{
a = a * -1;
}

return a;
}

function Lerp( a, b, t )
{
return a+(b-a)*t;
}

function Clamp( value, min, max )
{
if(value < min) return min;
else if(value > max) return max;
else return value;
}

function Random(min=0, max=RAND_MAX)
{
local r = rand();
srand(System.GetTimestamp() * r);
return (r % ((max + 1) - min)) + min;
}

function NumberReturnZero(num, length){
return ( "0000000000" + num ).slice( -length ); 
}
[/noae][/noae][/noae][/noae][/spoiler]

Bruh I Added The Weapon Successfully I Forget That I am using notepad for editing the file and i should use notepad c++ or Visual Studio Code.
but i had some problem when i aqquire that weapon then the server kicked me and I see error on console wtf was that you can see the error
https://ibb.co/JHVKWbD
now plz help me with this

bruh plz help me plz tell me that how can i fix when i got kicked due to weapon plz help me
@mR_Sk@

Yyg

Please check if this problem occurs before you add weapons

If this problem does not occur, it may be a problem with the weapon mod
If this problem still occurs, please reply to me again, it may be due to some reasons for synchronization

If you don't think too much, you can consider adding anticheat 0 to server.cfg, but this will break the VCMP built-in anti-cheat

Yyg

Some weapon mod data will trigger anti-cheating (such as recovery of HP weapons), I don't know how to solve this problem, you may need to carefully modify the weapon xml file

MRSK143

Hey Bro Can You Make The XML File For Weapons I Will Give YOu Models Of Weapons And Then Make XML file of it plz
@mR_Sk@

MRSK143

Quote from: Yyg on May 30, 2021, 08:53 AMSome weapon mod data will trigger anti-cheating (such as recovery of HP weapons), I don't know how to solve this problem, you may need to carefully modify the weapon xml file

plz fix this problem i dont want to Remove Anti Cheat
https://youtu.be/98MBRJBLZSw
plz help me bruh
@mR_Sk@