<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-GB">
	<id>https://wiki.crumbledworld.com/index.php?action=history&amp;feed=atom&amp;title=Client</id>
	<title>Client - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.crumbledworld.com/index.php?action=history&amp;feed=atom&amp;title=Client"/>
	<link rel="alternate" type="text/html" href="https://wiki.crumbledworld.com/index.php?title=Client&amp;action=history"/>
	<updated>2026-04-21T23:08:02Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.41.4</generator>
	<entry>
		<id>https://wiki.crumbledworld.com/index.php?title=Client&amp;diff=107&amp;oldid=prev</id>
		<title>Anders: Created page with &quot;{{:ClientExampleCode}}  ==Functions== {| class=&quot;wikitable&quot; !|return !|function !|description |- |bool |isConnected() |returns true if connected to a server |- |bool |isLosingConnection() |returns true if no new messages has been received for the pas 2.5s. |- |bool |isAdmin() |returns true if admin of the server |- | |connect(string address) |Tries to connect t...&quot;</title>
		<link rel="alternate" type="text/html" href="https://wiki.crumbledworld.com/index.php?title=Client&amp;diff=107&amp;oldid=prev"/>
		<updated>2025-07-05T14:21:44Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;{{:ClientExampleCode}}  ==Functions== {| class=&amp;quot;wikitable&amp;quot; !|return !|function !|description |- |bool |&lt;a href=&quot;/index.php?title=Client:isConnected()&amp;amp;action=edit&amp;amp;redlink=1&quot; class=&quot;new&quot; title=&quot;Client:isConnected() (page does not exist)&quot;&gt;isConnected&lt;/a&gt;() |returns true if connected to a server |- |bool |&lt;a href=&quot;/index.php?title=Client:isLosingConnection()&amp;amp;action=edit&amp;amp;redlink=1&quot; class=&quot;new&quot; title=&quot;Client:isLosingConnection() (page does not exist)&quot;&gt;isLosingConnection&lt;/a&gt;() |returns true if no new messages has been received for the pas 2.5s. |- |bool |&lt;a href=&quot;/index.php?title=Client:isAdmin()&amp;amp;action=edit&amp;amp;redlink=1&quot; class=&quot;new&quot; title=&quot;Client:isAdmin() (page does not exist)&quot;&gt;isAdmin&lt;/a&gt;() |returns true if admin of the server |- | |&lt;a href=&quot;/index.php?title=Client:connect(string_address)&amp;amp;action=edit&amp;amp;redlink=1&quot; class=&quot;new&quot; title=&quot;Client:connect(string address) (page does not exist)&quot;&gt;connect&lt;/a&gt;(string address) |Tries to connect t...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{{:ClientExampleCode}}&lt;br /&gt;
&lt;br /&gt;
==Functions==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!|return&lt;br /&gt;
!|function&lt;br /&gt;
!|description&lt;br /&gt;
|-&lt;br /&gt;
|bool&lt;br /&gt;
|[[Client:isConnected()|isConnected]]()&lt;br /&gt;
|returns true if connected to a server&lt;br /&gt;
|-&lt;br /&gt;
|bool&lt;br /&gt;
|[[Client:isLosingConnection()|isLosingConnection]]()&lt;br /&gt;
|returns true if no new messages has been received for the pas 2.5s.&lt;br /&gt;
|-&lt;br /&gt;
|bool&lt;br /&gt;
|[[Client:isAdmin()|isAdmin]]()&lt;br /&gt;
|returns true if admin of the server&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|[[Client:connect(string address)|connect]](string address)&lt;br /&gt;
|Tries to connect to to the address. address can be like &amp;quot;localhost&amp;quot;,&amp;quot;192.168.1.2&amp;quot;. The connection attemps will be done in a seperate thread&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|[[Client:disconnect()|disconnect]]()&lt;br /&gt;
|Disconnects from the server&lt;br /&gt;
|-&lt;br /&gt;
|{ {ping=int(), clientId=int(), &lt;br /&gt;
playerId=int(), name=string()} }&lt;br /&gt;
|[[Client:getConnected()|getConnected]]()&lt;br /&gt;
|returns a table with all that is connected like {[1]=&amp;quot;client1&amp;quot;, [2]=&amp;quot;client2&amp;quot;}&lt;br /&gt;
|-&lt;br /&gt;
|[[string]]&lt;br /&gt;
|[[Client:getWhyNotConnected()|getWhyNotConnected]]()&lt;br /&gt;
|returns a [[string]] with the reason why the client is not connected anymore.&lt;br /&gt;
|-&lt;br /&gt;
|[[string]]&lt;br /&gt;
|[[Client:getUserName()|getUserName]]()&lt;br /&gt;
|Returns the name for this client, is also what will be shown to other players&lt;br /&gt;
|-&lt;br /&gt;
|int&lt;br /&gt;
|[[Client:getPlayerId()|getPlayerId]]()&lt;br /&gt;
|Returns the player id for the client. Is used for who owns what in multiplayer, this id can be changed.&lt;br /&gt;
|-&lt;br /&gt;
|int&lt;br /&gt;
|[[Client:getClientId()|getClientId]]()&lt;br /&gt;
|Returns a constant id that the server is using to identify you.&lt;br /&gt;
|-&lt;br /&gt;
|bool&lt;br /&gt;
|[[Client:isPlayerIdInUse(int id)|isPlayerIdInUse]](int id)&lt;br /&gt;
|Returns true if the player id is in use&lt;br /&gt;
|-&lt;br /&gt;
|int&lt;br /&gt;
|[[Client:getConnectedPlayerCount()|getConnectedPlayerCount]]()&lt;br /&gt;
|Returns the numbers of players.&lt;br /&gt;
|-&lt;br /&gt;
|double&lt;br /&gt;
|[[Client:getPing()|getPing]]()&lt;br /&gt;
|Returns the RTT.&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|[[Client:setUserName(string userName)|setUserName]](string userName)&lt;br /&gt;
|Sets the username and inform the server.&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|[[Client:requestPlayerId(int playerId)|requestPlayerId]](int playerId)&lt;br /&gt;
|Sends a request to the server for a playerId.&lt;br /&gt;
|-&lt;br /&gt;
|bool&lt;br /&gt;
|[[Client:hasConnectedUsersChanged()|hasConnectedUsersChanged]]()&lt;br /&gt;
|returns true if somone has connected to the server or disconnected&lt;br /&gt;
|-&lt;br /&gt;
|bool&lt;br /&gt;
|[[Client:hasMessage()|hasMessage]]()&lt;br /&gt;
|returns true if there is a message in the queue to be popped&lt;br /&gt;
|-&lt;br /&gt;
|[[string]]&lt;br /&gt;
|[[Client:popMessage()|popMessage]]()&lt;br /&gt;
|Returns the message in queue. or &amp;quot;&amp;quot; if none is available&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|[[Client:write(string msg)|write]](string msg)&lt;br /&gt;
|Write a message to all other connected clients. Delivery is not guaranteed&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|[[Client:writeSafe(string msg)|writeSafe]](string msg)&lt;br /&gt;
|Write a message to all other connected clients. Message is guaranteed to be delivered but not in order&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|[[Client:sendFile(int toClientId, string file)|sendFile]](int toClientId, string file)&lt;br /&gt;
|sends a file to a client&lt;br /&gt;
|-&lt;br /&gt;
|{string()}&lt;br /&gt;
|[[Client:getDowloadedFiles()|getDowloadedFiles]]()&lt;br /&gt;
|return a list of all downloaded files to there local file path. the file list is cleared after each call.&lt;br /&gt;
|-&lt;br /&gt;
|number&lt;br /&gt;
|[[Client:getDownloadPercentage()|getDownloadPercentage]]()&lt;br /&gt;
|return the download percentage status, is the average of all downloads.&lt;br /&gt;
|-&lt;br /&gt;
|number&lt;br /&gt;
|[[Client:getSendingPercentage()|getSendingPercentage]]()&lt;br /&gt;
|return the upload percentage status, is the average of all uploads.&lt;br /&gt;
|-&lt;br /&gt;
|bool&lt;br /&gt;
|[[Client:isDownloadingFiles()|isDownloadingFiles]]()&lt;br /&gt;
|return true if we are downloading any file&lt;br /&gt;
|-&lt;br /&gt;
|bool&lt;br /&gt;
|[[Client:isSendingFiles()|isSendingFiles]]()&lt;br /&gt;
|return true if we are uploading any file&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Anders</name></author>
	</entry>
</feed>