SA-MP Forums Archive
/setpass Doesn't Work - 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)
+--- Thread: /setpass Doesn't Work (/showthread.php?tid=513623)



/setpass Doesn't Work - Youssef214 - 17.05.2014

This Command Is From LuxAdmin,When I Use /setpass [accountname] [newpassword] When I Set Someone's Pass,The Pass Doesn't Change.

Codes:
pawn Код:
dcmd_setpass(playerid,params[])
{
    if(AccInfo[playerid][Level] >= 10)
    {
        new string[128], tmp[256], tmp2[256], Index;

        tmp = strtok(params,Index);
        tmp2 = strtok(params,Index);

        if(!strlen(tmp) || !strlen(tmp2)) return
        SendClientMessage(playerid, LIGHTBLUE2, "Usage: /setpass [playername] [new password]") &&
        SendClientMessage(playerid, orange, "Function: Will modify account password of specified player");

        if(strlen(tmp2) < 4 || strlen(tmp2) > MAX_PLAYER_NAME)
        return SendClientMessage(playerid,red,"ERROR: Incorrect password length");
        if(udb_Exists(tmp))
        {
            new file[128], Pass[256];
            format(file,sizeof(file),"/LuxAdmin/Accounts/%s.sav",udb_encode(PlayerName2(playerid)));
            new buf[145];
            WP_Hash(buf, sizeof(buf), tmp2);
            Pass = dini_Get(file, "Password");
            dini_Set(file, "Password", buf);
            PlayerPlaySound(playerid,1057,0.0,0.0,0.0);
            format(string, sizeof(string),"|- You have successfully set \"%s's\" account password to \"%s\" -|", tmp, tmp2);
            return SendClientMessage(playerid,yellow,string);
        } else return SendClientMessage(playerid,red, "ERROR: This player doesnt have an account");
    }
    else return SendClientMessage(playerid,red,"ERROR: You Are Not One Of The Owners!");
}



Re: /setpass Doesn't Work - Norey - 17.05.2014

Quote:

dcmd_setpass(playerid,params[])
{
if(AccInfo[playerid][Level] >= 10)
{
new string[128], tmp[256], tmp2[256], Index;

tmp = strtok(params,Index);
tmp2 = strtok(params,Index);

if(!strlen(tmp) || !strlen(tmp2)) return
SendClientMessage(playerid, LIGHTBLUE2, "Usage: /setpass [playername] [new password]") &&
SendClientMessage(playerid, orange, "Function: Will modify account password of specified player");

if(strlen(tmp2) < 5 || strlen(tmp2) > MAX_PLAYER_NAME)
return SendClientMessage(playerid,red,"ERROR: Incorrect password length");
if(udb_Exists(tmp))
{
new file[128], Pass[256];
format(file,sizeof(file),"/LuxAdmin/Accounts/%s.sav",udb_encode(PlayerName2(playerid)));
new buf[154];
WP_Hash(buf, sizeof(buf), tmp2);
Pass = dini_Get(file, "Password");
dini_Set(file, "Password", buf);
PlayerPlaySound(playerid,1057,0.0,0.0,0.0);
format(string, sizeof(string),"|- You have successfully set \"%s's\" account password to \"%s\" -|", tmp, tmp
return SendClientMessage(playerid,yellow,string);
} else return SendClientMessage(playerid,red, "ERROR: This player doesnt have an account");
}
else return SendClientMessage(playerid,red,"ERROR: You Are Not One Of The Owners!");
}

Try and tell me, Or maybe on your gamemode..


Re: /setpass Doesn't Work - Youssef214 - 17.05.2014

use [pawn] code please,i cannot copy