15.12.2013, 21:01
Well this was pretty much written as a comment in a threat, but it doesn't seem like people scroll all the way down and read it.
I am working on a login/register system, using y_ini and whirlpool.
My current code is like this:
On top of the script:
OnPlayerConnect:
OnDialogResponse - when the login dialog responds:
When I compile, I get this error:
Line 32 is this line:
To me, those errors makes no sense. Hope someone can help me. Thanks
I am working on a login/register system, using y_ini and whirlpool.
My current code is like this:
On top of the script:
pawn Код:
forward LoadUser_data(playerid,name[],value[]);
public LoadUser_data(playerid,name[],value[])
{
INI_String("Password", PlayerInfo[playerid][pPassword], 129);
return 1;
}
stock UserPath(playerid)
{
new string[128],playername[MAX_PLAYER_NAME];
GetPlayerName(playerid,playername,sizeof(playername));
format(string,sizeof(string),"Accounts/%s.ini",playername);
return string;
}
pawn Код:
public OnPlayerConnect(playerid)
{
new name[MAX_PLAYER_NAME];
if(!fexist(UserPath(playerid)))
{
new string[367 + MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
format(string, sizeof(string), "-MSG- The username '%s' is not registered. Please enter a Password to Register",name);
SendClientMessage(playerid, COLOR_YELLOW, string);
format(string, sizeof(string), "{FFFF00}Requested username: {FFFFFF}%s\nThis username is: {009900}Available\n\n{AF0000}We suggest that you don't register\nwith an RP name (Firstname_Lastname)\nbecause you can manage multiple\ncharacters from one account.\nThe name you register now will not\nbe your in-game name.\n\n{FFFFFF}By registering,\nyou agree to our terms of use.\n\n{FFFF00}Enter a Password to register",name);
ShowPlayerDialog(playerid, MENU_REGISTER, DIALOG_STYLE_PASSWORD, "Hopes Hills RP Account", string, "Register", "Quit");
}
else
{
INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
new string[80 + MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
format(string, sizeof(string), "-MSG- The username '%s' is already registered. Please log in with your Password",name);
SendClientMessage(playerid, COLOR_YELLOW, string);
SendClientMessage(playerid, COLOR_GREY, "-MSG- Not your account? Then relog with another name");
format(string, sizeof(string), "{FFFF00}Your username: {FFFFFF}%s\n\nEnter your Password to log in",name);
ShowPlayerDialog(playerid, MENU_LOGIN, DIALOG_STYLE_PASSWORD, "Hopes Hills RP Account", string, "Login", "Quit");
}
return 1;
}
pawn Код:
case MENU_LOGIN:
{
if (!response)
{
SendClientMessage(playerid, COLOR_DARKRED, "-MSG- You must log in in order to play on this server");
Kick(playerid);
}
else
{
new buf[129];
WP_Hash(buf, sizeof(buf), inputtext);
if(!strcmp(buf, PlayerInfoInfo[playerid][pPassword], false))
{
new string[80 + MAX_PLAYER_NAME], name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
format(string, sizeof(string), "{FFFF00}Your username: {FFFFFF}%s\n\n{AF0000}Incorrect password!\n\n{FFFF00}Enter your Password to log in",name);
ShowPlayerDialog(playerid, MENU_LOGIN, DIALOG_STYLE_PASSWORD, "Hopes Hills RP Account", string, "Login", "Quit");
}
else
{
SendClientMessage(playerid, COLOR_GREEN, "-MSG- Welcome back!");
}
}
}
Quote:
C:\Users\Simon\Desktop\Ny mappe (3)\gamemodes\RP.pwn(6) : warning 201: redefinition of constant/macro (symbol "MAX_INI_ENTRY_TEXT") C:\Users\Simon\Desktop\Ny mappe (3)\gamemodes\RP.pwn(32) : error 001: expected token: ")", but found "[" C:\Users\Simon\Desktop\Ny mappe (3)\gamemodes\RP.pwn(32) : warning 215: expression has no effect C:\Users\Simon\Desktop\Ny mappe (3)\gamemodes\RP.pwn(32) : error 001: expected token: ";", but found "]" C:\Users\Simon\Desktop\Ny mappe (3)\gamemodes\RP.pwn(32) : error 029: invalid expression, assumed zero C:\Users\Simon\Desktop\Ny mappe (3)\gamemodes\RP.pwn(32) : fatal error 107: too many error messages on one line Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase 4 Errors. |
pawn Код:
INI_String("Password", PlayerInfo[playerid][pPassword], 129);