Client Side | integer

Started by umar4911, May 22, 2018, 09:16 AM

Previous topic - Next topic

umar4911

How to turn a value into integer in client side. tointeger() is not working.
RT Member | Asian City Scripter | CTB Contributor | VKs Contributor | European City Contributor | EAD Scripter

Xmair

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.

Credits to Boystang!

VU Full Member | VCDC 6 Coordinator & Scripter | EG A/D Contributor | Developer of VCCNR | Developer of KTB | Ex-Scripter of EAD

umar4911


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);
}
RT Member | Asian City Scripter | CTB Contributor | VKs Contributor | European City Contributor | EAD Scripter

Xmair

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?

Credits to Boystang!

VU Full Member | VCDC 6 Coordinator & Scripter | EG A/D Contributor | Developer of VCCNR | Developer of KTB | Ex-Scripter of EAD

umar4911

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.
RT Member | Asian City Scripter | CTB Contributor | VKs Contributor | European City Contributor | EAD Scripter

umar4911

Solved. I was using wrong params.
RT Member | Asian City Scripter | CTB Contributor | VKs Contributor | European City Contributor | EAD Scripter