Hi, everyone, I got a problem, I don't know how to convert string to int.
I want to make a code locking mechanism which is shorter than the one I made before but I can't.
Here is the code:
if(Code[1][4] == 1)
{
string Entered = StringSub(asEntity, 12, 1);
PlayGuiSound("Click", 1);
Code[1][0] = Entered; <- This line gives an error that it can't implictly convert string& to int&
Code[1][4]++;
AddDebugMessage("Entered: " + Code[1][0], false);
}
So, the buttons are called in a range from Lock_Button_0 to Lock_Button_9.
Code[1][4] is the digit you're currently entering (in this case the first).
The string "Entered" extracts the number from the name of the button (the string is the number, so I want to convert it to an integer).
Code[1][0] is the number that is set when a corresponding button is pressed (can range from 0 to 9).
I am no expert on C++, but I know some tricks
If someone knows how to do this I'd be very grateful.
Greetz, SPACoD