I need help fixing this.
#1

Yes I'm a newbie at scripting. but I'm trying to make a register/login dialog. Soon as i come to the OnPlayerConnect part. I get a error that comes up with.

error 021: symbol already defined: "Itter_OnPlayerConnect"

I have the #include <YSI\y_ini> with the includes. Please help.
Reply
#2

Are you using a FilterScript? Can you show us the code?
Reply
#3

No I'm not using a Filterscript

public OnPlayerConnect(playerid)
{
if(fexist(UserPath(playerid)))
{
INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,""COL_WHITE"Login",""COL_WHITE" Type your password below to login.","Login","Quit");
}
else
{
ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT,""COL_WHITE"Registering...",""C OL_WHITE"Type your password below to register a new account.","Register","Quit");
}
return 1;
}

This is where the error begins.
Reply
#4

You probably have OnPlayerConnect defined twice in your gamemode
Reply
#5

Search for another OnPlayerConnect, if nothing shows up search for Itter_OnPlayerConnect and show me what you have in there.
Reply
#6

I dont have Itter_Onplayerconnect, but I have OnplayerConnect twice. In another location what do I do?
Reply
#7

Remove the second OnPlayerConnect thats what's causing the error. Actually show both of them
Reply
#8

public OnPlayerConnect(playerid)
{
SendClientMessage(playerid, 0x33CCFFAA, "[INFO]: "COL_RULE"You have been connected to the server.");
new name[MAX_PLAYER_NAME+1], str[24+MAX_PLAYER_NAME+1];
GetPlayerName(playerid, name, sizeof(name));
// Has numbers
if(strfind(name, "0", true) != -1 || strfind(name, "1", true) != -1 || strfind(name, "2", true) != -1 || strfind(name, "3", true) != -1 || strfind(name, "4", true) != -1 || strfind(name, "5", true) != -1
|| strfind(name, "6", true) != -1 || strfind(name, "7", true) != -1 || strfind(name, "8", true) != -1 || strfind(name, "9", true) != -1 || strfind(name, "[", true) != -1 || strfind(name, "]", true) != -1)
{
SendClientMessage(playerid, 0x33CCFFAA, "SERVER: {FFFFFF}This is a RP Server, please reconnect using Firstname_Lastname format.");
SendClientMessage(playerid, 0x33CCFFAA, "SERVER: {FFFFFF}Also, please remove the numbers and/or tags in your name.");
GetPlayerName(playerid, name, sizeof(name));
format(str, sizeof(str), "%s has been kicked from the server for having a Non-RP name.", name);
SendClientMessageToAll(0xC4C4C4FF, str);
Kick(playerid);
}
// No Underscore
if(strfind( name, "_", true) == -1)
{
SendClientMessage(playerid, 0x33CCFFAA, "SERVER: {FFFFFF}This is a RP Server, please reconnect using Firstname_Lastname format.");
SetTimerEx("DelayedKick", 1000, false, "d", playerid);
}
return 1;
}






public OnPlayerConnect(playerid)
{
if(fexist(UserPath(playerid)))
{
INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,""COL_WHITE"Login",""COL_WHITE" Type your password below to login.","Login","Quit");
}
else
{
ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT,""COL_WHITE"Registering...",""C OL_WHITE"Type your password below to register a new account.","Register","Quit");
}
return 1;
}
Reply
#9

First show them both so that we can check if the other one doesn't have anything that will mess up the code after you erase it
Reply
#10

Try this (Not tested)
Код:
public OnPlayerConnect(playerid)
{
		if(fexist(UserPath(playerid)))
		{
		INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
		ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,""COL_WHITE"Login",""COL_WHITE" Type your password below to login.","Login","Quit");
		}
		else
		{
		ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT,""COL_WHITE"Registering...",""C OL_WHITE"Type your password below to register a new account.","Register","Quit");
		}
		SendClientMessage(playerid, 0x33CCFFAA, "[INFO]: "COL_RULE"You have been connected to the server.");
		new name[MAX_PLAYER_NAME+1], str[24+MAX_PLAYER_NAME+1];
		GetPlayerName(playerid, name, sizeof(name));
		// Has numbers
		if(strfind(name, "0", true) != -1 || strfind(name, "1", true) != -1 || strfind(name, "2", true) != -1 || strfind(name, "3", true) != -1 || strfind(name, "4", true) != -1 || strfind(name, "5", true) != -1
		|| strfind(name, "6", true) != -1 || strfind(name, "7", true) != -1 || strfind(name, "8", true) != -1 || strfind(name, "9", true) != -1 || strfind(name, "[", true) != -1 || strfind(name, "]", true) != -1)
		{
		SendClientMessage(playerid, 0x33CCFFAA, "SERVER: {FFFFFF}This is a RP Server, please reconnect using Firstname_Lastname format.");
		SendClientMessage(playerid, 0x33CCFFAA, "SERVER: {FFFFFF}Also, please remove the numbers and/or tags in your name.");
		GetPlayerName(playerid, name, sizeof(name));
		format(str, sizeof(str), "%s has been kicked from the server for having a Non-RP name.", name);
		SendClientMessageToAll(0xC4C4C4FF, str);
		Kick(playerid);
		}
		// No Underscore
		if(strfind( name, "_", true) == -1)
		{
		SendClientMessage(playerid, 0x33CCFFAA, "SERVER: {FFFFFF}This is a RP Server, please reconnect using Firstname_Lastname format.");
		SetTimerEx("DelayedKick", 1000, false, "d", playerid);
		}
		return 1;
}
You can't use two OnPlayerConnect's.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)