server closed the connection/kick
#1

Hi I have a problem
When my server a while to state
When someone joint and he gets this error message

server closed the connection

I was still in the server, but I saw that my friend was kicked by the server

I hope someone can help me
Reply
#2

Please post your OnPlayerUpdate and OnPlayerConnect code.
Reply
#3

This will be caused by a kick command executed by your gamemode, this might be because you have an anti-ping function or a similar function. Unless your gamemode is incorrectly scripted and in this case you will need to correct it.

PS: Also make sure any plugin you have is correctly installed and up to date.
Reply
#4

Quote:
Originally Posted by PrivatioBoni
Посмотреть сообщение
Please post your OnPlayerUpdate and OnPlayerConnect code.
Thank you message
Here are the two codes

OnPlayerUpdate
//================================================== ============================
public OnPlayerUpdate(playerid)
{

return 1;
}
//================================================== ============================
/*forward UpdateObject();
public UpdateObject()
{
for(new o = 0; o < sizeof(ObjectInfo); o++)
{
if (ObjectActive[o] == 0)
{
for(new i = 0; i < GetMaxPlayers(); i++)
{
if(IsPlayerConnected(i) && !IsPlayerNPC(i) && PlayerInfo[i][pSpawn] == 1)
{
if (PlayerToPoint(50, i, ObjectInfo[o][OB_X],ObjectInfo[o][OB_Y],ObjectInfo[o][OB_Z]))
{
CreateObject(ObjectInfo[o][OB_id],ObjectInfo[o][OB_X],ObjectInfo[o][OB_Y],ObjectInfo[o][OB_Z],ObjectInfo[o][OB_rX],ObjectInfo[o][OB_rY],ObjectInfo[o][OB_rZ],0.0);
ObjectActive[o] = 1;
}

}
}

}else{

for(new i = 0; i < GetMaxPlayers(); i++)
{
if(IsPlayerConnected(i) && !IsPlayerNPC(i) && PlayerInfo[i][pSpawn] == 1)
{
if (!PlayerToPoint(50, i, ObjectInfo[o][OB_X],ObjectInfo[o][OB_Y],ObjectInfo[o][OB_Z]))
{
DestroyObject(o);
ObjectActive[o] = 0;
}
}
}

}
//CreateObject(ObjectInfo[i][OB_id],ObjectInfo[i][OB_X],ObjectInfo[i][OB_Y],ObjectInfo[i][OB_Z],ObjectInfo[i][OB_rX],ObjectInfo[i][OB_rY],ObjectInfo[i][OB_rZ],0.0);
//ObjectActive[i] = 0;
}
}*/
//================================================== ============================
public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
{
return 1;
}
//================================================== ============================
/*public OnJunkBusterKick (playerid, reason [])
{
KickPlayer(playerid,"SERVER","SERVER",reason);
return 1;
}
//================================================== ============================
public OnJunkBusterBan (playerid, reason [])
{
BanPlayer(playerid,"SERVER","SERVER",reason);
return 1;
}
//================================================== ============================
public OnJunkBusterReport (playerid, reason [], details [])
{
new string[256];
format(string, sizeof(string), "{FF66FF}WARNING: {FFFFFF}%s (%i) {D6D631}REASON: {FFFFFF}%s {D6D631}DETAILS: {FFFFFF}%s",PlayerInfo[playerid][pName],playerid, reason, details);
SendClientMessageToAdmins(COLOR_SERVER_MAIN_MSG, string);

return 1;
}*/
//================================================== ============================

OnPlayerConnect
//================================================== ============================
public OnPlayerConnect(playerid)
{
new string[256],Query[200];

GetPlayerName(playerid, PlayerInfo[playerid][pName], 12;
GetPlayerIp(playerid, PlayerInfo[playerid][pIP], 50);

ResetAllPlayerStats(playerid);

SetPlayerColor(playerid, COLOR_DEAD);

if (IsPlayerNPC(playerid))
{

/*new ip_addr_npc[64+1];
new ip_addr_server[64+1];
GetServerVarAsString("bind",ip_addr_server,64);
GetPlayerIp(playerid,ip_addr_npc,64);

if(!strlen(ip_addr_server)) {
ip_addr_server = "127.0.0.1";
}

if(strcmp(ip_addr_npc,ip_addr_server,true) != 0) {
// this bot is remote connecting
printf("NPC: Remote NPC Attempting To Connect From %s And I'm Kicking It.",ip_addr_npc);
Kick(playerid);
return 0;
}
//printf("NPC: Connection From %s Is Allowed.",ip_addr_npc);*/
format(string, sizeof(string), "* NPC %s (%i) Has Joined The Server.",PlayerInfo[playerid][pName],playerid);
SendClientMessageToOthers(playerid, COLOR_DEAD, string);

}else{// End of NPC Check

//DestroyGPSData(playerid);


new PIP[56]; //Creates the IP string
GetPlayerIp(playerid, PIP, 56); //Gets the players IP

format(Query, sizeof(Query), "SELECT * FROM banned WHERE IP = '%s'", PIP); //Checks if the players IP is in the database, if so it will kick them

mysql_query(Query);//Queries
mysql_store_result(); //Stores the result

if(mysql_num_rows() != 0) //If the ip is found
{
SendClientMessage(playerid, COLOR_ERROR, "Your IP Has Been Banned Due To Abuse, Visit "WEBSITE" For More Info.");
Kick(playerid);
return 0;
}
PlayerInfo[playerid][pClassselection] = 10;

// Create Intro textdraw for when a player joins the server:
TextDrawSetString(MediumTextdraw0[playerid], " ~n~~y~Space - 's~n~~b~Cops ~w~And ~r~Robbers~n~ ~n~ ~n~ ~n~ ~n~ ~n~ ~n~ ~n~ ~n~ ~n~ ~n~ ~n~ ~n~ ");
format(string, sizeof(string), "~g~%s",ServerInfo[sMapName]);
TextDrawSetString(MediumTextdraw1[playerid], string);
TextDrawSetString(MediumTextdraw2[playerid], "- This Is ~r~Not ~w~A Deathmatch Server~n~- Do ~r~Not ~w~Attack People For No Reason~n~Or You Will Be Kicked / Banned~n~ ~n~- Respect Admins And Other Players~n~ ~n~- Type ~y~/help ~w~For Help And Game Information.~n~- Type ~y~/rules ~w~For Server Rules");
format(string, sizeof(string), " ~n~ ~n~ ~n~ ~n~ ~n~ ~n~ ~n~ ~n~ ~n~ ~n~ ~n~~y~Version %s~n~ ~n~~b~%s", VERSION, WEBSITE);
TextDrawSetString(MediumTextdraw3[playerid], string);

TextDrawShowForPlayer(playerid, MediumTextdraw0[playerid]);
TextDrawShowForPlayer(playerid, MediumTextdraw1[playerid]);
TextDrawShowForPlayer(playerid, MediumTextdraw2[playerid]);
TextDrawShowForPlayer(playerid, MediumTextdraw3[playerid]);

//format(string, sizeof(string), "02[JOIN] 03%s (%d) Has Joined The Server.", PlayerInfo[playerid][pName], playerid);
//IRC_GroupSay(gGroupID, IRC_CHANNEL, string);

format(string, sizeof(string), "* %s (%i) Has Joined The Server.",PlayerInfo[playerid][pName],playerid);
SendClientMessageToOthers(playerid, COLOR_DEAD, string);

format(string, sizeof(string), "{FFFFFF}Welcome to {D6D631}Space - {0077FF}Cops {FFFFFF}And {FF0000}Robbers{FFFFFF}- {00AAFF}%s {D6D631}Version %s",ServerInfo[sMapName],VERSION);
SendClientMessage(playerid, COLOR_SERVER_MAIN_MSG, string);

format(string, sizeof(string), "{FFFFFF}Type {D6D631}/help /cmds /rules {FFFFFF}or visit {00AAFF}%s {FFFFFF}For Game Info.",WEBSITE);
SendClientMessage(playerid, COLOR_SERVER_MAIN_MSG, string);

SendClientMessage(playerid, COLOR_SERVER_MAIN_MSG, "{FF0000}Warning! {FFFFFF}This Server (and GTA In General) Contains Explicit Material.");






format(Query, sizeof(Query), "SELECT * FROM playerdata WHERE UserName = '%s'", PlayerInfo[playerid][pName]);
mysql_query(Query);//Queries
mysql_store_result(); //Stores the result

if(mysql_num_rows() > 0) //If the user is found
{
PlayerInfo[playerid][pRegistered] = 1;
PlayerInfo[playerid][pLogged] = 0;

new wdata[128];

while(mysql_retrieve_row()) //it will be running until there are no more rows to be retrieved
{

switch (CURRENT_GAMEMODE)
{

case LOS_SANTOS:
{
mysql_get_field("LsResume",wdata);
PlayerInfo[playerid][pResume] = strval(wdata);
mysql_get_field("LsClassid",wdata);
PlayerInfo[playerid][pClass] = strval(wdata);
}

case LAS_VENTURAS:
{
mysql_get_field("LvResume",wdata);
PlayerInfo[playerid][pResume] = strval(wdata);
mysql_get_field("LvClassid",wdata);
PlayerInfo[playerid][pClass] = strval(wdata);
}

case SAN_FIERRO:
{
mysql_get_field("SfResume",wdata);
PlayerInfo[playerid][pResume] = strval(wdata);
mysql_get_field("SfClassid",wdata);
PlayerInfo[playerid][pClass] = strval(wdata);
}

}

}



}
else
{
PlayerInfo[playerid][pRegistered] = 0;
PlayerInfo[playerid][pLogged] = 0;
PlayerInfo[playerid][pClass] = 0;
PlayerInfo[playerid][pTeam] = TEAM_LAW;
PlayerInfo[playerid][pSkill] = SKILL_COP;
}

mysql_free_result(); //Frees the result


format(string, sizeof(string), "555%d%d%d%d",playerid,random(9),random(9),random( 9));
PlayerInfo[playerid][pPhoneNumber] = strval(string);

RemoveBuildingForPlayer(playerid, 985, 2497.41, 2777.07, 11.5312, 20.0);//Right Gate Of K.A.C.C Military Fuels
RemoveBuildingForPlayer(playerid, 986, 2497.41, 2769.11, 11.5312, 20.0);//Left Gate Of K.A.C.C Military Fuels
//RemoveBuildingForPlayer(playerid, 11014, -2076.4375, -107.9297, 36.9688, 20.0);//Gates Of San Fierro Driving School

//Los Santos
RemoveBuildingForPlayer(playerid, 956, 1634.1487,-2238.2810,13.5077, 20.0); //Snack vender @ LS Airport
RemoveBuildingForPlayer(playerid, 956, 2480.9885,-1958.5117,13.5831, 20.0); //Snack vender @ Sushi Shop in Willowfield
RemoveBuildingForPlayer(playerid, 955, 1729.7935,-1944.0087,13.5682, 20.0); //Sprunk machine @ Unity Station
RemoveBuildingForPlayer(playerid, 955, 2060.1099,-1898.4543,13.5538, 20.0); //Sprunk machine opposite Tony's Liqour in Willowfield
RemoveBuildingForPlayer(playerid, 955, 2325.8708,-1645.9584,14.8270, 20.0); //Sprunk machine @ Ten Green Bottles
RemoveBuildingForPlayer(playerid, 955, 1153.9130,-1460.8893,15.7969, 20.0); //Sprunk machine @ Market
RemoveBuildingForPlayer(playerid, 955,1788.3965,-1369.2336,15.7578, 20.0); //Sprunk machine in Downtown Los Santos
RemoveBuildingForPlayer(playerid, 955, 2352.9939,-1357.1105,24.3984, 20.0); //Sprunk machine @ Liquour shop in East Los Santos
RemoveBuildingForPlayer(playerid, 1775, 2224.3235,-1153.0692,1025.7969, 20.0); //Sprunk machine @ Jefferson Motel
RemoveBuildingForPlayer(playerid, 956, 2140.2566,-1161.7568,23.9922, 20.0); //Snack machine @ pick'n'go market in Jefferson
RemoveBuildingForPlayer(playerid, 956, 2154.1199,-1015.7635,62.8840, 20.0); //Snach machine @ Carniceria El Pueblo in Las Colinas
RemoveBuildingForPlayer(playerid, 956, 662.5665,-551.4142,16.3359, 20.0); //Snack vender at Dillimore Gas Station
RemoveBuildingForPlayer(playerid, 955, 200.2010,-107.6401,1.5513, 20.0); //Sprunk machine @ Blueberry Safe House
RemoveBuildingForPlayer(playerid, 956, 2271.4666,-77.2104,26.5824, 20.0); //Snack machine @ Palomino Creek Library
RemoveBuildingForPlayer(playerid, 955, 1278.5421,372.1057,19.5547, 20.0); //Sprunk machine @ Papercuts in Montgomery
RemoveBuildingForPlayer(playerid, 955, 1929.5527,-1772.3136,13.5469, 20.0); //Sprunk machine @ Idlewood Gas Station

//San Fierro
RemoveBuildingForPlayer(playerid, 1302, -2419.5835,984.4185,45.2969, 20.0); //Soda machine 1 @ Juniper Hollow Gas Station
RemoveBuildingForPlayer(playerid, 1209, -2419.5835,984.4185,45.2969, 20.0); //Soda machine 2 @ Juniper Hollow Gas Station
RemoveBuildingForPlayer(playerid, 956, -2229.2075,287.2937,35.3203, 20.0); //Snack vender @ King's Car Park
RemoveBuildingForPlayer(playerid, 955, -1349.3947,493.1277,11.1953, 20.0); //Sprunk machine @ SF Aircraft Carrier
RemoveBuildingForPlayer(playerid, 956, -1349.3947,493.1277,11.1953, 20.0); //Snack vender @ SF Aircraft Carrier
RemoveBuildingForPlayer(playerid, 955, -1981.6029,142.7232,27.6875, 20.0); //Sprunk machine @ Cranberry Station
RemoveBuildingForPlayer(playerid, 955, -2119.6245,-422.9411,35.5313, 20.0); //Sprunk machine 1/2 @ SF Stadium
RemoveBuildingForPlayer(playerid, 955, -2097.3696,-397.5220,35.5313, 20.0); //Sprunk machine 3 @ SF Stadium
RemoveBuildingForPlayer(playerid, 955, -2068.5593,-397.5223,35.5313, 20.0); //Sprunk machine 3 @ SF Stadium
RemoveBuildingForPlayer(playerid, 955, -2039.8802,-397.5214,35.5313, 20.0); //Sprunk machine 3 @ SF Stadium
RemoveBuildingForPlayer(playerid, 955, -2011.1403,-397.5225,35.5313, 20.0); //Sprunk machine 3 @ SF Stadium
RemoveBuildingForPlayer(playerid, 955, -2005.7861,-490.8688,35.5313, 20.0); //Sprunk machine 3 @ SF Stadium
RemoveBuildingForPlayer(playerid, 955, -2034.5267,-490.8681,35.5313, 20.0); //Sprunk machine 3 @ SF Stadium
RemoveBuildingForPlayer(playerid, 955, -2063.1875,-490.8687,35.5313, 20.0); //Sprunk machine 3 @ SF Stadium
RemoveBuildingForPlayer(playerid, 955, -2091.9780,-490.8684,35.5313, 20.0); //Sprunk machine 3 @ SF Stadium

//Las Venturas
RemoveBuildingForPlayer(playerid, 956, -1455.1298,2592.4138,55.8359, 20.0); //Snack vender @ El Quebrados GONE
RemoveBuildingForPlayer(playerid, 955, -252.9574,2598.9048,62.8582, 20.0); //Sprunk machine @ Las Payasadas GONE
RemoveBuildingForPlayer(playerid, 956, -252.9574,2598.9048,62.8582, 20.0); //Snack vender @ Las Payasadas GONE
RemoveBuildingForPlayer(playerid, 956, 1398.7617,2223.3606,11.0234, 20.0); //Snack vender @ Redsands West GONE
RemoveBuildingForPlayer(playerid, 955, -862.9229,1537.4246,22.5870, 20.0); //Sprunk machine @ The Smokin' Beef Grill in Las Barrancas GONE
RemoveBuildingForPlayer(playerid, 955, -14.6146,1176.1738,19.5634, 20.0); //Sprunk machine @ Fort Carson GONE
RemoveBuildingForPlayer(playerid, 956, -75.2839,1227.5978,19.7360, 20.0); //Snack vender @ Fort Carson GONE
RemoveBuildingForPlayer(playerid, 955, 1519.3328,1055.2075,10.8203, 20.0); //Sprunk machine @ LVA Freight Department GONE
RemoveBuildingForPlayer(playerid, 956, 1659.5096,1722.1096,10.8281, 20.0); //Snack vender near Binco @ LV Airport GONE
RemoveBuildingForPlayer(playerid, 955, 2086.5872,2071.4958,11.0579, 20.0); //Sprunk machine @ Sex Shop on The Strip
RemoveBuildingForPlayer(playerid, 955, 2319.9001,2532.0376,10.8203, 20.0); //Sprunk machine @ Pizza co by Julius Thruway (North)
RemoveBuildingForPlayer(playerid, 955, 2503.2061,1244.5095,10.8203, 20.0); //Sprunk machine @ Club in the Camels Toe
RemoveBuildingForPlayer(playerid, 956, 2845.9919,1294.2975,11.3906, 20.0); //Snack vender @ Linden Station
RemoveBuildingForPlayer(playerid, 956, 2647.6953, 1129.6641, 10.2188, 20.0); //Snack vender @ South East LV Gas Station

//Interiors: 24/7 and Clubs
RemoveBuildingForPlayer(playerid, 1775, 496.0843,-23.5310,1000.6797, 20.0); //Sprunk machine 1 @ Club in Camels Toe
RemoveBuildingForPlayer(playerid, 1775, 501.1219,-2.1968,1000.6797, 20.0); //Sprunk machine 2 @ Club in Camels Toe
RemoveBuildingForPlayer(playerid, 1776, 501.1219,-2.1968,1000.6797, 20.0); //Snack vender @ Club in Camels Toe
RemoveBuildingForPlayer(playerid, 1775, -19.2299,-57.0460,1003.5469, 20.0); //Sprunk machine @ Roboi's type 24/7 stores
RemoveBuildingForPlayer(playerid, 1776, -35.9012,-57.1345,1003.5469, 20.0); //Snack vender @ Roboi's type 24/7 stores
RemoveBuildingForPlayer(playerid, 1775, -17.0036,-90.9709,1003.5469, 20.0); //Sprunk machine @ Other 24/7 stores
RemoveBuildingForPlayer(playerid, 1776, -17.0036,-90.9709,1003.5469, 20.0); //Snach vender @ Others 24/7 stores
RemoveBuildingForPlayer(playerid, 1775, -32.4453, -186.6953, 1003.6328, 20.0); //Sprunk machine @ Other 24/7 store
RemoveBuildingForPlayer(playerid, 1776, -33.8750, -186.7656, 1003.6328, 20.0); //Snach vender @ Others 24/7 stores
RemoveBuildingForPlayer(playerid, 1775, -35.7266, -140.2266, 1003.6328, 20.0); //Sprunk machine @ Other 24/7 store
RemoveBuildingForPlayer(playerid, 1776, -16.5313, -140.2969, 1003.6328, 20.0); //Snach vender @ Others 24/7 stores
RemoveBuildingForPlayer(playerid, 1775, -15.1016, -140.2266, 1003.6328, 20.0); //Sprunk machine @ Other 24/7 store

RemoveBuildingForPlayer(playerid, 2778, -18.2734, -140.2734, 1002.5859, 20.0); //Video Game machine @ Other 24/7 store
RemoveBuildingForPlayer(playerid, 2681, -34.1953, -140.2734, 1002.5859, 20.0); //Video Game machine @ Other 24/7 store

//Interiors: Planning Department
RemoveBuildingForPlayer(playerid, 1776, 330.6797, 178.5000, 1020.0703, 20.0); //Snach vender @ Planning Dept
RemoveBuildingForPlayer(playerid, 1776, 331.9219, 178.5000, 1020.0703, 20.0); //Snach vender @ Planning Dept
RemoveBuildingForPlayer(playerid, 1776, 371.5938, 178.4531, 1020.0703, 20.0); //Snach vender @ Planning Dept
RemoveBuildingForPlayer(playerid, 1776, 361.5625, 158.6172, 1008.4766, 20.0); //Snach vender @ Planning Dept
RemoveBuildingForPlayer(playerid, 1776, 374.8906, 188.9766, 1008.4766, 20.0); //Snach vender @ Planning Dept
RemoveBuildingForPlayer(playerid, 1776, 350.9063, 206.0859, 1008.4766, 20.0); //Snach vender @ Planning Dept

//Interiors: Caligulas Casino Basement
RemoveBuildingForPlayer(playerid, 1776, 2155.8438, 1607.8750, 1000.0625, 20.0); //Snach vender @ caligulas Basement
RemoveBuildingForPlayer(playerid, 1776, 2222.3672, 1602.6406, 1000.0625, 20.0); //Snach vender @ caligulas Basement
RemoveBuildingForPlayer(playerid, 1776, 2202.4531, 1617.0078, 1000.0625, 20.0); //Snach vender @ caligulas Basement
RemoveBuildingForPlayer(playerid, 1776, 2209.2422, 1621.2109, 1000.0625, 20.0); //Snach vender @ caligulas Basement
RemoveBuildingForPlayer(playerid, 1775, 2222.2031, 1606.7734, 1000.0547, 20.0); //Sprunk vender @ caligulas Basement
RemoveBuildingForPlayer(playerid, 1775, 2209.9063, 1607.1953, 1000.0547, 20.0); //Sprunk vender @ caligulas Basement
RemoveBuildingForPlayer(playerid, 1775, 2155.9063, 1606.7734, 1000.0547, 20.0); //Sprunk vender @ caligulas Basement

//Interiors: Big Smokes Crack Palace
RemoveBuildingForPlayer(playerid, 1775, 2576.7031, -1284.4297, 1061.0938, 20.0); //Sprunk vender

//Interiors: Donut Shop
RemoveBuildingForPlayer(playerid, 1776, 379.0391, -178.8828, 1000.7344, 20.0); //Snach vender @ donut shop
RemoveBuildingForPlayer(playerid, 1775, 373.8281, -178.1406, 1000.7344, 20.0); //Sprunk vender @ donut shop

//Interiors: Ammunation
RemoveBuildingForPlayer(playerid, 1977, 316.8750, -140.3516, 998.5859, 20.0); //Useless Box @ Ammunation



if(CHRISTMAS == 1)
{
//for(new o=0; o<60; o++) CreatePlayerObject(playerid,354,0,0,0,0,0,0);
}

}// End of NPC Check



return 1;
}
//================================================== ============================
Reply
#5

Either Junkbuster is kicking you or the server is not able to find your ip in the database and is kicking you.
Reply
#6

Regarding your PM to me:

Control+f "kick(" or "ban(" (not just in this thread) and surrounding code is likely where the problem lies.
Reply
#7

it worked thanks
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)