Vice City: Multiplayer

Server Development => Scripting and Server Management => Topic started by: umar4911 on May 22, 2018, 09:16 AM

Title: Client Side | integer
Post by: umar4911 on May 22, 2018, 09:16 AM
How to turn a value into integer in client side. tointeger() is not working.
Title: Re: Client Side | integer
Post by: Xmair on May 22, 2018, 10:23 AM
Quote from: umar4911 on May 22, 2018, 09:16 AMHow to turn a value into integer in client side. tointeger() is not working.
Show us the code, it should work.
Title: Re: Client Side | integer
Post by: umar4911 on May 22, 2018, 11:47 AM

function GGupdate(string)
{
local sX = GUI.GetScreenSize().X, sY = GUI.GetScreenSize().Y;
local params = split(string, " "), player = params[0], scr = params[1].tointeger();
if(GGscore.plr.Text == "null : 0")
{
GGscore.plr.Text = player + " : "+scr;
}
/* else if(GGscore.plr2.Text == "null : 0")
{
GGscore.plr2.Text = player + " : "+scr;
}
else if(GGscore.plr3.Text == "null : 0")
{
GGscore.plr3.Text = player + " : "+scr;
}
else if(GGscore.plr4.Text == "null : 0")
{
GGscore.plr4.Text = player + " : "+scr;
}
else if(GGscore.plr5.Text == "null : 0")
{
GGscore.plr5.Text = player + " : "+scr;
}
*/ else
{
local p1 = split(GGscore.plr.Text, " "), score1 = p1[1].tointeger();
local p2 = split(GGscore.plr2.Text, " "), score2 = p2[1];
local p3 = split(GGscore.plr3.Text, " "), score3 = p3[1];
local p4 = split(GGscore.plr4.Text, " "), score4 = p4[1];
local p5 = split(GGscore.plr5.Text, " "), score5 = p5[1];

if(score1 > scr) GGscore.plr.Text = player+" : "+scr;
}
SendDataToServer("hi", 1);
}
Title: Re: Client Side | integer
Post by: Xmair on May 22, 2018, 12:53 PM
Quote from: umar4911 on May 22, 2018, 11:47 AMfunction GGupdate(string)
{
local sX = GUI.GetScreenSize().X, sY = GUI.GetScreenSize().Y;
local params = split(string, " "), player = params[0], scr = params[1].tointeger();
if(GGscore.plr.Text == "null : 0")
{
GGscore.plr.Text = player + " : "+scr;
}
/* else if(GGscore.plr2.Text == "null : 0")
{
GGscore.plr2.Text = player + " : "+scr;
}
else if(GGscore.plr3.Text == "null : 0")
{
GGscore.plr3.Text = player + " : "+scr;
}
else if(GGscore.plr4.Text == "null : 0")
{
GGscore.plr4.Text = player + " : "+scr;
}
else if(GGscore.plr5.Text == "null : 0")
{
GGscore.plr5.Text = player + " : "+scr;
}
*/ else
{
local p1 = split(GGscore.plr.Text, " "), score1 = p1[1].tointeger();
local p2 = split(GGscore.plr2.Text, " "), score2 = p2[1];
local p3 = split(GGscore.plr3.Text, " "), score3 = p3[1];
local p4 = split(GGscore.plr4.Text, " "), score4 = p4[1];
local p5 = split(GGscore.plr5.Text, " "), score5 = p5[1];

if(score1 > scr) GGscore.plr.Text = player+" : "+scr;
}
SendDataToServer("hi", 1);
}
Is there any error?
Title: Re: Client Side | integer
Post by: umar4911 on May 22, 2018, 01:44 PM
Quote from: Xmair on May 22, 2018, 12:53 PM
Quote from: umar4911 on May 22, 2018, 11:47 AMfunction GGupdate(string)
{
local sX = GUI.GetScreenSize().X, sY = GUI.GetScreenSize().Y;
local params = split(string, " "), player = params[0], scr = params[1].tointeger();
if(GGscore.plr.Text == "null : 0")
{
GGscore.plr.Text = player + " : "+scr;
}
/* else if(GGscore.plr2.Text == "null : 0")
{
GGscore.plr2.Text = player + " : "+scr;
}
else if(GGscore.plr3.Text == "null : 0")
{
GGscore.plr3.Text = player + " : "+scr;
}
else if(GGscore.plr4.Text == "null : 0")
{
GGscore.plr4.Text = player + " : "+scr;
}
else if(GGscore.plr5.Text == "null : 0")
{
GGscore.plr5.Text = player + " : "+scr;
}
*/ else
{
local p1 = split(GGscore.plr.Text, " "), score1 = p1[1].tointeger();
local p2 = split(GGscore.plr2.Text, " "), score2 = p2[1];
local p3 = split(GGscore.plr3.Text, " "), score3 = p3[1];
local p4 = split(GGscore.plr4.Text, " "), score4 = p4[1];
local p5 = split(GGscore.plr5.Text, " "), score5 = p5[1];

if(score1 > scr) GGscore.plr.Text = player+" : "+scr;
}
SendDataToServer("hi", 1);
}
Is there any error?
I dont know how to debug client side as I am new but for verification, I added senddatatoclient. The message in send data and the data on the GGscire which is GUILabel is not changed.
Title: Re: Client Side | integer
Post by: umar4911 on May 23, 2018, 07:46 AM
Solved. I was using wrong params.