How to turn a value into integer in client side. tointeger() is not working.
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.
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);
}
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?
Quote from: Xmair on May 22, 2018, 12:53 PMQuote 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.
Solved. I was using wrong params.