SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help > Help Archive

 
 
Thread Tools Display Modes
Old 06/06/2010, 09:01 PM   #1
erik019
Little Clucker
 
Join Date: Jun 2009
Posts: 46
Reputation: 0
Default [HELP]Server Crash at 200 ping,ID interfusion if more than 6 player

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
erik019 is offline  
Old 06/06/2010, 09:06 PM   #2
DJDhan
High-roller
 
DJDhan's Avatar
 
Join Date: Oct 2009
Location: Canada
Posts: 1,152
Reputation: 3
Default Re: [HELP]Server Crash at 200 ping,ID interfusion if more than 6 player

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.
__________________
DJDhan is offline  
Old 06/06/2010, 09:24 PM   #3
erik019
Little Clucker
 
Join Date: Jun 2009
Posts: 46
Reputation: 0
Default Re: [HELP]Server Crash at 200 ping,ID interfusion if more than 6 player

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
erik019 is offline  
Old 06/06/2010, 09:28 PM   #4
DJDhan
High-roller
 
DJDhan's Avatar
 
Join Date: Oct 2009
Location: Canada
Posts: 1,152
Reputation: 3
Default Re: [HELP]Server Crash at 200 ping,ID interfusion if more than 6 player

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
__________________
DJDhan is offline  
Old 11/06/2010, 05:35 PM   #5
erik019
Little Clucker
 
Join Date: Jun 2009
Posts: 46
Reputation: 0
Default Re: [HELP]Server Crash at 200 ping,ID interfusion if more than 6 player

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
erik019 is offline  
Old 11/06/2010, 06:53 PM   #6
DJDhan
High-roller
 
DJDhan's Avatar
 
Join Date: Oct 2009
Location: Canada
Posts: 1,152
Reputation: 3
Default Re: [HELP]Server Crash at 200 ping,ID interfusion if more than 6 player

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;
	}
__________________
DJDhan is offline  
Old 11/06/2010, 10:02 PM   #7
erik019
Little Clucker
 
Join Date: Jun 2009
Posts: 46
Reputation: 0
Default Re: [HELP]Server Crash at 200 ping,ID interfusion if more than 6 player

Thanks...I will try it out...
erik019 is offline  
Old 13/06/2010, 02:13 AM   #8
erik019
Little Clucker
 
Join Date: Jun 2009
Posts: 46
Reputation: 0
Default Re: [HELP]Server Crash at 200 ping,ID interfusion if more than 6 player

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

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Server Lag (Ping jumping up and down) dethwaker3 Server Support 1 09/11/2009 05:31 AM
[HELP] Server crash SOMETIMES when player connects! ÄitisOnHuora Help Archive 2 06/09/2009 04:09 PM
Damnit Ping in my Server!!!!!!!!!!!!!! simonall2 Server Support 9 18/07/2009 03:28 AM
Kick player = server crash... cmg4life Help Archive 9 09/03/2009 04:18 PM
[FS|0.2] Player Protections (DB, TK, Heli, Spawnkill, Ping, Spam) [NoV]HAMM3R Filterscripts 37 25/01/2009 11:04 AM


All times are GMT. The time now is 05:48 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.