Question String to Number

Easver

New Member
Messages
2
Points
1
Hi,so first of all im kinda new in this world of modding/codding so please dont judge me (im still learning).

Im trying to convert a string to a number but i dont know exactly how to do it.
I got it work like this but i dont know if it can be call like that or no

Code:
//Lets suppose var its "5"; 
doCustomSpeed(var)
{
    varValue = Int(var);
    
    self setMoveSpeedScale(varValue);
    self iPrintLn("Movement Speed Set To ^2" + varValue);
}
I appreciate if anyone could answer me :grinning:!
 

candy

G59 Terrorist
Staff member
Premium Member
Donator
Messages
1,308
Points
748
Hi,so first of all im kinda new in this world of modding/codding so please dont judge me (im still learning).

Im trying to convert a string to a number but i dont know exactly how to do it.
I got it work like this but i dont know if it can be call like that or no

Code:
//Lets suppose var its "5";
doCustomSpeed(var)
{
    varValue = Int(var);
  
    self setMoveSpeedScale(varValue);
    self iPrintLn("Movement Speed Set To ^2" + varValue);
}
I appreciate if anyone could answer me :grinning:!
No reason todo it that way imo.
Code:
doCustomSpeed(var)
{
    self setMoveSpeedScale( var );
    self iPrintLn("Movement Speed Set To ^2" + var);
}
//call example
::doCustomSpeed, 5
 
Last edited:

Easver

New Member
Messages
2
Points
1
No reason todo it that way imo.
Code:
doCustomSpeed(var)
{
    self setMoveSpeedScale( var );
    self iPrintLn("Movement Speed Set To ^2" + var);
}
//call example
::doCustomSpeed, 5
Yea,i try it to do it like that but the menu base im using (Extinct Menu Base v1.2) i think doesnt support that way.
To call a "slider option" on that base its somethin like this ::doCustomSpeed, "2;3;4;5;1"
and if i try it like how you say doesnt work,maybe im doing something wrong?

Thanks for replying btw!
 

Top