A little help with my registration system.
#1

Hello, I decided to make a game mode with other scripters together, in an attempt to create a community. Well, I have a slight problem. I know it compiles and all, but I'm %40 sure it won't work in-game, here is my code, and the Warnings I receive.

Warning:
Код:
\
C:\National Gaming Roleplay CS\gamemodes\Roleplay.pwn(102) : warning 202: number of arguments does not match definition
C:\National Gaming Roleplay CS\gamemodes\Roleplay.pwn(102) : warning 202: number of arguments does not match definition
C:\National Gaming Roleplay CS\gamemodes\Roleplay.pwn(134) : warning 225: unreachable code
C:\National Gaming Roleplay CS\gamemodes\Roleplay.pwn(135) : warning 202: number of arguments does not match definition
C:\National Gaming Roleplay CS\gamemodes\Roleplay.pwn(135) : warning 202: number of arguments does not match definition
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


5 Warnings.
It only happens when adding this code:
pawn Код:
new name[MAX_PLAYER_NAME]; //Making a new variable called 'name'. name[MAX_PLAYER_NAME] is created so we can use it to get player's name.
    GetPlayerName(playerid,name,sizeof(name)); //Get player's name
    if(fexist(Path(playerid))) /* Check if the connected user is registered or not. fexist stands for file exist. So if file exist in the files(Path(playerid)),*/
    {// then
        INI_ParseFile(Path(playerid),"loadaccount_%s", .bExtra = true, .extra = playerid); //Will load user's data using INI_Parsefile.
        ShowPlayerDialog(playerid,dlogin,DIALOG_STYLE_INPUT,"Login","Welcome back. This account is registered. \nInsert your password to login to your account","Login","Quit");/*A dialog with input style will appear so you can insert your password to login.*/
    }
    else //If the connected user is not registered,
    {//then we will 'force' him to register :)
        ShowPlayerDialog(playerid,dregister,DIALOG_STYLE_INPUT,"Register","Welcome! This account is not registered.\nEnter your own password to create a new account.","Register","Quit");
        return 1;
    }
    return 1;
To this:
pawn Код:
public OnPlayerConnect(playerid) {
    if(! RoleplayNameCheck(GetPlayerName(playerid))) { // Le name checker
        SendClientMessage(playerid, -1, ""Red"Your name is not in Firstname_Lastname format! "White"Please correct it."); // The message sent.
        Kick(playerid); // Kicks the invalid player.
    }
    return true;
    new name[MAX_PLAYER_NAME]; //Making a new variable called 'name'. name[MAX_PLAYER_NAME] is created so we can use it to get player's name.
    GetPlayerName(playerid,name,sizeof(name)); //Get player's name
    if(fexist(Path(playerid))) /* Check if the connected user is registered or not. fexist stands for file exist. So if file exist in the files(Path(playerid)),*/
    {// then
        INI_ParseFile(Path(playerid),"loadaccount_%s", .bExtra = true, .extra = playerid); //Will load user's data using INI_Parsefile.
        ShowPlayerDialog(playerid,dlogin,DIALOG_STYLE_INPUT,"Login","Welcome back. This account is registered. \nInsert your password to login to your account","Login","Quit");/*A dialog with input style will appear so you can insert your password to login.*/
    }
    else //If the connected user is not registered,
    {//then we will 'force' him to register :)
        ShowPlayerDialog(playerid,dregister,DIALOG_STYLE_INPUT,"Register","Welcome! This account is not registered.\nEnter your own password to create a new account.","Register","Quit");
        return 1;
    }
    return 1;
}
Reply
#2

Remove the "return true" as that will break the code after it.
And point out what lines exactly
Reply
#3

pawn Код:
stock Path(playerid)
{
    new str[128],name[MAX_PLAYER_NAME];
    GetPlayerName(playerid,name,sizeof(name));
    format(str,sizeof(str),UserPath,name);
    return str;
}
That is lines 102-104, where the errors are happening.

pawn Код:
GetPlayerName(playerid,name,sizeof(name)); //Get player's name
Line 134, where the 2nd warning is.

National Gaming Roleplay CS\gamemodes\Roleplay.pwn(102) : warning 202: number of arguments does not match definition
National Gaming Roleplay CS\gamemodes\Roleplay.pwn(102) : warning 202: number of arguments does not match definition
National Gaming Roleplay CS\gamemodes\Roleplay.pwn(134) : warning 202: number of arguments does not match definition
National Gaming Roleplay CS\gamemodes\Roleplay.pwn(134) : warning 202: number of arguments does not match definition
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


4 Warnings.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)