SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help > Help Archive

 
 
Thread Tools Display Modes
Old 06/08/2011, 11:21 AM   #1
freshOrange
Big Clucker
 
Join Date: May 2011
Posts: 102
Reputation: 2
Default /login to dialog

So, I have got these, which I would like to convert to dialog system, I started it but couldn't finish.
pawn Code:
LoginPlayer(playerid, password[])
{
    if(!AccountExists[playerid])
    {
        return SendClientMessage(playerid, WHITE, "You are not registered!");
    }
    if(PlayerLogged[playerid])
    {
            return SendClientMessage(playerid, WHITE, "You are already logged in!");
    }
    if(strlen(password) < 3 || strlen(password) >= 32)
    {
            return SendClientMessage(playerid, WHITE, "Password is too short or too long.");
    }
    CheckMySQL();
    new string[128];
    format(string, sizeof(string), "SELECT * FROM Users WHERE Name = '%s' AND Password = '%s'", UserStats[playerid][Name], password);
    mysql_query(string);
    mysql_store_result();
    if(!mysql_num_rows())
    {
        return SendClientMessage(playerid, WHITE, "Incorrect password!");
    }
    new row[128];
    new field[4][32];
    mysql_fetch_row_format(row, "|");
    explode(row, field, "|");
    mysql_free_result();
    format(UserStats[playerid][Password], 32, "%s", field[1]);
    UserStats[playerid][Admin] = strval(field[2]);
    UserStats[playerid][Money] = strval(field[3]);
    GivePlayerMoney(playerid, UserStats[playerid][Money]);
    format(string, sizeof(string), "Welcome back %s, you have been logged in!", UserStats[playerid][Name]);
    SendClientMessage(playerid, WHITE, string);
    PlayerLogged[playerid] = 1;
    return 1;
}

And

pawn Code:
CMD:login(playerid, params[])
{
    LoginPlayer(playerid, params);
    return 1;
}

-----------------------------------------------------

pawn Code:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    switch(dialogid)
    {
        case 1:
        {
            if (response == 1)
            {
        // Login stuff
            }
            if (response == 0)
            {
                Kick(playerid);
            }
        }
    }
    return 1;
}
freshOrange is offline  
Old 06/08/2011, 01:10 PM   #2
Jeffry
High-roller
 
Jeffry's Avatar
 
Join Date: Oct 2009
Location: Germany
Posts: 1,594
Reputation: 69
Default Re: /login to dialog

pawn Code:
if(response == 1)
{
    LoginPlayer(playerid, inputtext);
}

That?
__________________
Jeffry is offline  
Old 06/08/2011, 01:36 PM   #3
shahartal
Big Clucker
 
Join Date: Jul 2011
Location: sa-mp
Posts: 63
Reputation: 3
Default Re: /login to dialog

pawn Code:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    switch(dialogid)
    {
        case 1:
        {
            if (response == 1)
            {
               LoginPlayer(playerid, inputtext);
            }
            if (response == 0)
            {
                Kick(playerid);
            }
        }
    }
    return 1;
}
shahartal is offline  
 

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[LOGIN] Dialog Box Junior_Vercetti Português/Portuguese 9 20/01/2011 03:03 PM
Can Any One Convert this scripted cmd login to dialog login system cssbart Help Archive 0 07/03/2010 05:57 PM
[HELP] Dialog Login Lilcuete Help Archive 1 17/10/2009 05:53 PM
Login Dialog Kohva Help Archive 4 16/10/2009 08:04 AM
Dialog login . _Ben_[Fux-c.co.il RP] Help Archive 12 11/10/2009 09:27 AM


All times are GMT. The time now is 09:58 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.