Need some help for logic
#1

Well, I have a textdraw login system on my server.

I have 5 buttons on this textdraw, each button has two numbers (random).
My question is, if my password is 123
how I'll put the numbers (the numbers that are in the buttons) in order?

Didn't get? Here's a photo just to try to explain better.


I'll click on the first box, and then on the second box and then on the third box

bot each box has two numbers, how can I do it to detect each number belongs to my password?
Reply
#2

Something like that
pawn Код:
new numbers[MAX_PLAYERS][MAX_BUTTONS][MAX_NUMBERS_LENGHT];
new Text:textbox[MAX_PLAYERS][MAX_BUTTONS];
for(new d; d < sizeof(numbers[]); d++)
    valstr(numbers[playerid][d],(random(100)+1));
then

pawn Код:
http://wiki.sa-mp.com/wiki/OnPlayerClickTextDraw
+

pawn Код:
for(new d; d < sizeof(numbers[]); d++)
    TextDrawSetString(textbox[playerid][d],numbers[playerid][d]);
+

pawn Код:
public OnPlayerClickTextDraw(playerid, Text:clickedid)
{
    if(textbox[playerid][0] <= clickedid <= textbox[playerid][4])
    {
        new num = (_:clickedid - _:textbox[playerid][0]);
        strcat(password_array[playerid],numbers[playerid][num],sizeof(password_array[]));
    }
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)