Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- stock ShowLoginScreen(playerid)
- {
- new string[100];
- format(string, sizeof(string), "{6EF83C}Welcome back %s\nBefore playing you must login\nEnter your password below and click login",PlayerName(playerid));
- ShowPlayerDialog(playerid,DIALOG_LOGIN,DIALOG_STYLE_INPUT,"{6EF83C}Login required",string,"Login","Cancel");
- }
- stock ShowRegisterScreen(playerid)
- {
- new string[100];
- format(string, sizeof(string), "{6EF83C}Welcome to the Sfrcnr{F81414} %s\nYou need to create an account before playing",PlayerName(playerid));
- ShowPlayerDialog(playerid,DIALOG_REGISTER,DIALOG_STYLE_INPUT,"{F81414}Registration required",string,"Register","Cancel");
- }
- La OnPlayerConnect
- if(udb_Exists(PlayerName(playerid)) && !PLAYERLIST_authed[playerid]) {
- ShowLoginScreen(playerid);
- return 0;
- }
- if(!udb_Exists(PlayerName(playerid)) && !PLAYERLIST_authed[playerid]) {
- ShowRegisterScreen(playerid);
- return 0;
- }
- sh la OnDialogResponse
- if(dialogid == DIALOG_LOGIN)
- {
- if (response == 0)
- {
- SendClientMessage(playerid,COLOR_ERROR,"You must login before playing on this server.");
- ShowLoginScreen(playerid);
- return 1;
- }
- if (response == 1)
- {
- if (strlen(inputtext) == 0)
- {
- SendClientMessage(playerid,COLOR_ERROR,"Please enter your password for your account in the box below.");
- ShowLoginScreen(playerid);
- return 1;
- }
- if (udb_CheckLogin(PlayerName(playerid),inputtext))
- {
- GivePlayerMoney(playerid,dUserINT(PlayerName(playerid)).("money")-GetPlayerMoney(playerid));
- PLAYERLIST_authed[playerid]=true;
- new pIp[16];
- GetPlayerIp(playerid, pIp, sizeof(pIp));
- dUserSet(PlayerName(playerid)).("IP", pIp);
- PLAYERLIST_authed[playerid]=true;
- return SendClientMessage(playerid,COLOR_GREEN,"You have successfully logged!");
- }
- ShowLoginScreen(playerid);
- CheckPasswordAttempts(playerid);
- }
- return 1;
- }
- if(dialogid == DIALOG_REGISTER)
- {
- if (response == 0)
- {
- SendClientMessage(playerid,COLOR_ERROR,"You must register before playing on this server.");
- ShowRegisterScreen(playerid);
- return 1;
- }
- if (response == 1)
- {
- if (udb_Exists(PlayerName(playerid)))
- {
- SendClientMessage(playerid,COLOR_ERROR,"This account already exists, please choose a different player name.");
- return 1;
- }
- if (strlen(inputtext)==0)
- {
- SendClientMessage(playerid,COLOR_ERROR,"Please enter your password in the box to register in this server.");
- ShowRegisterScreen(playerid);
- return 1;
- }
- if (udb_Create(PlayerName(playerid),inputtext))
- {
- SendClientMessage(playerid,COLOR_GREEN,"Congratulations!You have registered,now please enter your password in the box to login.");
- ShowLoginScreen(playerid);
- dUserSetINT(PlayerName(playerid)).("money",7500);
- new pIp[16];
- GetPlayerIp(playerid, pIp, sizeof(pIp));
- dUserSet(PlayerName(playerid)).("IP", pIp);
- }
- return true;
- }
- return 1;
- }
Add Comment
Please, Sign In to add comment