[HELP]Server Crash at 200 ping,ID interfusion if more than 6 player
#1

Hello all...
I have problems with my gamemode...
My friend downloaded an LSL-RP script
He's a good scripter so he modify the script alot
After 2 months we tested the server
We got 2 problems:
Problem 1)
If the ping of the server is more than 200, the server simply crashes.
The server gives you a message:Server Closed The Connection.
Problem 2)
If on the server is more than 6 players connected the Player IDs are interfusing
For example:If i kick a player with ID 4 i kick myself with ID 6
but in the server list that player have ID 4 -.-"
Same at /ban...

I've searched the forum for similar topics but i found nothing...
Please help for us cos we want to start our Server...
Thanx for the replies and solutions.
Sry for my bad English
erik019
Reply
#2

Well firstly : If you get kicked when you exceed the ping of "200", it must be your ping kicker.
Secondly: You need to show the kick and ban commands if you expect any help.
Reply
#3

We dont have a ping kicker.If the ping of the hole server is 200 (ping in the client) then the server crashes...Like when you exit samp-server.exe
The kick and ban commands are the same as in the GF edit
I not sure but not only with these 2 commands do this the server
Reply
#4

Quote:
Originally Posted by erik019
We dont have a ping kicker.If the ping of the hole server is 200 (ping in the client) then the server crashes...Like when you exit samp-server.exe
The kick and ban commands are the same as in the GF edit
I not sure but not only with these 2 commands do this the server
Lol what? Same as in the GF edit? How am I supposed to know what the problem is untill you show me the code?
And for your ping problem: Try reducing the array sizes of strings from 256 to say 128 or less. [GM]GodFather is huge and with string array sizes set to 256, it might crash, although i am not sure of the reason for the crash. Ths only for the better in general
Reply
#5

We tried to reducing the array sizes but it no effect to the mode.
Heres the kick and ban source code:
Code:
if(strcmp(cmd, "/ban", true) == 0)
	{
	  if(IsPlayerConnected(playerid))
	  {
	    if (PlayerInfo[playerid][pAdmin] <= 2)
			{
			  SendClientMessage(playerid, COLOR_GRAD1, "You dont have permissions!");
				SecondLifeInfoBox(playerid, "You cannot use this command~n~because you are not an admin.");
				return 1;
			}
	  	tmp = strtok(cmdtext, idx);
			if(!strlen(tmp))
			{
				SendClientMessage(playerid, COLOR_GRAD2, "Use: /ban [PlayerID/PartOfTheName] [reason]");
				return 1;
			}
			giveplayerid = ReturnUser(tmp);
			if (PlayerInfo[playerid][pAdmin] >= 3)
			{
			  if(IsPlayerConnected(giveplayerid))
			  {
			    if(giveplayerid != INVALID_PLAYER_ID)
			    {
					  GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
						GetPlayerName(playerid, sendername, sizeof(sendername));
						new length = strlen(cmdtext);
						while ((idx < length) && (cmdtext[idx] <= ' '))
						{
							idx++;
						}
						new offset = idx;
						new result[64];
						while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
						{
							result[idx - offset] = cmdtext[idx];
							idx++;
						}
						result[idx - offset] = EOS;
						if(!strlen(result))
						{
							SendClientMessage(playerid, COLOR_GRAD2, "Use: /ban [PlayerID/PartOfTheName] [reason]");
							return 1;
						}

						new year, month,day;
						getdate(year, month, day);
						format(string, sizeof(string), "[ADMIN]: %s was banned by %s, reason: %s (%d-%d-%d)", giveplayer, sendername, (result),month,day,year);
						BanLog(string);
						AdminLog(string);
						format(string, sizeof(string), "[ADMIN]: %s was banned by %s, reason: %s (%d-%d-%d)", giveplayer, sendername, (result),month,day,year);
						SendClientMessageToAll(COLOR_LIGHTRED, string);
						new ipaddress[16];
						GetPlayerIp(giveplayerid,ipaddress,sizeof(ipaddress));
						new BannedReason[126];
						format(BannedReason, sizeof(BannedReason), "Banned. Reason: %s", (result));
						Ban(giveplayerid);
						Kick(giveplayerid);
						return 1;
					}
				}//not connected
			}
			else
			{
				format(string, sizeof(string), "  %d is not an active player.", giveplayerid);
				SendClientMessage(playerid, COLOR_GRAD1, string);
			}
		}
		return 1;
	}
The Kick Command:
Code:
if(strcmp(cmd, "/kick", true) == 0)
	{
	  if(IsPlayerConnected(playerid))
	  {
	    if (PlayerInfo[playerid][pAdmin] <= 1)
			{
			  SendClientMessage(playerid, COLOR_GRAD1, "You dont have permission!");
				SecondLifeInfoBox(playerid, "You cant use this command~n~because you are not an admin.");
				return 1;
			}
	  	tmp = strtok(cmdtext, idx);
			if(!strlen(tmp))
			{
				SendClientMessage(playerid, COLOR_GRAD2, "Use: /kick [PlayerID/PartOfTheName] [Reason]");
				return 1;
			}
			giveplayerid = ReturnUser(tmp);
			if (PlayerInfo[playerid][pAdmin] >= 2)
			{
				if(IsPlayerConnected(giveplayerid))
				{
				  if(giveplayerid != INVALID_PLAYER_ID)
				  {
					  GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
						GetPlayerName(playerid, sendername, sizeof(sendername));
						new length = strlen(cmdtext);
						while ((idx < length) && (cmdtext[idx] <= ' '))
						{
							idx++;
						}
						new offset = idx;
						new result[64];
						while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
						{
							result[idx - offset] = cmdtext[idx];
							idx++;
						}
						result[idx - offset] = EOS;
						if(!strlen(result))
						{
							SendClientMessage(playerid, COLOR_GRAD2, "Use: /kick [PlayerID/PartOfTheName] [Reason]");
							return 1;
						}
						new year, month,day;
						getdate(year, month, day);
						format(string, sizeof(string), "[ADMIN]: %s has been kicked by %s, Reason: %s (%d-%d-%d)", giveplayer, sendername, (result),month,day,year);
						KickLog(string);
						format(string, sizeof(string), "[ADMIN]: %s has been kicked by %s, Reason: %s (%d-%d-%d)", giveplayer, sendername, (result),month,day,year);
						SendClientMessageToAll(COLOR_RED, string);
						Kick(giveplayerid);
						return 1;
					}
				}
			}
			else
			{
				format(string, sizeof(string), "  %d is not an active player.", giveplayerid);
				SendClientMessage(playerid, COLOR_GRAD1, string);
			}
		}
		return 1;
	}
But not only with these 2 commands do this the server.The all command who want an ID for command do this.
Plss help
Reply
#6

Here you go:

Code:
if(strcmp(cmdtext, "/ban", true,4) == 0)
	{
	  if(IsPlayerConnected(playerid))
	  {
	    if (PlayerInfo[playerid][pAdmin] <= 2)
			{
			  	SendClientMessage(playerid, COLOR_GRAD1, "You dont have permissions!");
				SecondLifeInfoBox(playerid, "You cannot use this command~n~because you are not an admin.");
				return 1;
			}
	  		tmp = strtok(cmdtext, idx);
			if(!strlen(tmp))
			{
				SendClientMessage(playerid, COLOR_GRAD2, "Use: /ban [PlayerID/PartOfTheName] [reason]");
				return 1;
			}
			giveplayerid = strval(tmp);
			if (PlayerInfo[playerid][pAdmin] >= 3)
			{
			  if(IsPlayerConnected(giveplayerid))
			  {
			    if(giveplayerid != INVALID_PLAYER_ID)
			    {
					  GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
						GetPlayerName(playerid, sendername, sizeof(sendername));
						new length = strlen(cmdtext);
						while ((idx < length) && (cmdtext[idx] <= ' '))
						{
							idx++;
						}
						new offset = idx;
						new result[64];
						while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
						{
							result[idx - offset] = cmdtext[idx];
							idx++;
						}
						result[idx - offset] = EOS;
						if(!strlen(result))
						{
							SendClientMessage(playerid, COLOR_GRAD2, "Use: /ban [PlayerID/PartOfTheName] [reason]");
							return 1;
						}

						new year, month,day;
						getdate(year, month, day);
						format(string, sizeof(string), "[ADMIN]: %s was banned by %s, reason: %s (%d-%d-%d)", giveplayer, sendername, (result),month,day,year);
						BanLog(string);
						AdminLog(string);
						format(string, sizeof(string), "[ADMIN]: %s was banned by %s, reason: %s (%d-%d-%d)", giveplayer, sendername, (result),month,day,year);
						SendClientMessageToAll(COLOR_LIGHTRED, string);
						new ipaddress[16];
						GetPlayerIp(giveplayerid,ipaddress,sizeof(ipaddress));
						new BannedReason[126];
						format(BannedReason, sizeof(BannedReason), "Banned. Reason: %s", (result));
						Ban(giveplayerid);
						Kick(giveplayerid);
						return 1;
					}
				}//not connected
			}
			else
			{
				format(string, sizeof(string), "  %d is not an active player.", giveplayerid);
				SendClientMessage(playerid, COLOR_GRAD1, string);
			}
		}
		return 1;
	}

And here's your KICK command

Code:
if(strcmp(cmdtext, "/kick", true,5) == 0)
	{
	  if(IsPlayerConnected(playerid))
	  {
	    if (PlayerInfo[playerid][pAdmin] <= 1)
			{
			  	SendClientMessage(playerid, COLOR_GRAD1, "You dont have permission!");
				SecondLifeInfoBox(playerid, "You cant use this command~n~because you are not an admin.");
				return 1;
			}
	  	tmp = strtok(cmdtext, idx);
			if(!strlen(tmp))
			{
				SendClientMessage(playerid, COLOR_GRAD2, "Use: /kick [PlayerID/PartOfTheName] [Reason]");
				return 1;
			}
			giveplayerid = strval(tmp);
			if (PlayerInfo[playerid][pAdmin] >= 2)
			{
				if(IsPlayerConnected(giveplayerid))
				{
				  if(giveplayerid != INVALID_PLAYER_ID)
				  {
					  	GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
						GetPlayerName(playerid, sendername, sizeof(sendername));
						new length = strlen(cmdtext);
						while ((idx < length) && (cmdtext[idx] <= ' '))
						{
							idx++;
						}
						new offset = idx;
						new result[64];
						while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
						{
							result[idx - offset] = cmdtext[idx];
							idx++;
						}
						result[idx - offset] = EOS;
						if(!strlen(result))
						{
							SendClientMessage(playerid, COLOR_GRAD2, "Use: /kick [PlayerID/PartOfTheName] [Reason]");
							return 1;
						}
						new year, month,day;
						getdate(year, month, day);
						format(string, sizeof(string), "[ADMIN]: %s has been kicked by %s, Reason: %s (%d-%d-%d)", giveplayer, sendername, (result),month,day,year);
						KickLog(string);
						format(string, sizeof(string), "[ADMIN]: %s has been kicked by %s, Reason: %s (%d-%d-%d)", giveplayer, sendername, (result),month,day,year);
						SendClientMessageToAll(COLOR_RED, string);
						Kick(giveplayerid);
						return 1;
					}
				}
			}
			else
			{
				format(string, sizeof(string), "  %d is not an active player.", giveplayerid);
				SendClientMessage(playerid, COLOR_GRAD1, string);
			}
		}
		return 1;
	}
Reply
#7

Thanks...I will try it out...
Reply
#8

The problem was solved.My friend is corrected the problems...but thx for your ideas DJDhan
i appreciate it.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)