OnServerData: Difference between revisions

From NPC for VCMP 0.4 Servers
Jump to navigation Jump to search
No edit summary
No edit summary
 
(One intermediate revision by the same user not shown)
Line 12: Line 12:
function OnServerData( data )
function OnServerData( data )
{
{
local a= ReadInt(b);
local a= ReadInt(data);
     local b= ReadByte(b);
     local b= ReadByte(data);
     local f= ReadFloat(b);
     local f= ReadFloat(data);
     local str= ReadString(b);
     local str= ReadString(data);
     if(b.tell() < b.size())
     if(data.tell() < data.len())
     //more items to read
     //more items to read
}
}

Latest revision as of 11:12, 28 September 2024

This function was added in v1.6 beta and will not work on previous versions.

Description:
This function is when server sends script data( Streams in squirrel04relxx )


Parameters:

( data )

data : The data the server send as a blob object


Return Values:
This function does not return any specific values.


Example

Assuming the server squirrel script send an integer, byte, float and string respectively as first part of Server Data,

function OnServerData( data )
{
	local a= ReadInt(data);
    local b= ReadByte(data);
    local f= ReadFloat(data);
    local str= ReadString(data);
    if(data.tell() < data.len())
    //more items to read
}

Related Functions

The following functions may be helpful as they relate to this function in one way or another.