ESC allows player to join with no password
#1

Hiya got everything working just fine in my registration the only problem is when people join they can press ESC and log into any account with no password required. How can I make it so that when people press the ESC key it kicks them off?

What code do I need to show you to help me?
Reply
#2

If(!response) Kick(playerid);
Reply
#3

Haha thankyou I knew I was looking for one of those ! bastads :P

+Rep

EDIT: Problem not resolved.. My code is at bottom of page some one please check it for me? I'm so confused I'm going brain dead lol! I know it's so simple too! [edit 12:32 UK time]
Reply
#4

if(!response) return Kick(playerid);

EDIT: too late; had the topic open.
Reply
#5

or you can use
if(!response) return ShowPlayerDialog(...);//here must be your registration dialog

so they won't be able to close the dialog.
Reply
#6

Hi bit confused lol.. Could some one check this is right for me?

if(dialogid == login)
{
if(!response) return Kick(playerid);
if(response)
{
new hashpass[129];
WP_Hash(hashpass,sizeof(hashpass),inputtext);
if(!strcmp(hashpass,pInfo[playerid][Pass]))
{
INI_ParseFile(Path(playerid),"loadaccount_user",.b Extra = true, .extra = playerid);
SetPlayerScore(playerid,pInfo[playerid][Scores]);
GivePlayerMoney(playerid,pInfo[playerid][Money]);
SendClientMessage(playerid,-1,"Welcome back! You have successfully logged in");
}
else
{
ShowPlayerDialog(playerid,login,DIALOG_STYLE_INPUT ,"Login","Welcome back. This account is registered. \nInsert your password to login to your account.\nIncorrect password!","Login","Quit");
return 1;
}
}
}
Reply
#7

Just add a check under OnPlayerRequestSpawn just in case they manage to get around this. Make a variable that detects whether a player is logged in or not.

pawn Код:
new LoggedIn[MAX_PLAYERS];

public OnPlayerConnect(playerid)
{
    LoggedIn[playerid] = 0;
    return 1;
}

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid == login)
    {
        if(!response) return Kick(playerid);
        if(response)
        {
            new hashpass[129];
            WP_Hash(hashpass,sizeof(hashpass),inputtext);
            if(strcmp(hashpass, pInfo[playerid][Pass], false) == 0)
            {
                INI_ParseFile(Path(playerid),"loadaccount_user",.b Extra = true, .extra = playerid);
                SetPlayerScore(playerid,pInfo[playerid][Scores]);
                GivePlayerMoney(playerid,pInfo[playerid][Money]);
                SendClientMessage(playerid,-1,"Welcome back! You have successfully logged in");
                LoggedIn[playerid] = 1; //Player is logged in
            }
            else
            {
                ShowPlayerDialog(playerid,login,DIALOG_STYLE_INPUT ,"Login","Welcome back. This account is registered. \nInsert your password to login to your account.\nIncorrect password!","Login","Quit");
                return 1;
            }
        }
    }
    return 0;
}

public OnPlayerRequestSpawn(playerid)
{
    if(LoggedIn[playerid] == 0) //if they're not logged in
    {
        ShowPlayerDialog(playerid,login,DIALOG_STYLE_INPUT ,"Login","Welcome back. This account is registered. \nInsert your password to login to your account.\nYou must login before spawning!","Login","Quit");
        return 0;
    }
    return 1;
}
Your login part was only a little wrong, you just need to check case sensitivity in people's passwords.
EDIT: Overthinking it, I don't think Whirlpool uses uppercase and lowercase mixtures of letters...
Reply
#8

Brilliant I'm going to try that code see what happens!
Reply
#9

Instead of kicking players you can use this :-
Код:
if(!response) return ShowPlayerDialog(playerid, login,DIALOG_STYLE_LIST,"Login","Please login to continue","OK","");
Reply
#10

Hey I'm getting errors after trying your code man..

C:\Users\Phil\Desktop\LSGW-TDM\LSGW-TDM\pawno\include\sscanf2.inc(101) : warning 219: local variable "name" shadows a variable at a preceding level
C:\Users\Phil\Desktop\LSGW-TDM\LSGW-TDM\pawno\include\sscanf2.inc(21 : warning 219: local variable "string" shadows a variable at a preceding level
C:\Users\Phil\Desktop\LSGW-TDM\LSGW-TDM\pawno\include\sscanf2.inc(21 : warning 219: local variable "string" shadows a variable at a preceding level
C:\Users\Phil\Desktop\LSGW-TDM\LSGW-TDM\pawno\include\sscanf2.inc(27 : warning 219: local variable "string" shadows a variable at a preceding level
C:\Users\Phil\Desktop\LSGW-TDM\LSGW-TDM\pawno\include\sscanf2.inc(27 : warning 219: local variable "string" shadows a variable at a preceding level
C:\Users\Phil\Desktop\LSGW-TDM\LSGW-TDM\pawno\include\YSI\y_utils.inc(326) : warning 219: local variable "string" shadows a variable at a preceding level
C:\Users\Phil\Desktop\LSGW-TDM\LSGW-TDM\pawno\include\YSI\y_utils.inc(470) : warning 219: local variable "string" shadows a variable at a preceding level
C:\Users\Phil\Desktop\LSGW-TDM\LSGW-TDM\pawno\include\YSI\y_utils.inc(502) : warning 219: local variable "string" shadows a variable at a preceding level
C:\Users\Phil\Desktop\LSGW-TDM\LSGW-TDM\pawno\include\YSI\y_utils.inc(520) : warning 219: local variable "string" shadows a variable at a preceding level
C:\Users\Phil\Desktop\LSGW-TDM\LSGW-TDM\pawno\include\YSI\y_ini.inc(852) : warning 219: local variable "name" shadows a variable at a preceding level
C:\Users\Phil\Desktop\LSGW-TDM\LSGW-TDM\pawno\include\YSI\y_ini.inc(972) : warning 219: local variable "name" shadows a variable at a preceding level
C:\Users\Phil\Desktop\LSGW-TDM\LSGW-TDM\pawno\include\YSI\y_ini.inc(1045) : warning 219: local variable "name" shadows a variable at a preceding level
C:\Users\Phil\Desktop\LSGW-TDM\LSGW-TDM\pawno\include\YSI\y_ini.inc(1066) : warning 219: local variable "name" shadows a variable at a preceding level
C:\Users\Phil\Desktop\LSGW-TDM\LSGW-TDM\pawno\include\YSI\y_ini.inc(1085) : warning 219: local variable "name" shadows a variable at a preceding level
C:\Users\Phil\Desktop\LSGW-TDM\LSGW-TDM\pawno\include\YSI\y_ini.inc(1107) : warning 219: local variable "name" shadows a variable at a preceding level
C:\Users\Phil\Desktop\LSGW-TDM\LSGW-TDM\pawno\include\YSI\y_ini.inc(1139) : warning 219: local variable "name" shadows a variable at a preceding level
C:\Users\Phil\Desktop\LSGW-TDM\LSGW-TDM\pawno\include\YSI\y_ini.inc(1175) : warning 219: local variable "name" shadows a variable at a preceding level
C:\Users\Phil\Desktop\LSGW-TDM\LSGW-TDM\pawno\include\YSI\y_ini.inc(1203) : warning 219: local variable "name" shadows a variable at a preceding level
C:\Users\Phil\Desktop\LSGW-TDM\LSGW-TDM\pawno\include\YSI\y_ini.inc(1359) : warning 219: local variable "name" shadows a variable at a preceding level
C:\Users\Phil\Desktop\LSGW-TDM\LSGW-TDM\gamemodes\ATDM.pwn(120) : warning 219: local variable "name" shadows a variable at a preceding level
C:\Users\Phil\Desktop\LSGW-TDM\LSGW-TDM\gamemodes\ATDM.pwn(523) : error 055: start of function body without function header
C:\Users\Phil\Desktop\LSGW-TDM\LSGW-TDM\gamemodes\ATDM.pwn(526) : error 021: symbol already defined: "GetPlayerName"
C:\Users\Phil\Desktop\LSGW-TDM\LSGW-TDM\gamemodes\ATDM.pwn(530) : error 021: symbol already defined: "GetPlayerName"
C:\Users\Phil\Desktop\LSGW-TDM\LSGW-TDM\gamemodes\ATDM.pwn(531) : error 010: invalid function or declaration
C:\Users\Phil\Desktop\LSGW-TDM\LSGW-TDM\gamemodes\ATDM.pwn(533) : error 021: symbol already defined: "INI_ParseFile"
C:\Users\Phil\Desktop\LSGW-TDM\LSGW-TDM\gamemodes\ATDM.pwn(533) : error 017: undefined symbol "playerid"
C:\Users\Phil\Desktop\LSGW-TDM\LSGW-TDM\gamemodes\ATDM.pwn(533) : error 010: invalid function or declaration
C:\Users\Phil\Desktop\LSGW-TDM\LSGW-TDM\gamemodes\ATDM.pwn(533 -- 536) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


8 Errors.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)