Code: Select all
float g_tornillo;
string s_tornillo; // a string that write a number inside the button.
g_tornillo = getstatf(STAT_ITEM_TORNILLO );
s_tornillo = ftos(g_tornillo); // doesn´t work. i also tested s_tornillo = ftos(STAT_ITEM_TORNILLO ); with no positive results
if (g_tornillo >= 1)
{
CreateButton( s_tornillo,"impulse 19\n;back",men, buttonback, but_size, 1");
}
else
{
CreatePic( men, buttonback, but_size, 0.1);
}
men_x = men_x + but_size_x;
I tested this code to redefine the string "s_tornillo" and works perfectly in the button
Code: Select all
if (g_tornillo == 1)
s_tornillo = "1";
else if (g_tornillo == 2)
s_tornillo = "2";