if(dialogid == 1) {
new file[128], name[MAX_PLAYER_NAME], str[128];
GetPlayerName(playerid, name, MAX_PLAYER_NAME);
format(file, sizeof(file), "LATDM/users/%s.ini", name);
if(response) {
if(strlen(inputtext)) {
dini_Create(file);
dini_IntSet(file, "pw", num_hash(inputtext));
dini_IntSet(file, "AdminLevel", PlayerInfo[playerid][AdminLevel]);
dini_IntSet(file, "VipLevel", PlayerInfo[playerid][VipLevel]);
dini_IntSet(file, "cash", PlayerInfo[playerid][cash]);
dini_IntSet(file, "score", PlayerInfo[playerid][score]);
format(str, sizeof(str), "You are registered as ~r~ %s. Your password is ~r~ %s. /changepass to change it", name, inputtext);
SendClientMessage(playerid, -1, str);
PlayerInfo[playerid][score] = dini_Int(file, "score");
PlayerInfo[playerid][cash] = dini_Int(file, "cash");
PlayerInfo[playerid][AdminLevel] = dini_Int(file, "AdminLevel");
PlayerInfo[playerid][VipLevel] = dini_Int(file, "VipLevel");
}
}
else {
Kick(playerid);
}
}
pw=0 AdminLevel=0 VipLevel=0 cash=0 score=0

dini_Set(file, "pw", num_hash(inputtext));
dini_IntSet(file, "pw", num_hash(inputtext));
if(dialogid == 1)
{
new file[128], name[MAX_PLAYER_NAME], str[128];
GetPlayerName(playerid, name, MAX_PLAYER_NAME);
format(file, sizeof(file), "LATDM/users/%s.ini", name);
if(response)
{
if(!strlen(inputtext)) return Kick(playerid); //Change it!! return anything you want over here!
dini_Create(file);
dini_IntSet(file, "pw", udb_hash(inputtext));
dini_IntSet(file, "AdminLevel", PlayerInfo[playerid][AdminLevel]);
dini_IntSet(file, "VipLevel", PlayerInfo[playerid][VipLevel]);
dini_IntSet(file, "cash", PlayerInfo[playerid][cash]);
dini_IntSet(file, "score", PlayerInfo[playerid][score]);
format(str, sizeof(str), "You are registered as ~r~ %s. Your password is ~r~ %s. /changepass to change it", name, inputtext);
SendClientMessage(playerid, -1, str);
PlayerInfo[playerid][score] = dini_Int(file, "score");
PlayerInfo[playerid][cash] = dini_Int(file, "cash");
PlayerInfo[playerid][AdminLevel] = dini_Int(file, "AdminLevel");
PlayerInfo[playerid][VipLevel] = dini_Int(file, "VipLevel");
}
else
{
Kick(playerid);
}
}
// Add this anywhere in the GM But not in a function!
/*Credits to Dracoblue*/
stock udb_hash(buf[])
{
new length=strlen(buf);
new s1 = 1;
new s2 = 0;
new n;
for (n=0; n<length; n++)
{
s1 = (s1 + buf[n]) % 65521;
s2 = (s2 + s1) % 65521;
}
return (s2 << 16) + s1;
}
C:\DOCUME~1\ADMINI~1\Bureau\ALAE\LATDM\GAMEMO~1\LATDM.pwn(559) : error 035: argument type mismatch (argument 3)
|
pawn Код:
|
only the password doesn't save i see in my ini file pw=0 (must be '123456' )|
there are no errors
only the password doesn't save i see in my ini file pw=0 (must be '123456' )must i edite "num" to "udb"? |
public OnPlayerDisconnect(playerid, reason)
{
new file[128], name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, MAX_PLAYER_NAME);
format(file, sizeof(file), "LATDM/users/%s.ini", name);
if(dini_Exists(file)) {
dini_IntSet(file, "pw", PlayerInfo[playerid][pw]);
dini_IntSet(file, "AdminLevel", PlayerInfo[playerid][AdminLevel]);
dini_IntSet(file, "VipLevel", PlayerInfo[playerid][VipLevel]);
dini_IntSet(file, "cash", PlayerInfo[playerid][cash]);
dini_IntSet(file, "score", PlayerInfo[playerid][score]);
}
return 1;
}