Wrong Password Error +reputation
#1

Hello,

Help Please I Have A Register System But It Says wrong Password Even If My Password Is Correct Is Something Wrong Here
Код:
public OnPlayerConnect(playerid)
{
if(IsPlayerNPC(playerid))
{
Attach3DTextLabelToPlayer(Botinfo, playerid, 0.0, 0.0, 0.0);
SetPlayerMarkerForPlayer( 42, 1, ( GetPlayerColor( 1 ) | 0x00FF00 ) );
}
    if(fexist(UserPath(playerid)))
{
    new string [ 240 ];
    INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);

    new pName[MAX_PLAYER_NAME];
    GetPlayerName(playerid, pName, sizeof(pName));

    format(string, sizeof(string), ""COL_WHITE"{0066FF}3G Cops And Robbers\n\n{0099FF}Player Login\n\n{FFFFFF}This nick,{0099FF}%s{FFFFFF},is Registered.\nIf this is not your account,please quit and change your nick.\n\nPlease {FFFF66}Enter Your Password {FFFFFF}To Login:", pName);
    ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT, ""COL_WHITE"{FFFFFF}CnR {FFFFFF}Login", string, "Login", "Cancel");
}

    else
    {
      new string [ 300 ];
    INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);

    new pName[MAX_PLAYER_NAME];
    GetPlayerName(playerid, pName, sizeof(pName));

    format(string, sizeof(string), ""COL_WHITE"{0066FF}3G Cops And Robbers\n\n{999999}New Registration\n{FFFFFF}Nick:{0099FF}%s\n\n{FFFFFF}Do {FF0000}Not {FFFFFF}Register Multiple Accounts\n{FFFFFF}Do {FF0000}Not {FFFFFF}Use The Game Password That You Use Elsewhere\n\nPlease {FFFF66}Enter Your Password {FFFFFF}For Your Account:", pName);
    ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, ""COL_WHITE"{FFFFFF}CnR {FFFFFF}Registration", string, "Register", "Cancel");
}

        new ConnIP[16];
        GetPlayerIp(playerid,ConnIP,16);
        new compare_IP[16];
        new number_IP = 0;
        for(new i=0; i<MAX_PLAYERS; i++) {
                if(IsPlayerConnected(i)) {
                    GetPlayerIp(i,compare_IP,16);
                    if(!strcmp(compare_IP,ConnIP)) number_IP++;
                }
        }
        if((GetTickCount() - Join_Stamp) < Time_Limit)
            exceed=1;
        else
            exceed=0;
        if(strcmp(ban_s, ConnIP, false) == 0 && exceed == 1 )
        {
            Same_IP++;
            if(Same_IP > SAME_IP_CONNECT)
            {
                        Ban(playerid);
                        Same_IP=0;
            }
        }
        else
        {
                Same_IP=0;
        }
        if(number_IP > IP_LIMIT)
        Ban(playerid);
        GetStampIP(playerid);

    new joinMsg[128], name[MAX_PLAYER_NAME];
	GetPlayerName(playerid, name, sizeof(name));
	format(joinMsg, sizeof(joinMsg), "4[%d] 03*** %s has joined the server.", playerid, name);
	IRC_GroupSay(gGroupID, IRC_CHANNEL, joinMsg);

    TextDrawShowForPlayer(playerid, WantedLvlTxd[playerid]);
    TextDrawShowForPlayer(playerid, DrugTxd[playerid]);
	TextDrawShowForPlayer(playerid, DrugTxd[playerid]);

	LocationTD[playerid] = TextDrawCreate(8.000000, 430.000000, "_");
	TextDrawBackgroundColor(LocationTD[playerid], 255);
	TextDrawFont(LocationTD[playerid], 2);
	TextDrawLetterSize(LocationTD[playerid], 0.400000, 1.000000);
	TextDrawColor(LocationTD[playerid], -1);
	TextDrawSetOutline(LocationTD[playerid], 1);
	TextDrawSetProportional(LocationTD[playerid], 1);
	TextDrawUseBox(LocationTD[playerid], 1);
	TextDrawBoxColor(LocationTD[playerid], 80);
	TextDrawTextSize(LocationTD[playerid], 222.000000, 18.000000);

	XDeaths[playerid] = 0;
    LastDeath[playerid] = 0;
    IsRobbing[playerid] =0;
	IsBankRobbing[playerid] =0;
	IsApRobbing[playerid] =0;
	zoneupdates[playerid] =1;

	DescriptionText[playerid] = TextDrawCreate(320.0, 380.0, " ");
    TextDrawAlignment(DescriptionText[playerid], 2);
    TextDrawFont(DescriptionText[playerid], 1);
    TextDrawLetterSize(DescriptionText[playerid], 0.320000, 1.700000);
    TextDrawSetOutline(DescriptionText[playerid], 1);
    TextDrawHideForPlayer(playerid, DescriptionText[playerid]);

	new string[128], pName[MAX_PLAYER_NAME];
    GetPlayerName(playerid,pName,MAX_PLAYER_NAME);
    new plrIP[16];
    GetPlayerIp(playerid, plrIP, sizeof(plrIP));
    format(string,sizeof string,"%s has joined the server with the ip %s",pName,plrIP);
    JoinsLog(string);

	for( new i = 0; i <= 50; i ++ ) SendClientMessage(playerid,COLOR_WHITE, "" );
	SendClientMessage(playerid, COLOR_WHITE, "{FFFF66}Welcome to {33FF66}3G Cops&Robbers - Please {33FF66}register if you are new or login to retrieve your data!");
	SendClientMessage(playerid, COLOR_WHITE, "Be sure to check {FFFF66}/rules - and {FFFF66}/cmds - Type {FFFF66}/help if you need help about the server -");

	for(new i;i<sizeof(Coords);i++) SetPlayerMapIcon(playerid,i,Coords[i][X],Coords[i][Y],Coords[i][Z],Coords[i][ID],0,MAPICON_LOCAL);
	return 1;
}
Does I Have To Show You Other Code .I Am Using y.ini System To Save Data.Does I have To Update My Whirphool Plugins Pease Help fast

Is Some thing Wrong here in On DIALOG RESPONCE
Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    switch( dialogid )
    {
        case DIALOG_REGISTER:
        {
            if (!response) return Kick(playerid);
            if(response)
            {
                if(!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, "Registering...","{FF0000}You have entered an invalid password.\n""Type your password below to register a new account.","Register","Quit");
				new INI:File = INI_Open(UserPath(playerid));
                INI_SetTag(File,"data");
                INI_WriteInt(File,"Password",udb_hash(inputtext));
                INI_WriteInt(File,"Cash",0);
                INI_WriteInt(File,"Admin",0);
                INI_WriteInt(File,"Kills",0);
                INI_WriteInt(File,"Deaths",0);
                INI_WriteInt(File,"WantedLevel",0);
                INI_WriteInt(File,"Vip",0);
                INI_WriteInt(File,"Score",0);
                INI_WriteInt(File,"Condoms",0);
                INI_WriteInt(File,"Banned",0);
                INI_WriteInt(File,"Jailed",0);
                INI_WriteInt(File,"Drugs",0);
                INI_WriteInt(File,"Nopm",0);
                INI_WriteInt(File,"Bank",0);
                INI_WriteInt(File,"Sausages",0);
                INI_WriteInt(File,"PassChange",0);
                INI_WriteInt(File,"Mute",0);
                INI_Close(File);
                INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
                ShowPlayerDialog(playerid, DIALOG_SUCCESS_1, DIALOG_STYLE_MSGBOX,"{008000}Success!","{FF0000}Registered and autologged! Now all your data are saved. (Money,score,robberies,wanted level etc)","Ok","");
			}
        }

        case DIALOG_LOGIN:
        {
            if (!response) return Kick(playerid);
            if( response )
            {
                if(udb_hash(inputtext) == PlayerInfo[playerid][pPass])
                {
                    INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
                    GivePlayerMoney(playerid, PlayerInfo[playerid][pCash]);
                    SetPlayerWantedLevel(playerid, PlayerInfo[playerid][pWantedLevel]);
                    SetPlayerScore(playerid, PlayerInfo[playerid][pScore]);
                    ShowPlayerDialog(playerid, DIALOG_SUCCESS_2, DIALOG_STYLE_MSGBOX,"{008000}Success!","{FFFF00}You have successfully logged in!","Ok","");
                }
                else
                {
                   ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,"Login","{FF0000}You have entered an incorrect password.\n""Type your password below to login.","Login","Quit");
                }
                return 1;
            }
        }
    }
Reply
#2

FastGuys Help Me
Reply
#3

You need to compare strings using strcmp
Reply
#4

in
pawn Код:
if(udb_hash(inputtext) == PlayerInfo[playerid][pPass])
change to
pawn Код:
if(!strcmp(udb_hash(inputtext), PlayerInfo[playerid][pPass], false)
Reply
#5

Quote:
Originally Posted by barbarbar1
Посмотреть сообщение
in
pawn Код:
if(udb_hash(inputtext) == PlayerInfo[playerid][pPass])
change to
pawn Код:
if(!strcmp(udb_hash(inputtext), PlayerInfo[playerid][pPass], false)
Thanks But Getting 1 Error
Код:
error 035: argument type mismatch (argument 1)
Reply
#6

Quote:
Originally Posted by ******
Посмотреть сообщение
Don't use udb_hash - it's Adler32 and not secure at all!
Use Whirlpool + strcmp.
https://sampforum.blast.hk/showthread.php?tid=570945
Reply
#7

Quote:
Originally Posted by CarRamper
Посмотреть сообщение
Thanks But Getting 1 Error
Код:
error 035: argument type mismatch (argument 1)
fix:

if(!strcmp(udb_hash(inputtext), PlayerInfo[playerid][pPass], false))
Reply
#8

Quote:

fix:

if(!strcmp(udb_hash(inputtext), PlayerInfo[playerid][pPass], false))

Since Giving The Same Error
Reply
#9

You are saving Password as integer on register, and when you compare you use strings comparation, change the line
PHP код:
//OnDialogResponse: REGISTER
INI_WriteInt(File,"Password",udb_hash(inputtext)); 
To
PHP код:
//OnDialogResponse: REGISTER
INI_WriteString(File,"Password",udb_hash(inputtext)); 
Reply
#10

Giving Error
Quote:

C:\Users\Anurag\Desktop\3G CNR\gamemodes\3GCNR.pwn(5862) : error 035: argument type mismatch (argument 3)
C:\Users\Anurag\Desktop\3G CNR\gamemodes\3GCNR.pwn(5890) : error 035: argument type mismatch (argument 1)
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


2 Errors.

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)