help (dyaloglogin)
#3

PHP код:
//==========================On Dialog Response==================================
public OnDialogResponse(playeriddialogidresponselistiteminputtext[])
{
    new 
idx;
    new 
string[128];
    new 
params[128];
//    new cmd[256];
    
new moneys[MAX_PLAYERS];
    new 
giveplayer[128];
    new 
giveplayerid;
    new 
sendername[MAX_PLAYER_NAME];
    new 
playermoney[MAX_PLAYERS];
    new 
iparam1;
    new 
adminname[MAX_PLAYER_NAME], playername[MAX_PLAYER_NAME];
    new 
player1,colour1colour2;
    if(
dialogid == 9048 && response)
    {
        new 
dialogstr[256];
        new 
pame[MAX_PLAYER_NAME];
        
GetPlayerName(playeridpamesizeof(pame));
        if (
PlayerInfo[playerid][LoggedIn] == 1) return SendClientMessage(playerid,red,"ACCOUNT: You are already logged in.");
        if (!
udb_Exists(PlayerName2(playerid))) return SendClientMessage(playerid,red,"ACCOUNT: Account doesn't exist, please use '/register [password]'.");
        if (
strlen(inputtext)==0) return format(dialogstr,sizeof(dialogstr),"{FFFFFF}%s This Name is registered please login:"pame), ShowPlayerDialog(playerid9048DIALOG_STYLE_INPUT"{FF0000}Login"dialogstr"Aceptar""Cancelar");
        if (
udb_CheckLogin(PlayerName2(playerid),inputtext))
        {
            new 
file[256], tmp3[100];
               
format(file,sizeof(file),"/ladmin/users/%s.sav",udb_encode(PlayerName2(playerid)) );
               
GetPlayerIp(playerid,tmp3,100);
               
dini_Set(file,"ip",tmp3);
            
LoginPlayer(playerid);
            
LoadPlayer(playerid);
            
PlayerPlaySound(playerid,1057,0.0,0.0,0.0);
            if(
PlayerInfo[playerid][Level] > 0) {
                
format(string,sizeof(string),"ACCOUNT: Successfully Logged In. (Level %d)"PlayerInfo[playerid][Level] );
                return 
SendClientMessage(playerid,green,string);
               } else return 
SendClientMessage(playerid,green,"ACCOUNT: Successfully Logged In");
        }
        else {
            
Kick(playerid);
            
PlayerInfo[playerid][FailLogin]++;
            
printf("LOGIN: %s has failed to login, Wrong password (%s) Attempt (%d)"PlayerName2(playerid), inputtextPlayerInfo[playerid][FailLogin] );
            if(
PlayerInfo[playerid][FailLogin] == MAX_FAIL_LOGINS)
            {
                
format(stringsizeof(string), "%s has been kicked (Failed Logins)"PlayerName2(playerid) );
                
SendClientMessageToAll(greystring);
                print(string);
                
Kick(playerid);
            }
            return 
SendClientMessage(playerid,red,"ACCOUNT: Login failed! Incorrect Password");
            }
    }
    if(
dialogid == 9049 && response)
    {
        new 
dialogstr[256];
        new 
pame[MAX_PLAYER_NAME];
        
GetPlayerName(playeridpamesizeof(pame));
        if (
PlayerInfo[playerid][LoggedIn] == 1) return SendClientMessage(playerid,red,"ACCOUNT: You are already registered and logged in.");
        if (
udb_Exists(PlayerName2(playerid))) return SendClientMessage(playerid,GREEN,"ACCOUNT: This account already exists, please use '/login [password]'.");
        if (
strlen(inputtext) == 0) return format(dialogstr,sizeof(dialogstr),"{FFFFFF}%s your nickname isn't registed please choose a password:"pame), ShowPlayerDialog(playerid9049DIALOG_STYLE_INPUT"{FF0000}Register"dialogstr"Aceptar""Cancelar");
        if (
strlen(inputtext) < || strlen(inputtext) > 20) return format(dialogstr,sizeof(dialogstr),"{FFFFFF}%s your nickname isn't registed please choose a password:"pame), ShowPlayerDialog(playerid9049DIALOG_STYLE_INPUT"{FF0000}Register"dialogstr"Aceptar""Cancelar");
        if (
udb_Create(PlayerName2(playerid),inputtext))
        {
            new 
file[256], tmp3[100];
            new 
strdate[20], year,month,day;    getdate(yearmonthday);
            
GetPlayerName(playerid,pame,sizeof(pame)); format(file,sizeof(file),"/ladmin/users/%s.sav",udb_encode(pame));
             
GetPlayerIp(playerid,tmp3,100);    dini_Set(file,"ip",tmp3);
    
//        dini_Set(file,"password",params);
            
dUserSetINT(PlayerName2(playerid)).("registered",1);
               
format(strdatesizeof(strdate), "%d/%d/%d",day,month,year);
            
GetPlayerIp(playerid,tmp3,100);
            
dini_Set(file,"ip",tmp3);
    
//        dini_Set(file,"password",params);
            
dUserSetINT(PlayerName2(playerid)).("registered",1);
               
format(strdatesizeof(strdate), "%d/%d/%d",day,month,year);
            
dini_Set(file,"RegisteredDate",strdate);
            
dUserSetINT(PlayerName2(playerid)).("loggedin",1);
            
dUserSetINT(PlayerName2(playerid)).("banned",0);
            
dUserSetINT(PlayerName2(playerid)).("level",0);
            
dUserSetINT(PlayerName2(playerid)).("LastOn",0);
            
dUserSetINT(PlayerName2(playerid)).("money",0);
            
dUserSetINT(PlayerName2(playerid)).("kills",0);
               
dUserSetINT(PlayerName2(playerid)).("deaths",0);
            
dUserSetINT(PlayerName2(playerid)).("Bank",PlayerInfo[playerid][bank]);
            
dUserSetINT(PlayerName2(playerid)).("weed",PlayerInfo[playerid][weed]);
            
dUserSetINT(PlayerName2(playerid)).("Gang",PlayerInfo[playerid][gang]);
            
dUserSetINT(PlayerName2(playerid)).("Condoms",PlayerInfo[playerid][condoms]);
            
dUserSetINT(PlayerName2(playerid)).("inalcatraz",PlayerInfo[playerid][inalcatraz]);
            
PlayerInfo[playerid][LoggedIn] = 1;
            
PlayerInfo[playerid][Registered] = 1;
            
SavePlayer(playerid);
            
dUserSetINT(PlayerName2(playerid)).("bowner",0);
            
dUserSetINT(PlayerName2(playerid)).("bowned",0);
               
dUserSetINT(PlayerName2(playerid)).("vowned",0);
               
dUserSetINT(PlayerName2(playerid)).("vowner",0);
               
dUserSetINT(PlayerName2(playerid)).("vowned2",0);
               
dUserSetINT(PlayerName2(playerid)).("vowner2",0);
               
dUserSetINT(PlayerName2(playerid)).("vowned3",0);
               
dUserSetINT(PlayerName2(playerid)).("vowner3",0);
               
dUserSetINT(PlayerName2(playerid)).("vowned4",0);
               
dUserSetINT(PlayerName2(playerid)).("vowner4",0);
               
dUserSetINT(PlayerName2(playerid)).("vowned5",0);
               
dUserSetINT(PlayerName2(playerid)).("vowner5",0);
               
dUserSetINT(PlayerName2(playerid)).("vowned6",0);
               
dUserSetINT(PlayerName2(playerid)).("vowner6",0);
               
dUserSetINT(PlayerName2(playerid)).("vowned7",0);
               
dUserSetINT(PlayerName2(playerid)).("vowner7",0);
               
dUserSetINT(PlayerName2(playerid)).("vowned8",0);
               
dUserSetINT(PlayerName2(playerid)).("vowner8",0);
               
dUserSetINT(PlayerName2(playerid)).("vowned9",0);
               
dUserSetINT(PlayerName2(playerid)).("vowner9",0);
               
dUserSetINT(PlayerName2(playerid)).("vowned10",0);
               
dUserSetINT(PlayerName2(playerid)).("vowner10",0);
               
dUserSetINT(PlayerName2(playerid)).("Houseid", -255);
            
dUserSetINT(PlayerName2(playerid)).("Rentid", -255);
            
dUserSetINT(PlayerName2(playerid)).("SpawnX"0);
            
dUserSetINT(PlayerName2(playerid)).("SpawnY"0);
            
dUserSetINT(PlayerName2(playerid)).("SpawnZ"0);
            
dUserSetINT(PlayerName2(playerid)).("SpawnInt"0);
            
LoginPlayer(playerid);
            
LoadPlayer(playerid);
            
SendClientMessage(playeridgreen"ACCOUNT: You are now registered, and have been automaticaly logged in");
            
PlayerPlaySound(playerid,1057,0.0,0.0,0.0);
            return 
1;
        }
        return 
1;

Reply


Messages In This Thread
help (dyaloglogin) - by s3ek - 08.02.2015, 22:28
Re: help (dyaloglogin) - by Sime30 - 08.02.2015, 22:56
Re: help (dyaloglogin) - by s3ek - 08.02.2015, 23:11
Re: help (dyaloglogin) - by Sime30 - 08.02.2015, 23:30
Re: help (dyaloglogin) - by s3ek - 09.02.2015, 00:20
Re: help (dyaloglogin) - by Schneider - 09.02.2015, 00:37
Re: help (dyaloglogin) - by s3ek - 09.02.2015, 00:41
Re: help (dyaloglogin) - by Schneider - 09.02.2015, 01:02
Re: help (dyaloglogin) - by s3ek - 09.02.2015, 01:18
Re: help (dyaloglogin) - by Schneider - 09.02.2015, 02:31

Forum Jump:


Users browsing this thread: 3 Guest(s)