pass change
#1

hello, I have a problem with this code

it is not working

pawn Код:
COMMAND:changepass(playerid, params[])
{
    new file[128], pName[MAX_PLAYER_NAME];
    format(file, sizeof(file), SERVER_USER_FILE, pName);
    if(sscanf(params, "ss", params, params)) return SendClientMessage(playerid, Yellow, "Usage: /changepass <old password> <new password>");
    if(udb_hash(params) != dini_Int(file, "Password")) return SendClientMessage(playerid,Red,"Incorrect password !");
    else
    {
        GetPlayerName(playerid,pName,sizeof(pName));
        dini_IntSet(file, "Password", udb_hash(params));
        SendClientMessage(playerid,Green,"You succesfully changed your password !");
    }
    return 1;
}
Also this, it doesnt work

pawn Код:
COMMAND:getid(playerid, params[]) // credit to Lethal
{
    if(sscanf(params, "s[128]", params[2])) return SendClientMessage(playerid, Yellow, "Usage: /getid <name>");
    new found, string[128], playername[MAX_PLAYER_NAME];
    format(string,sizeof(string),"Searched for: \"%s\" ",params);
    SendClientMessage(playerid,blue,string);
    for(new i=0; i <= MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i))
        {
            GetPlayerName(i, playername, MAX_PLAYER_NAME);
            new namelen = strlen(playername);
            new bool:searched=false;
            for(new pos=0; pos <= namelen; pos++)
            {
                if(searched != true)
                {
                    if(strfind(playername,params,true) == pos)
                    {
                        found++;
                        format(string,sizeof(string),"%s (ID %d)",playername,i);
                        SendClientMessage(playerid, green ,string);
                        searched = true;
                    }
                }
            }
        }
    }
    if(found == 0) SendClientMessage(playerid, lightblue, "No players have this in their nick");
    return 1;
}
Reply
#2

Код:
if(strcmp(cmd, "/changepass", true) == 0)
	{
		if(IsPlayerConnected(playerid))
		{
		    if(gPlayerLogged[playerid] == 0)
		    {
		        SendClientMessage(playerid, COLOR_GREY, "   You need to login first.");
		        return 1;
		    }
		    else
		    {
		    	SendClientMessage(playerid, COLOR_GREY, " ");
			}
			tmp = strtok(cmdtext, idx);
			if(!strlen(tmp))
			{
				SendClientMessage(playerid, COLOR_GRAD1, "USAGE: /changepass [password]");
				return 1;
			}
			strmid(PlayerInfo[playerid][pKey], tmp, 0, strlen(cmdtext), 255);
			OnPlayerUpdate(playerid);
			SendClientMessage(playerid, COLOR_YELLOW, "   Password has been changed successfuly");
		}
		return 1;
	}
Try that
Reply
#3

First, I use zcmd & sscanf
Second, I want old password, then new password

you probably didnt even read, just the topic title and then you copied from your script.

anyway thanks
Reply
#4

As i know,i'm fixed your code
Reply
#5

that could be a fixed code for strcmp, but you didnt even read what I want

you even have gPlayerLogged included
Reply
#6

bump
Reply
#7

pawn Код:
if(sscanf(params, "ss", params, params))
Uh?

pawn Код:
new
    oldpass[32],
    newpass[32];

if(sscanf(params, "s[32]s[32]", oldpass, newpass))
    return ...

if(udb_hash(oldpass) != dini_Int(file, "Password"))
    return ...
Reply
#8

edit: nvm
Reply
#9

When I type the old pass(correct pass) it says incorrect password?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)