<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/">
	<channel>
		<title><![CDATA[G1R:MP Forum - G1 Remake Multiplayer Community - Scripting Help]]></title>
		<link>https://g1r-mp.com/forum/</link>
		<description><![CDATA[G1R:MP Forum - G1 Remake Multiplayer Community - https://g1r-mp.com/forum]]></description>
		<pubDate>Sat, 19 Sep 2026 07:35:03 +0000</pubDate>
		<generator>MyBB</generator>
		<item>
			<title><![CDATA[Default chat script understanding]]></title>
			<link>https://g1r-mp.com/forum/showthread.php?tid=38</link>
			<pubDate>Mon, 31 Aug 2026 21:35:47 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://g1r-mp.com/forum/member.php?action=profile&uid=11">Xardas0327</a>]]></dc:creator>
			<guid isPermaLink="false">https://g1r-mp.com/forum/showthread.php?tid=38</guid>
			<description><![CDATA[I try to understand the default/free resources, which are in the current G1RMP-Server-Protocol26-Win64 build.<br />
I have started the research with the chat resource, because it looks simple.<br />
So, I have turned off all resources, except the chat.<br />
<span style="font-style: italic;" class="mycode_i">Update</span>: I have checked in the G1RMP-Server-Protocol32-Win64 too.<br />
<br />
But I have some questions, because I don't understand a couple part of the code. <img src="https://g1r-mp.com/forum/images/smilies/biggrin.png" alt="Big Grin" title="Big Grin" class="smilie smilie_4" /><br />
<br />
<ol type="1" class="mycode_list"><li>Why I can open the chat with the "T" Key? I don't see any <span style="font-style: italic;" class="mycode_i">bindKey </span>function.<br />
Is it a default behaviour because of <span style="font-style: italic;" class="mycode_i">guiRegisterChat</span>?<br />
</li>
<li>I don't understand, how the message sending work.<br />
The server side looks clear for me. If the message is not command and there is no subscribed function for <span style="font-style: italic;" class="mycode_i">onPlayerChat </span>event,<br />
then it will call the <span style="font-style: italic;" class="mycode_i">outputChatBox </span>function (chat/server.lua line 145).<br />
But I don't understand, how the client catch the message.<br />
I see the <span style="font-style: italic;" class="mycode_i">CHAT_EVENT_OUTPUT</span> (value=g1r:chatOutput chat/client.lua line 6 and line 63)<span style="font-style: italic;" class="mycode_i"> custom event</span> catchs the message.<br />
But the server never call this event. How does the <span style="font-style: italic;" class="mycode_i">outputChatBox </span>function know it have to call the <span style="font-style: italic;" class="mycode_i">CHAT_EVENT_OUTPUT</span> event?<br />
<span style="font-style: italic;" class="mycode_i">Update</span>: It looks the <span style="font-style: italic;" class="mycode_i">g1r:chatOutput</span> is the important. If I change the string, the chat doesn't work.<br />
Is this string/event hardcoded in the server? I haven't found it in the documentation.<br />
</li>
<li><span style="font-style: italic;" class="mycode_i">Update</span>: Where is the time coming from on the chat?<br />
</li>
</ol>
+1: Where can I see the <span style="font-style: italic;" class="mycode_i">outputDebugString </span>logs from client side? The Wiki say it is available on client-side and the script use it.]]></description>
			<content:encoded><![CDATA[I try to understand the default/free resources, which are in the current G1RMP-Server-Protocol26-Win64 build.<br />
I have started the research with the chat resource, because it looks simple.<br />
So, I have turned off all resources, except the chat.<br />
<span style="font-style: italic;" class="mycode_i">Update</span>: I have checked in the G1RMP-Server-Protocol32-Win64 too.<br />
<br />
But I have some questions, because I don't understand a couple part of the code. <img src="https://g1r-mp.com/forum/images/smilies/biggrin.png" alt="Big Grin" title="Big Grin" class="smilie smilie_4" /><br />
<br />
<ol type="1" class="mycode_list"><li>Why I can open the chat with the "T" Key? I don't see any <span style="font-style: italic;" class="mycode_i">bindKey </span>function.<br />
Is it a default behaviour because of <span style="font-style: italic;" class="mycode_i">guiRegisterChat</span>?<br />
</li>
<li>I don't understand, how the message sending work.<br />
The server side looks clear for me. If the message is not command and there is no subscribed function for <span style="font-style: italic;" class="mycode_i">onPlayerChat </span>event,<br />
then it will call the <span style="font-style: italic;" class="mycode_i">outputChatBox </span>function (chat/server.lua line 145).<br />
But I don't understand, how the client catch the message.<br />
I see the <span style="font-style: italic;" class="mycode_i">CHAT_EVENT_OUTPUT</span> (value=g1r:chatOutput chat/client.lua line 6 and line 63)<span style="font-style: italic;" class="mycode_i"> custom event</span> catchs the message.<br />
But the server never call this event. How does the <span style="font-style: italic;" class="mycode_i">outputChatBox </span>function know it have to call the <span style="font-style: italic;" class="mycode_i">CHAT_EVENT_OUTPUT</span> event?<br />
<span style="font-style: italic;" class="mycode_i">Update</span>: It looks the <span style="font-style: italic;" class="mycode_i">g1r:chatOutput</span> is the important. If I change the string, the chat doesn't work.<br />
Is this string/event hardcoded in the server? I haven't found it in the documentation.<br />
</li>
<li><span style="font-style: italic;" class="mycode_i">Update</span>: Where is the time coming from on the chat?<br />
</li>
</ol>
+1: Where can I see the <span style="font-style: italic;" class="mycode_i">outputDebugString </span>logs from client side? The Wiki say it is available on client-side and the script use it.]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[getPlayerItemCount]]></title>
			<link>https://g1r-mp.com/forum/showthread.php?tid=35</link>
			<pubDate>Mon, 31 Aug 2026 08:13:38 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://g1r-mp.com/forum/member.php?action=profile&uid=49">Gummik</a>]]></dc:creator>
			<guid isPermaLink="false">https://g1r-mp.com/forum/showthread.php?tid=35</guid>
			<description><![CDATA[<a href="https://www.youtube.com/watch?v=5DNK2HQPiQ4" target="_blank" rel="noopener" class="mycode_url"><iframe width="560" height="315" src="//www.youtube-nocookie.com/embed/5DNK2HQPiQ4" frameborder="0" allowfullscreen="true"></iframe></a> <br />
<br />
<br />
Hi, I have a small issue with <span style="font-weight: bold;" class="mycode_b">getPlayerItemCount</span>.<br />
I know I might be showing this like a complete idiot, but according to the <br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>getPlayerItemCount</code></div></div> results, my framework doesn't seem to detect changes in the inventory.<br />
I'm not even sure why I'm showing the database value there <img src="https://g1r-mp.com/forum/images/smilies/biggrin.png" alt="Big Grin" title="Big Grin" class="smilie smilie_4" /> What I'm mainly trying to point out is that towards the end, you can see that I drop the item, but the console still says that I have it. (It's still in the database because it simply isn't being removed from the engine's inventory.)<br />
Am I just being dumb and have something configured incorrectly? I also tried the <br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>hasPlayerItem</code></div></div> function, and it returns <br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>true</code></div></div> for the items.<br />
<br />
(The code and how I’m using it are shown in the video.)<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
Edit : Second test picked items from ground <img src="https://img.redwestrp.eu/img/1788165616_0527.png" loading="lazy"  alt="[Image: 1788165616_0527.png]" class="mycode_img" /><br />
<br />
<br />
<br />
<br />
Third edit : <br />
I found out that if I give myself an item and remove it using the function, it works really well. But it only works with giveitem/removeItem.<br />
The problem occurs when, for example, I pick up an item from the ground — the value doesn't get updated. The same happens when I drop an item — the value doesn't get updated and stays the same. <img src="https://g1r-mp.com/forum/images/smilies/smile.png" alt="Smile" title="Smile" class="smilie smilie_1" />]]></description>
			<content:encoded><![CDATA[<a href="https://www.youtube.com/watch?v=5DNK2HQPiQ4" target="_blank" rel="noopener" class="mycode_url"><iframe width="560" height="315" src="//www.youtube-nocookie.com/embed/5DNK2HQPiQ4" frameborder="0" allowfullscreen="true"></iframe></a> <br />
<br />
<br />
Hi, I have a small issue with <span style="font-weight: bold;" class="mycode_b">getPlayerItemCount</span>.<br />
I know I might be showing this like a complete idiot, but according to the <br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>getPlayerItemCount</code></div></div> results, my framework doesn't seem to detect changes in the inventory.<br />
I'm not even sure why I'm showing the database value there <img src="https://g1r-mp.com/forum/images/smilies/biggrin.png" alt="Big Grin" title="Big Grin" class="smilie smilie_4" /> What I'm mainly trying to point out is that towards the end, you can see that I drop the item, but the console still says that I have it. (It's still in the database because it simply isn't being removed from the engine's inventory.)<br />
Am I just being dumb and have something configured incorrectly? I also tried the <br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>hasPlayerItem</code></div></div> function, and it returns <br />
<div class="codeblock"><div class="title">Code:</div><div class="body" dir="ltr"><code>true</code></div></div> for the items.<br />
<br />
(The code and how I’m using it are shown in the video.)<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
Edit : Second test picked items from ground <img src="https://img.redwestrp.eu/img/1788165616_0527.png" loading="lazy"  alt="[Image: 1788165616_0527.png]" class="mycode_img" /><br />
<br />
<br />
<br />
<br />
Third edit : <br />
I found out that if I give myself an item and remove it using the function, it works really well. But it only works with giveitem/removeItem.<br />
The problem occurs when, for example, I pick up an item from the ground — the value doesn't get updated. The same happens when I drop an item — the value doesn't get updated and stays the same. <img src="https://g1r-mp.com/forum/images/smilies/smile.png" alt="Smile" title="Smile" class="smilie smilie_1" />]]></content:encoded>
		</item>
		<item>
			<title><![CDATA[onPlayerJoin event with spawnPlayer]]></title>
			<link>https://g1r-mp.com/forum/showthread.php?tid=33</link>
			<pubDate>Sun, 30 Aug 2026 17:50:19 +0000</pubDate>
			<dc:creator><![CDATA[<a href="https://g1r-mp.com/forum/member.php?action=profile&uid=11">Xardas0327</a>]]></dc:creator>
			<guid isPermaLink="false">https://g1r-mp.com/forum/showthread.php?tid=33</guid>
			<description><![CDATA[I don't know these things are bugs or features.<br />
So, I write them here.<br />
<br />
There are 2 simple functions.<br />
<blockquote class="mycode_quote"><cite>Quote:</cite>addEventHandler("onPlayerJoin", root, function(playerId)<br />
       outputDebugString("onPlayerJoin Start")<br />
       spawnPlayer(playerId, 12.0, 24.0, 2.0, 90)<br />
       outputDebugString("onPlayerJoin End")<br />
end)<br />
<br />
addCommandHandler("default", function(playerId, commandName)<br />
       spawnPlayer(playerId, 12.0, 24.0, 2.0, 90)<br />
end)</blockquote>
<br />
<br />
<ol type="1" class="mycode_list"><li>If a player join to the server, the player should be spawned on that position. ( x= 12.0, y = 24.0, z = 2.0)<br />
But it doesn't work. I have seen the 2 debug logs, but the player are still on the default position, where we start the game.<br />
</li>
<li>If you the /default command, it is fine.<br />
But I see similar messages in the server log:<br />
<blockquote class="mycode_quote"><cite>Quote:</cite>[security] movement snapshot held player=2 violation=4 score=0.00 horizontal=4313.8/240.0 vertical=399.1/400.0 authorityGrace=1TRAFFIC_GUARD acceptedConnections=2 rejectedConnections=0 droppedPackets=4 disconnectedPeers=1 blockedAddresses=0 invalidPackets=0 oversizedPackets=0 trackedAddresses=1</blockquote>
<br />
</li>
<li>If I spawn the player another places like in the Gomez's castle, the game is loading and I get a new player id. (x= 1116.75, y = -1007.51, z = -36.66)<br />
And I see similar messages in the server log: <br />
<blockquote class="mycode_quote"><cite>Quote:</cite>[security] movement snapshot held player=1 violation=4 score=0.00 horizontal=43267.8/240.0 vertical=6120.6/400.0 authorityGrace=1<br />
CONNECT_PENDING player=2 address=xxx.xxx.xxx.xxx peer=0000020538CEE540</blockquote>
<br />
</li>
<li>If I use setPlayerPosition instead of  spawnPlayer, I get the same results.<br />
</li>
</ol>
]]></description>
			<content:encoded><![CDATA[I don't know these things are bugs or features.<br />
So, I write them here.<br />
<br />
There are 2 simple functions.<br />
<blockquote class="mycode_quote"><cite>Quote:</cite>addEventHandler("onPlayerJoin", root, function(playerId)<br />
       outputDebugString("onPlayerJoin Start")<br />
       spawnPlayer(playerId, 12.0, 24.0, 2.0, 90)<br />
       outputDebugString("onPlayerJoin End")<br />
end)<br />
<br />
addCommandHandler("default", function(playerId, commandName)<br />
       spawnPlayer(playerId, 12.0, 24.0, 2.0, 90)<br />
end)</blockquote>
<br />
<br />
<ol type="1" class="mycode_list"><li>If a player join to the server, the player should be spawned on that position. ( x= 12.0, y = 24.0, z = 2.0)<br />
But it doesn't work. I have seen the 2 debug logs, but the player are still on the default position, where we start the game.<br />
</li>
<li>If you the /default command, it is fine.<br />
But I see similar messages in the server log:<br />
<blockquote class="mycode_quote"><cite>Quote:</cite>[security] movement snapshot held player=2 violation=4 score=0.00 horizontal=4313.8/240.0 vertical=399.1/400.0 authorityGrace=1TRAFFIC_GUARD acceptedConnections=2 rejectedConnections=0 droppedPackets=4 disconnectedPeers=1 blockedAddresses=0 invalidPackets=0 oversizedPackets=0 trackedAddresses=1</blockquote>
<br />
</li>
<li>If I spawn the player another places like in the Gomez's castle, the game is loading and I get a new player id. (x= 1116.75, y = -1007.51, z = -36.66)<br />
And I see similar messages in the server log: <br />
<blockquote class="mycode_quote"><cite>Quote:</cite>[security] movement snapshot held player=1 violation=4 score=0.00 horizontal=43267.8/240.0 vertical=6120.6/400.0 authorityGrace=1<br />
CONNECT_PENDING player=2 address=xxx.xxx.xxx.xxx peer=0000020538CEE540</blockquote>
<br />
</li>
<li>If I use setPlayerPosition instead of  spawnPlayer, I get the same results.<br />
</li>
</ol>
]]></content:encoded>
		</item>
	</channel>
</rss>