02.09.2015, 13:23
What is causing 2 seconds spike of lag when I insert Username in this dialog?
pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
GetName(playerid) = PlayerInfo[playerid][pName];
switch( dialogid )
{
case DIALOG_CHOOSEUSERNAME:
{
if(response)
{
if(!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_CHOOSEUSERNAME, DIALOG_STYLE_INPUT,""COL_GREEN"Choose your Username",""COL_WHITE"Please choose your Username \nUsername lenght must be between 4-10 letters","Confirm","Abort");
if(!(4 <= strlen(inputtext) <= 10)) // to short username
{
//TextDrawSetSelectable(INPText[20], true);
return 1;
}
new INI:File = INI_Open(UserPath(playerid));
INI_SetTag(File,"Username");
INI_WriteInt(File,"Username",udb_hash(inputtext));
INI_Close(File);
CorrectUsername[playerid] = 1;
GoodUsername(playerid);
TextDrawSetString(Username[14], inputtext);
TextDrawColor(Username[14], -2147450625);
TextDrawShowForPlayer(playerid, Username[14]);
return 1;
}
return 1;
}