registration -
BLAbla93 - 27.11.2009
Код:
D:...\samp\filterscripts\DAdmin.pwn(261) : error 003: declaration of a local variable must appear in a compound block
D:...\samp\filterscripts\DAdmin.pwn(261) : error 017: undefined symbol "tmp"
D:...\samp\filterscripts\DAdmin.pwn(261) : warning 215: expression has no effect
D:...\samp\filterscripts\DAdmin.pwn(261) : error 001: expected token: ";", but found "]"
D:...\samp\filterscripts\DAdmin.pwn(261) : fatal error 107: too many error messages on one line
Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
4 Errors.
Код:
if(dialogid ==2)
{
TogglePlayerControllable(playerid, 0);
new file[256];
new string[256], pname[MAX_PLAYER_NAME];
GetPlayerName(playerid, pname, sizeof(pname));
format(file, sizeof(file), "\\Users\\%s.ini", pname);
if(response == 1)
new tmp[256]; //---------------------------------------------line 261
tmp = dini_IntGet(file, "hashPW");
if(udb_hash(inputtext) != tmp)
{
format(string, 256, "You specified the wrong password for %s!", pname);
SendClientMessage(playerid, 000000, string);
ShowPlayerDialog(playerid, 2, 1,"Wrong Password", "That Password is incorrect. Please try again.","login", "cancel");
}
else
{
logged[playerid] = 1;
level[playerid] = dini_Int(file, "level");
SetPlayerScore(playerid, dini_Int(file, "score"));
GivePlayerMoney(playerid, dini_Int(file, "money")-GetPlayerMoney(playerid));
SendClientMessage(playerid, 0000000, "You have succesfully logged in!");
printf("%s (%i) logged in with password %s", pname, playerid, inputtext);
}
if(response == 0)
{
SendClientMessage(playerid, 0xFFFF0000, "You must log in or register to use this server");
}
return 1;
}
return 1;
}
help is apreciated
Re: Help With Registration system in dialog responce. -
BLAbla93 - 28.11.2009
well now im down to this
i defined new HPW; at the top of the script and now i get this
Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == 1)
{
TogglePlayerControllable(playerid, 0);
new file[128], pname[MAX_PLAYER_NAME];
GetPlayerName(playerid, pname, sizeof(pname));
format(file, sizeof(file), "\\Users\\%s.ini", pname);
if(response == 1)
{
dini_Create(file);
dini_IntSet(file, "hashPW", udb_hash(inputtext));
dini_Set(file, "password", inputtext);
dini_IntSet(file, "level", 0);
dini_IntSet(file, "score", GetPlayerScore(playerid));
dini_IntSet(file, "money", GetPlayerMoney(playerid));
new string[128];
format(string, 128, "You succesfully registered the nickname %s with password %s", pname, inputtext);
SendClientMessage(playerid, 000000, string);
logged[playerid] = 1;
SendClientMessage(playerid, 0000000, "You have been automatically logged in!");
TogglePlayerControllable(playerid, 1);
}
if(response == 0)
{
SendClientMessage(playerid, 0xFFFF0000, "You must log in or register to use this server");
}
return 1;
}
if(dialogid ==2)
{
TogglePlayerControllable(playerid, 0);
new file[256];
new string[256], pname[MAX_PLAYER_NAME];
GetPlayerName(playerid, pname, sizeof(pname));
format(file, sizeof(file), "\\Users\\%s.ini", pname);
if(response == 1)
HPW = dini_Get(file, "hashPW"); //<---------------------------------------------- is line 275
if(udb_hash(inputtext) != HPW)
{
format(string, 256, "You specified the wrong password for %s!", pname);
SendClientMessage(playerid, 000000, string);
ShowPlayerDialog(playerid, 2, 1,"Wrong Password", "That Password is incorrect. Please try again.","login", "cancel");
}
else
{
logged[playerid] = 1;
level[playerid] = dini_Int(file, "level");
SetPlayerScore(playerid, dini_Int(file, "score"));
GivePlayerMoney(playerid, dini_Int(file, "money")-GetPlayerMoney(playerid));
SendClientMessage(playerid, 0000000, "You have succesfully logged in!");
printf("%s (%i) logged in with password %s", pname, playerid, inputtext);
}
if(response == 0)
{
SendClientMessage(playerid, 0xFFFF0000, "You must log in or register to use this server");
}
return 1;
}
return 1;
}
with error
Код:
D:\...\samp\filterscripts\DAdmin.pwn(275) : error 006: must be assigned to an array
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
1 Error.
please help, im begging you D:<
any help is very helpfull
Re: registration -
Devine - 28.11.2009
Which line is 275?
Re: registration -
DracoBlue - 28.11.2009
pawn Код:
HPW = dini_Get(file, "hashPW");
should be:
pawn Код:
HPW = dini_Int(file, "hashPW");
because it's a number and not a string.
If you want to read a string with dini one day, you may use that:
pawn Код:
new this_is_my_string[MAX_STRING];
this_is_my_string = dini_Get(file, "my_string_source");
or (if you are unsure about the size of the string), you should use:
pawn Код:
format(this_is_my_string, sizeof(this_is_my_string), "%s", dini_Get(file, "my_string_source"));
as this will put the entire string (in a safe manner) into the variable.
Have fun coding,
Draco
Re: registration -
BLAbla93 - 28.11.2009
wow that makes alot of sence
thanks,
i was looking into using strings, that clears alot up.
thanks draco