Roleplay connect
#1

my problem is when player with wrong name connect to the game, give him the registration dialog and the message " This is a RolePlay Server, please reconnect using Firstname_Lastname format. "
this OnPlayerConnect callback:
pawn Код:
new name[MAX_PLAYER_NAME];
    GetPlayerName(playerid,name,sizeof(name));
    if(fexist(Path(playerid)))
    {
        INI_ParseFile(Path(playerid),"loadaccount_%s", .bExtra = true, .extra = playerid);
        ShowPlayerDialog(playerid,dlogin,DIALOG_STYLE_INPUT,"Login","Welcome back. This account is registered. \nType your password to login to your account","Login","Quit");/*A dialog with input style will appear so you can insert your password to login.*/
    }
    else
    {
        if(strfind(name, "0", true) != -1 || strfind(name, "1", true) != -1 || strfind(name, "2", true) != -1 || strfind(name, "3", true) != -1 || strfind(name, "4", true) != -1 || strfind(name, "5", true) != -1
        || strfind(name, "6", true) != -1 || strfind(name, "7", true) != -1 || strfind(name, "8", true) != -1 || strfind(name, "9", true) != -1 || strfind(name, "[", true) != -1 || strfind(name, "]", true) != -1
        || strfind(name, "_", true) == -1)
        {
            SendClientMessage(playerid, COLOR_LIGHTRED, "SERVER: {FFFFFF}This is a RolePlay Server, please reconnect using Firstname_Lastname format.");
            SetTimer("KickP", 1000, true);
        }
        else if(strfind(name, "_", true) != -1)
        {
        ShowPlayerDialog(playerid,dregister,DIALOG_STYLE_INPUT,"Register","Welcome! This account is not registered.\nEnter your own password to create a new account.","Register","Quit");
        }
        return 1;
    }
pawn Код:
stock Path(playerid)
{
    new str[128],name[MAX_PLAYER_NAME];
    GetPlayerName(playerid,name,sizeof(name));
    format(str,sizeof(str),UserPath,name);
    return str;
}
pawn Код:
forward KickP(playerid);
public KickP(playerid)
{
    Kick(playerid);
    return 1;
}
Reply


Messages In This Thread
Roleplay connect - by AhmedMohamed - 02.06.2014, 13:24
Re: Roleplay connect - by biker122 - 02.06.2014, 13:28
Re: Roleplay connect - by AhmedMohamed - 02.06.2014, 13:44
Re: Roleplay connect - by AhmedMohamed - 02.06.2014, 14:16

Forum Jump:


Users browsing this thread: 2 Guest(s)