Else twice
#1

Hmm whats wrong with this code?
Код:
public OnPlayerConnect(playerid)
{
    new str[500];
    new rows, fields;
    cache_get_data(rows, fields, dbHandle);
    if(rows)
    {
        format(msg, sizeof(msg), "Welcome to Molotov Roleplay Gaming, %s\nThis user was found in our database, please enter your password below to login.\n\nYou have 60 seconds to login.", GetName(playerid));
        ShowDialog(playerid, Show:<Login>, DIALOG_STYLE_INPUT, ""EMBED_YELLOW"Molotov Roleplay Gaming Login"EMBED_WHITE"", msg, "Login", "Quit");
        LoginTimer{playerid} = SetTimerEx("CheckPlayerLogged", 60000, 0, "i", playerid);
    }
    else
    {
        ShowDialog(playerid, Show:<ConfirmWord>, DIALOG_STYLE_INPUT, ""EMBED_RED"Secret word confirmation"EMBED_WHITE"", ""EMBED_WHITE"The IP you are using is not the same for\nthis account, please enter the secret word of the player.", "Okay", "Exit");
    }
    else
 	{
		SetIntVar(playerid, "RegisterPart", 1);
		format(str, sizeof(str), ""EMBED_WHITE"Welcome to Molotov Roleplay Gaming, "EMBED_RED"%s\n"EMBED_WHITE"This user was not found in our database, please enter a password below to register.", GetName(playerid));
		ShowDialog(playerid, Show:<Register>, DIALOG_STYLE_INPUT, ""EMBED_YELLOW"Molotov Roleplay Gaming Registration"EMBED_WHITE"", str, "Register", "Quit");
 	}
  return 1;
}
Got these warnings and errors too
Код:
C:\Users\YakupMalikDavut\Desktop\RoleplayRoleplay\host\hrp\gamemodes\rprp.pwn(1123) : error 029: invalid expression, assumed zero
C:\Users\YakupMalikDavut\Desktop\RoleplayRoleplay\host\hrp\gamemodes\rprp.pwn(1129) : warning 217: loose indentation
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.
Line 1123
Код:
    else
Line 1129
Код:
  return 1;
Reply
#2

You can't use else twice, it's illogical think. That second warning is bad routing code.
Reply
#3

Quote:
Originally Posted by Raweresh
Посмотреть сообщение
You can't use else twice, it's illogical think. That second warning is bad routing code.
Then what should i do then? Should i replace it with If or?
Reply
#4

You must first explain what you want to do, and I think show that query.
Reply
#5

Well i want to use MySQL Static plugin. First when i uploaded it the login dialog didn't work.
So i thought if i inputted the login/register system on OnPlayerConnect the dialog would work so thats what i trying to do. Here is the previously thread i made: https://sampforum.blast.hk/showthread.php?tid=547350
Reply
#6

Okay, look:
Код:
public OnPlayerConnect(playerid)
{
    new str[500];
    new rows, fields;
    cache_get_data(rows, fields, dbHandle);
    if(rows)
    {
        format(msg, sizeof(msg), "Welcome to Molotov Roleplay Gaming, %s\nThis user was found in our database, please enter your password below to login.\n\nYou have 60 seconds to login.", GetName(playerid));
        ShowDialog(playerid, Show:<Login>, DIALOG_STYLE_INPUT, ""EMBED_YELLOW"Molotov Roleplay Gaming Login"EMBED_WHITE"", msg, "Login", "Quit");
        LoginTimer{playerid} = SetTimerEx("CheckPlayerLogged", 60000, 0, "i", playerid);
    }
    //That above is performed when player is registered.
    else
    {
        ShowDialog(playerid, Show:<ConfirmWord>, DIALOG_STYLE_INPUT, ""EMBED_RED"Secret word confirmation"EMBED_WHITE"", ""EMBED_WHITE"The IP you are using is not the same for\nthis account, please enter the secret word of the player.", "Okay", "Exit");
    }
    //This above you want to perform when?
    else
 	{
		SetIntVar(playerid, "RegisterPart", 1);
		format(str, sizeof(str), ""EMBED_WHITE"Welcome to Molotov Roleplay Gaming, "EMBED_RED"%s\n"EMBED_WHITE"This user was not found in our database, please enter a password below to register.", GetName(playerid));
		ShowDialog(playerid, Show:<Register>, DIALOG_STYLE_INPUT, ""EMBED_YELLOW"Molotov Roleplay Gaming Registration"EMBED_WHITE"", str, "Register", "Quit");
 	}
 	//This above is performed when player is not registered.
	return 1;
}
Read comments and answer.
Reply
#7

Using twice Else:
Код:
If this is this
    do this
else if it's whatever it's not
    do this
else if it's whatever it's not not and not the first
    do this.
If you don't understand what the third is, don't worry. your script also doesn't know.
Reply
#8

Код:
ShowDialog(playerid, Show:<ConfirmWord>, DIALOG_STYLE_INPUT, ""EMBED_RED"Secret word confirmation"EMBED_WHITE"", ""EMBED_WHITE"The IP you are using is not the same for\nthis account, please enter the secret word of the player.", "Okay", "Exit");
    }
Well this part is when you login into your account in a other IP then they have to approve with their security password
Reply
#9

Okay, so delete this:
Код:
    else
    {
        ShowDialog(playerid, Show:<ConfirmWord>, DIALOG_STYLE_INPUT, ""EMBED_RED"Secret word confirmation"EMBED_WHITE"", ""EMBED_WHITE"The IP you are using is not the same for\nthis account, please enter the secret word of the player.", "Okay", "Exit");
    }
And you will use it in OnDialogResponse when player log in but his ip is difference.
Reply
#10

Okay other ways to define this?
Код:
public OnPlayerConnect(playerid, PlayerText:playertextid)
Код:
PlayerText:playertextid
Because its actually giving me this error
Код:
C:\Users\YakupMalikDavut\Desktop\RoleplayRoleplay\Test servers\hrp\gamemodes\rprp.pwn(1108) : error 025: function heading differs from prototype
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)