07.01.2015, 22:21
i need when player come and when don't have account i want registration dialog for this player but i don't know how to add it , tell me what i need to post from script
/*Dialogs ID(s)*/ #define DIALOG_REGISTER 1995 #define DIALOG_LOGIN 1996 #define JDIALOGS 2000 #define DIALOG_PRIVATE_MESSAGE 1997 |
public OnPlayerConnect(playerid) { [ if(strlen(aka) > 70) { strmid(Jstring,aka,0,70); format(Jstr, sizeof(Jstr),"Sign in >> Player: %s - IP: %s - AKA: %s", GetName(playerid),playerIP , Jstring); SendToAdmins(Cmdcolor,Jstr); strmid(Jstring,aka,70,sizeof(aka)); format(Jstr, sizeof(Jstr),"%s", Jstring); SendToAdmins(Cmdcolor,Jstr); } else { if(strlen(aka) > 2) format(Jstr, sizeof(Jstr),"Sign in >> Player: %s - IP: %s - AKA: %s", GetName(playerid),playerIP , aka); else format(Jstr, sizeof(Jstr),"Sign in >> Player: %s - IP: %s - AKA: No aka found!", GetName(playerid),playerIP); SendToAdmins(Cmdcolor,Jstr); } format(Jfile, 100, ACCOUNTS_PATH, GetName(playerid)); if(!fexist(Jfile)) { format(Jstring, sizeof(Jstring),"Nick name \"%s\" isn't registered. Please register your nick name to save your status\nEnter the password:", GetName(playerid)); if(MustRegister == 1) ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD,"Register an account!", Jstring, "Register", "Kick"); SendClientMessage(playerid,red,"Nick name isn't registered!"); SendClientMessage(playerid,lighterblue,"Please register to create an account (/register)"); } else { pInfo[playerid][Registered] = 1; format(Jfile, 100, ACCOUNTS_PATH, GetName(playerid)); INI_ParseFile(Jfile, "GetPlayerInfo", .bExtra = true, .extra = playerid); if(AutoLogin == 1 && (!strcmp(pIP, pInfo[playerid][IP],true) && pInfo[playerid][pAutoLogin] == 1)) { format(Jfile, 100, ACCOUNTS_PATH, GetName(playerid)); INI_ParseFile(Jfile, "LoginPlayer", .bExtra = true, .extra = playerid); SetPlayerScore(playerid, pInfo[playerid][Score]); GivePlayerMoney(playerid, pInfo[playerid][Cash]); pInfo[playerid][Logged] = 1; if(pInfo[playerid][pLevel] >= 1) { switch(pInfo[playerid][pLevel]) { case 1: LevelName = ADMIN_LEVEL_1; case 2: LevelName = ADMIN_LEVEL_2; case 3: LevelName = ADMIN_LEVEL_4; case 4: LevelName = ADMIN_LEVEL_3; case 5: LevelName = ADMIN_LEVEL_5; default: LevelName = ADMIN_LEVEL_6; } format(Jstring, sizeof(Jstring),"Welcome back, You have been automatically logged in! | Level: %d (%s)", pInfo[playerid][pLevel], LevelName); SendClientMessage(playerid,lighterblue,Jstring); } else SendClientMessage(playerid,lighterblue,"Welcome back, You have been automatically logged in!"); } else { #if LoginTextDraw == false format(Jstring, sizeof(Jstring),"Nick name \"%s\" registered.\nPlease enter your password to login", GetName(playerid)); ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD,"Account Login", Jstring, "Login", "Quit"); #endif SendClientMessage(playerid,lighterblue,"Nick name is registered!"); SendClientMessage(playerid,red,"Please '/login' access your account"); } } if(ForbiddenNamesKick == 1 && IsForbiddenNick(playerid) == 1) { format(Jstring, sizeof(Jstring),"{FB0404}Your nick name \"%s\" is in blacklist. please relog\nwith a new nick name", GetName(playerid)); ShowPlayerDialog(playerid, JDIALOGS+45, DIALOG_STYLE_MSGBOX," {FB0404}Forbidden nick", Jstring, "Ok", ""); SetTimerEx("KickPlayer",200,false,"d", playerid); format(Jstring, sizeof(Jstring),"\"%s\" has been automatically kicked | reason: 'Forbidden Name'", GetName(playerid)); SendToAdmins(orange,Jstring); WriteToLog(Jstring,"KickLog"); } if(KickPartNicks == 1 && IsBadNickPart(playerid) == 1) { format(Jstring, sizeof(Jstring),"{FB0404}Your nick name part \"%s\" is in Forbidden part nick names list.\nplease relog with a new nick name", BadNickParts[BadPartID]); ShowPlayerDialog(playerid, JDIALOGS+45, DIALOG_STYLE_MSGBOX," {FB0404}Forbidden part nick", Jstring, "Ok", ""); SetTimerEx("KickPlayer",200,false,"d", playerid); format(Jstring, sizeof(Jstring),"\"%s\" has been automatically kicked | reason: 'Forbidden part nick (%s)'", GetName(playerid),BadNickParts[BadPartID]); SendToAdmins(orange,Jstring); WriteToLog(Jstring,"KickLog"); } return 1; } |