21.02.2015, 20:23
pawn Код:
stock randomString(strDest[], strLen = 10)
{
while(strLen--)
strDest[strLen] = random(2) ? (random(26) + (random(2) ? 'a' : 'A')) : (random(10) + '0');
}
And for the timer:
pawn Код:
public OnPlayerConnect(playerid)
{
PlayerKickTimer[playerid] = SetTimerEx("KickEx", 300*60, false, "i", playerid);
RandomString(PlayerString[playerid], 10);
new string[64];
format(string, sizeof string, "Type the following string: %s", PlayerString[playerid]);
ShowPlayerDialog(playerid, DIALOG_VERIFY, DIALOG_STYLE_INPUTTEXT, "String", string, "ok", "ok");
return 1;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == DIALOG_VERIFY && response)
{
if(strcmp(inputtext, PlayerString[playerid], true) != -1)
{
// correct
}
else KickEx(playerid);
}
return 1;
}