pass change - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: pass change (
/showthread.php?tid=247028)
pass change -
fissekarl - 07.04.2011
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;
}
Re: pass change -
[DJ]Boki - 07.04.2011
Код:
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
Re: pass change -
fissekarl - 07.04.2011
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
Re: pass change -
[DJ]Boki - 07.04.2011
As i know,i'm fixed your code
Re: pass change -
fissekarl - 07.04.2011
that could be a fixed code for strcmp, but you didnt even read what I want
you even have gPlayerLogged included
Re: pass change -
fissekarl - 07.04.2011
bump
Re: pass change -
Vince - 07.04.2011
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 ...
Re: pass change -
xir - 07.04.2011
edit: nvm
Re: pass change -
fissekarl - 07.04.2011
When I type the old pass(correct pass) it says incorrect password?