SA-MP Forums Archive
Help with this error. - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Help with this error. (/showthread.php?tid=446602)



Help with this error. - ~Varrez~ - 26.06.2013

I'm getting this error. ;I
Код:
error 035: argument type mismatch (argument 1)
Heres my whole OnPlayerConnect.
pawn Код:
public OnPlayerConnect(playerid)
{
    if(RoleplayNameCheck(GetPlayerName(playerid)))
    {
        SendClientMessage(playerid, -1, COLOR_RED"Your name is not in the Firstname_Lastname format! "COLOR_WHITE"Please correct it.");
        Kick(playerid);
    }
    return 1;
   
    if(fexist(UserPath(playerid)))
    {
        INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
        ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,""COLOR_WHITE"Login",""COLOR_WHITE"Type your password below to login.","Login","Quit");
    }
    else
    {
        ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT,""COLOR_WHITE"Registering...",""COLOR_WHITE"Type your password below to register a new account.","Register","Quit");
    }
    return 1;
}
Heres the error line.
pawn Код:
if(! RoleplayNameCheck(GetPlayerName(playerid)))
Another question I wanna ask is; why don't stock and forward turn out blue when I make a function using them? They are just regular black... (I'm REALLY not sure, but I think this can be a bug.)


Re: Help with this error. - Deathstalker - 26.06.2013

You have to store GetPlayerName in a variable like this:
pawn Код:
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name);



Re: Help with this error. - ~Varrez~ - 26.06.2013

Quote:
Originally Posted by Deathstalker
Посмотреть сообщение
You have to store GetPlayerName in a variable like this:
pawn Код:
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name);
Man I don't wanna sound mega retarded but where am I supposed to put that? Can you add it to my script and explain why? ;I (I'm new to scripting...)


Re: Help with this error. - Deathstalker - 26.06.2013

pawn Код:
public OnPlayerConnect(playerid)
{
    new name[MAX_PLAYER_NAME]; // Create variable to hold name.
    GetPlayerName(playerid, name); // Use GetPlayername to store the player with playerid's name to the variable  above. Then use that variable with your function.
    if(RoleplayNameCheck(name))
    {
        SendClientMessage(playerid, -1, COLOR_RED"Your name is not in the Firstname_Lastname format! "COLOR_WHITE"Please correct it.");
        Kick(playerid);
    }
    return 1;
   
    if(fexist(UserPath(playerid)))
    {
        INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
        ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,""COLOR_WHITE"Login",""COLOR_WHITE"Type your password below to login.","Login","Quit");
    }
    else
    {
        ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT,""COLOR_WHITE"Registering...",""COLOR_WHITE"Type your password below to register a new account.","Register","Quit");
    }
    return 1;
}



Re: Help with this error. - ~Varrez~ - 26.06.2013

Quote:
Originally Posted by Deathstalker
Посмотреть сообщение
pawn Код:
public OnPlayerConnect(playerid)
{
    new name[MAX_PLAYER_NAME]; // Create variable to hold name.
    GetPlayerName(playerid, name); // Use GetPlayername to store the player with playerid's name to the variable  above. Then use that variable with your function.
    if(RoleplayNameCheck(name))
    {
        SendClientMessage(playerid, -1, COLOR_RED"Your name is not in the Firstname_Lastname format! "COLOR_WHITE"Please correct it.");
        Kick(playerid);
    }
    return 1;
   
    if(fexist(UserPath(playerid)))
    {
        INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
        ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,""COLOR_WHITE"Login",""COLOR_WHITE"Type your password below to login.","Login","Quit");
    }
    else
    {
        ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT,""COLOR_WHITE"Registering...",""COLOR_WHITE"Type your password below to register a new account.","Register","Quit");
    }
    return 1;
}
Much thanks! It worked. REP +1

EDIT: Anything to my other question? Stock and Forward not appearing blue in pawno! ;I


Re: Help with this error. - dEcooR - 26.06.2013

i think it should be so,and you will not see this message "Your name is not in....." because kick is fastest than scm

Код:
public OnPlayerConnect(playerid)
{
    new name[MAX_PLAYER_NAME]; // Create variable to hold name.
    GetPlayerName(playerid, name,24); // Use GetPlayername to store the player with playerid's name to the variable  above. Then use that variable with your function. 
    if(RoleplayNameCheck(name))
    {
        SendClientMessage(playerid, -1, COLOR_RED"Your name is not in the Firstname_Lastname format! "COLOR_WHITE"Please correct it.");
        Kick(playerid);
    }
    
    if(fexist(UserPath(playerid)))
    {
        INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
        ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,""COLOR_WHITE"Login",""COLOR_WHITE"Type your password below to login.","Login","Quit");
    }
    else
    {
        ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT,""COLOR_WHITE"Registering...",""COLOR_WHITE"Type your password below to register a new account.","Register","Quit");
    }
    return 1;
}