PDA

View Full Version : Help!


Mouiz
07/07/2015, 08:13 PM
if(dialogid == DIALOG_REGISTER)
{
if (!response) return PlayerInfo[playerid][pLogged] = 0;
if(response)
{
if(!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, ""COL_WHITE"Registering",""COL_RED"You have entered an invalid password.\n"COL_WHITE"Type your password below to register a new account.","Register","Quit");
new INI:File = INI_Open(UserPath(playerid));
INI_SetTag(File,"data");
INI_WriteInt(File,"Password",udb_hash(inputtext));
INI_WriteInt(File,"Cash",0);
INI_WriteInt(File,"Admin",0);
INI_WriteInt(File,"Vip",0);
INI_WriteInt(File,"Score",0);
INI_WriteInt(File,"Skin",0);
INI_WriteInt(File,"Banned",0);
INI_WriteInt(File,"IP", 0);
INI_WriteInt(File,"Kills",0);
INI_WriteInt(File,"Deaths",0);
INI_WriteInt(File,"Weather",0);
INI_WriteInt(File,"Time",0);
INI_WriteInt(File,"SaveSkin",0);
INI_WriteInt(File,"UseSkin",0);
INI_WriteInt(File,"MFEP",0);
INI_WriteInt(File,"Muted",0);
INI_WriteInt(File,"Pms",0);
INI_WriteInt(File,"Gos",0);
INI_WriteInt(File,"God",0);
INI_WriteInt(File,"Deathmatch Score",0);
INI_WriteInt(File,"Jail",0);
INI_WriteInt(File,"MuteTime",0);
INI_WriteInt(File,"cage",0);
INI_WriteInt(File,"Freeze",0);
INI_WriteInt(File,"Banned",0);
INI_WriteInt(File,"Invisible",0);
INI_Close(File);

PlayerInfo[playerid][pLogged] = 1;
SetSpawnInfo(playerid, 0, 0, -1680.1483,706.0532,30.6016,90.9011, 0, 0, 0, 0, 0, 0);
ForceClassSelection(playerid);
}
}

There is the register dialog for my script and i want to save the passwords but it saves wrong password:


Input:kkkkkkok
Output: 253494109

how to fix this?

Sime30
07/07/2015, 08:17 PM
You are encrypting the password with udb_hash. You can have a plain password, but not recommended.

DTV
07/07/2015, 09:45 PM
INI_WriteInt(File,"Password",udb_hash(inputtext));

Unless you want passwords to only be numbers, this will only store the password in number form.

For it to store normal strings, use INI_WriteString(File,"Password",udb_hash(inputtext));


Also, IPs aren't going to save either if it's saved as an integer, it's considered a string.

So change INI_WriteInt(File,"IP", 0); to INI_WriteString(File,"IP", 0);

Mouiz
08/07/2015, 10:30 AM
It gives an error
error 035: argument type mismatch (argument 3)

This is the load user data:
public LoadUser_data(playerid,name[],value[])
{
INI_Int("Password",PlayerInfo[playerid][pPass]);
INI_Int("Cash",PlayerInfo[playerid][pCash]);
INI_Int("Admin",PlayerInfo[playerid][pAdmin]);
INI_Int("Vip",PlayerInfo[playerid][pVip]);
INI_Int("Score",PlayerInfo[playerid][pScore]);
INI_Int("Skin",PlayerInfo[playerid][pSkin]);
INI_Int("Kills",PlayerInfo[playerid][pKills]);
INI_Int("Deaths",PlayerInfo[playerid][pDeaths]);
INI_Int("SaveSkin", PlayerInfo[playerid][pSaveSkin]);
INI_Int("UseSkin", PlayerInfo[playerid][pUseSkin]);
INI_Int("Coins", PlayerInfo[playerid][pCoins]);
INI_Int("Muted",PlayerInfo[playerid][pMuted]);
INI_Int("PM",PlayerInfo[playerid][Pms]);
INI_Int("Gos",PlayerInfo[playerid][Gos]);
INI_Int("God",God[playerid]);
INI_Int("Deathmatch Score",PlayerInfo[playerid][pDeathmatchScore]);
INI_Int("Jail",PlayerInfo[playerid][Jail]);
INI_Int("Cage",PlayerInfo[playerid][cage]);
INI_Int("Freeze",PlayerInfo[playerid][Freeze]);
INI_Int("Banned", PlayerInfo[playerid][Banned]);
INI_Int("Invisible", PlayerInfo[playerid][Invisible]);
INI_Int("Helper", PlayerInfo[playerid][Helper]);
INI_Int("Warn", PlayerInfo[playerid][Warn]);
return 1;
}

Stanford
08/07/2015, 11:38 AM
INI_WriteString(file, "Password", "lamda123");

You need to define the variable as a string inside your enum: IP[16],

for saving use like the example given, if you do not know the input format a string. about loading - treat it like you're loading a string!

like: INI_String("Password", variabletoputin, sizeofstring);

I hope I helped any feedback is appreciated