01.01.2010, 14:47
Hey everyone, I seem to be having a problem, and was wondering if you could possibly help me out.
My problem is this, I am using SeifAdmin, it uses MD5_Hash, but I would like to change this from MD5 to WP, but heres my problem.
When I change the MD5_Hash to WP_Hash like this:
it gives me a tag mismatch on the second arguement.
and also here:
(OnPlayerRegister)
(OnPlayerLogin)
also, password is called from an enum
I have a feeling that it has something to do with this, so if you guys can assist me in this, it would be appreciated.
P.s. Don't tell me to post this in the topic, unless you want me to bump a topic that is about 5 pages behind.
My problem is this, I am using SeifAdmin, it uses MD5_Hash, but I would like to change this from MD5 to WP, but heres my problem.
When I change the MD5_Hash to WP_Hash like this:
pawn Код:
OnPlayerRegister(playerid, WP_Hash(tmppass, sizeof(tmppass), params));
pawn Код:
C:\Documents and Settings\Administrator\Desktop\SAMPSERVER\gamemodes\admTstSvr.pwn(469) : error 035: argument type mismatch (argument 2)
pawn Код:
C:\Documents and Settings\Administrator\Desktop\SAMPSERVER\gamemodes\admTstSvr.pwn(495) : error 035: argument type mismatch (argument 2)
pawn Код:
dcmd_login(playerid, params[])
{
new
tmppass[128],
plname[24],
string[128];
if(AccountInfo[playerid][Logged] == 1) return SendClientMessage(playerid, RED, "You are already logged in.");
if(!sscanf(params, "i", tmppass))
{
SendClientMessage(playerid, ORANGE, "Error! Use /login password!");
}
else
{
GetPlayerName(playerid, plname, sizeof(plname));
format(string, sizeof(string), "/Accounts/%s.playerAccount", plname);
if(!fexist(string)) return SendClientMessage(playerid, RED, "That account isn't registered! Please register: /register [password]");
strmid(tmppass, params, 0, strlen(params), 255);
OnPlayerLogin(playerid, WP_Hash(tmppass, sizeof(tmppass), params)); //line 495
return true;
}
return true;
}
pawn Код:
dcmd_register(playerid, params[])
{
{
new
sendername[24],
string[64];
if(IsPlayerConnected(playerid))
{
if(AccountInfo[playerid][Logged] == 1)
{
SendClientMessage(playerid, RED, "You are already logged in.");
return 1;
}
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, 64, "/Accounts/%s.playeraccount", sendername);
new File: hFile = fopen(string, io_read);
if (hFile)
{
SendClientMessage(playerid, RED, "That name is already taken. Please reconnect using a different username.");
fclose(hFile);
return 1;
}
new tmppass[128];
if(!sscanf(params, "i", tmppass))
{
SendClientMessage(playerid, ORANGE, "Error! Use /register password");
}
else
{
strmid(tmppass, params, 0, strlen(params), 255);
OnPlayerRegister(playerid, WP_Hash(tmppass, sizeof(tmppass), params)); //line 469
}
return true;
}
return true;
}
}
pawn Код:
forward OnPlayerRegister(playerid, password[]);
public OnPlayerRegister(playerid, password[])
{
if(IsPlayerConnected(playerid))
{
new name[24], str[128], ip[15];
GetPlayerName(playerid, name, sizeof name);
GetPlayerIp(playerid, ip, sizeof ip);
format(str, sizeof str, "/Accounts/%s.playerAccount", name);
new File:account = fopen(str, io_write);
if (account)
{
strmid(AccountInfo[playerid][Password], password, 0, strlen(password), 255);
AccountInfo[playerid][Cash] = GetPlayerMoney(playerid);
new file[128];
{
format(file, sizeof file, "Password: %s\n\r", AccountInfo[playerid][Password]);
{ fwrite(account, file); }
format(file, sizeof file, "AdminLevel: %d\n\r", 0);
{ fwrite(account, file); AccountInfo[playerid][AdminLevel] = 0; }
format(file, sizeof file, "Cash: %d\n\r", AccountInfo[playerid][Cash]);
{ fwrite(account, file); }
format(file, sizeof file, "IPAddress: %s\n\r",ip);
{ fwrite(account, file); }
}
fclose(account);
SendClientMessage(playerid, GREEN, "|- Account successfully registered. You can now login ( /login [password] ) -|");
}
}
return 1;
}
pawn Код:
forward OnPlayerLogin(playerid, password[]);
public OnPlayerLogin(playerid, password[])
{
new name[24], str[128];
GetPlayerName(playerid, name, sizeof name);
format(str, sizeof str, "/Accounts/%s.playeraccount", name);
new File:account = fopen(str, io_read);
if (account)
{
new pass[256];
new passres[128], value[128];
fread(account, pass, sizeof pass);
passres = GetFileString(pass);
if (!strcmp("Password", passres))
{
value = GetFileValue(pass);
strmid(AccountInfo[playerid][Password], value, 0, strlen(value)-1, 128);
}
if (!strcmp(AccountInfo[playerid][Password], password, true))
{
while (fread(account, pass, 256))
{
passres = GetFileString(pass);
if (strfind(passres, "AdminLevel") != -1)
{
value = GetFileValue(pass);
AccountInfo[playerid][AdminLevel] = strval(value);
}
if (strfind(passres, "Cash") != -1)
{
value = GetFileValue(pass);
AccountInfo[playerid][Cash] = strval(value);
}
}
fclose(account);
AccountInfo[playerid][Logged] = 1;
}
else
{
SendClientMessage(playerid, RED, "Incorrect Password.");
fclose(account);
return 1;
}
GivePlayerMoney(playerid, AccountInfo[playerid][Cash]);
format(str, sizeof str, "|- You have successfully logged in as %s -|", name);
SendClientMessage(playerid, GREEN, str);
printf("%s has logged in", name);
if (AccountInfo[playerid][AdminLevel] > 0)
{
format(str, sizeof str, "|» You are now logged in as a level %d admin «|", AccountInfo[playerid][AdminLevel]);
SendClientMessage(playerid, LIGHTGREEN, str);
}
}
return 1;
}
pawn Код:
enum Info
{
AdminLevel,
Password[128],
Cash,
Logged,
Mute,
IP[20],
};
P.s. Don't tell me to post this in the topic, unless you want me to bump a topic that is about 5 pages behind.