My server get down when is on more than 4 players
#1

My server get down when is on more than 4 players. PLease help !!!
Reply
#2

There will be a problem with your code I guess. Hard to solve things like this.
Show your onplayerconnect
Reply
#3

Go to line 385 and delete the last ) of the line, replace it with a ']'
...

We cant do anything, if you do not post a single line of your code, or do you think we are seers? So post at least your OnPlayerConnect, or better the whole script, if you have no idea where the server crashes.
Reply
#4

Код:
public OnPlayerConnect(playerid)
{
	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)
		{
		    Kick(playerid);
		}
	}
	clock()
	burnout[playerid]=0;
	TextDrawShowForPlayer(playerid, Textdraw3);
    TextDrawShowForPlayer(playerid, Textdraw0);
    new plname[MAX_PLAYER_NAME];
    GetPlayerName(playerid, plname, sizeof(plname));
	if(Security != 0)
	{
	    SendClientMessage(playerid, COLOR_YELLOW, "Host has broken one of the Agreement rules, action has been taken.");
	    Kick(playerid);
	    return 1;
	}
    /*new namestring = strfind(plname, "_", true);
 	if(namestring == -1)
	{
		SendClientMessage(playerid, COLOR_YELLOW2, "SERVER: Your name must be in the format Firstname_Lastname.");
		Kick(playerid);
		return 1;
	}*/
	//
	
	new Country[256];
	GetPlayerCountry(playerid,Country);
	new mess[256],IP[256];
	GetPlayerIp(playerid,IP,sizeof(IP));
	format(mess,sizeof(mess),"%s a intrat pe server.[Tara: %s |IP Address: %s |Ping: %i ]",plname,Country,IP,GetPlayerPing(playerid));
	printf(mess);
	ABroadCast(COLOR_YELLOW,mess,1);
	printf(mess);
	gActivePlayers[playerid]++;
	numplayers++;
	new string[MAX_PLAYER_NAME];
	veh1[playerid] = 999; veh2[playerid] = 999; veh3[playerid] = 999; veh4[playerid] = 999; veh5[playerid] = 999;
	SelectChar[playerid] = 0; HidePM[playerid] = 0; PhoneOnline[playerid] = 0;
	SelectCharID[playerid] = 0; SelectCharPlace[playerid] = 0; ChosenSkin[playerid] = 0;
	GettingJob[playerid] = 0;
	KickPlayer[playerid] = 0; UsedFind[playerid] = 0;
	CP[playerid] = 0; LCP[playerid] = 0; VCP[playerid] = 0; Robbed[playerid] = 0; SpawnChange[playerid] = 1;
	CarOffer[playerid] = 999; CarPrice[playerid] = 0; CarID[playerid] = 0;
	RobbedTime[playerid] = 0; MoneyMessage[playerid] = 0; Condom[playerid] = 0; Rope[playerid] = 0;
	STDPlayer[playerid] = 0; FishWait[playerid] = 0; SignalWait[playerid] = 0; TeleWait[playerid] = 0; Kerchief[playerid] = false;
	FakeDriv[playerid] = false; FakeFly[playerid] = false; FakeWep[playerid] = false;
	RepairOffer[playerid] = 999; RepairPrice[playerid] = 0; RepairCar[playerid] = 0;
	ColorOffer[playerid]=999; ColorPrice[playerid]=0; ColorKind[playerid]=0; ColorCar[playerid]=0;
	TalkingLive[playerid] = 255; LiveOffer[playerid] = 999; TakingLesson[playerid] = 0;
	RefillOffer[playerid] = 999; RefillPrice[playerid] = 0; MapIconsShown[playerid] = 0;
	DrugOffer[playerid] = 999; PlayerCuffed[playerid] = 0; PlayerCuffedTime[playerid] = 0;
	DrugPrice[playerid] = 0; RegistrationStep[playerid] = 0; RegistrationQuestion[playerid] = 0; OnCK[playerid] = 999; GettingCK[playerid] = 999;
	DrugGram[playerid] = 0; ConnectedToPC[playerid] = 0; OrderReady[playerid] = 0; DrugKind[playerid] = 0;
	JailPrice[playerid] = 0; MedicTime[playerid] = 0; NeedMedicTime[playerid] = 0; MedicBill[playerid] = 0; GotHit[playerid] = 0;
	WantedPoints[playerid] = 0; GoChase[playerid] = 999; GetChased[playerid] = 999; PlacedNews[playerid] = 0;
	OnDuty[playerid] = 0; WantedLevel[playerid] = 0;
	BoxWaitTime[playerid] = 0; SchoolSpawn[playerid] = 0; ChangePos2[playerid][1] = 0;
	SafeTime[playerid] = 60; TransportDuty[playerid] = 0; PlayerTied[playerid] = 0;
	BusCallTime[playerid] = 0; TaxiCallTime[playerid] = 0; MedicCallTime[playerid] = 0; MechanicCallTime[playerid] = 0;
	BusrouteEast[playerid][0] = 0; BusrouteWest[playerid][0] = 0; BusShowLocation[playerid][0] = 0; BusShowLocationC[playerid] = 0;
	FindTimePoints[playerid] = 0; FindTime[playerid] = 0; JobDuty[playerid] = 0;
	Mobile[playerid] = 255; Music[playerid] = 0; BoxOffer[playerid] = 999; PlayerBoxing[playerid] = 0; BoxBet[playerid] = 0;
	Spectate[playerid] = 255; //PlayerDrunk[playerid] = 0; PlayerDrunkTime[playerid] = 0;
	Unspec[playerid][sLocal] = 255; FishCount[playerid] = 0;
	ScriptMoney[playerid] = 0; ScriptMoneyUpdated[playerid] = 0;
	for (new c=0; c<13; c++) ScriptWeapons[playerid][c] = 0;
	ScriptWeaponsUpdated[playerid] = 0; Specing[playerid] = 0;
    gLastCar[playerid] = 0; FirstSpawn[playerid] = 1;
	gOoc[playerid] = 0; gNews[playerid] = 0; BigEar[playerid] = 0; gDice[playerid] = 0; gFam[playerid] = 0; gCFam[playerid]=0;
	gSpeedo[playerid] = 0; gGas[playerid] = 1;
	gPlayerLogged[playerid] = 0; AC_gPlayerLoggedx(playerid,0); gPlayerLogTries[playerid] = 0; gPlayerAccount[playerid] = 0;
	gPlayerSpawned[playerid] = 0; PlayerKarting[playerid] = 0; PlayerInKart[playerid] = 0;
	PlayerTazeTime[playerid] = 0; PlayerStoned[playerid] = 0;
	StartTime[playerid] = 0; TicketOffer[playerid] = 999; TicketMoney[playerid] = 0;
	MatsHolding[playerid] = 0; TutTime[playerid] = 0; IsOnUnderCover[playerid]=false; SeatBelt[playerid]=false;
	TaxiAccepted[playerid] = 999; BusAccepted[playerid] = 999; Trace[playerid]=999; DTracker[playerid] = 999; DMole[playerid] = 999;
	PlayerInfo[playerid][pCash] = dollah; NoFuel[playerid] = 0;
	HireCar[playerid] = 299; GangCar[playerid] = 512; dying[playerid] = 0;
	TransportValue[playerid] = 0; TransportMoney[playerid] = 0; TransportTime[playerid] = 0; TransportCost[playerid] = 0; TransportDriver[playerid] = 999;
	Locator[playerid] = 0;
	WatchingTV[playerid] = 0; PlayerPaintballing[playerid] = 0; PlayerPaintballKills[playerid] = 0;
	ProposeOffer[playerid] = 999; MarryWitness[playerid] = 999; MarryWitnessOffer[playerid] = 999; MarriageCeremoney[playerid] = 0; ProposedTo[playerid] = 999; GotProposedBy[playerid] = 999; DivorceOffer[playerid] = 999;
	PizzaCallTime[playerid] = 0; bPizza[playerid] = 0; sPizza[playerid] = 0; FarmerVar[playerid] = 0; FarmerPickup[playerid][0] = 0; SmugglerWork[playerid] = 0; SmuggledDrugs[playerid] = 0; JustDied[playerid] = 0; KnockedDown[playerid] = 0; UnidentifedCall[playerid] = 0;
	LicenseOffer[playerid] = 999; LicensePrice[playerid] = 0; LicenseType[playerid] = 0; UsingDrugs[playerid] = 0; AfterTutorial[playerid] = 0;
	BlindFold[playerid] = 0; PlayerIsSweeping[playerid] = 0;PlayerIsGarbageing[playerid] = 0; PlayerIsDozering[playerid] = 0; AdminDuty[playerid] = 0; PlayerNeedsHelp[playerid] = 0; AdminSpec[playerid] = 0; IsSmoking[playerid] = 0; UsingSmokeAnim[playerid] = 0; ReduceTime[playerid] = 0;
	CreatingGun[playerid] = 0; CreatingGunAmmo[playerid] = 0; CreatingGunPrice[playerid] = 0; IsPuttingMaterials[playerid] = 0; IsTakingGun[playerid] = 0; lseconds[playerid]=60;
	InAFoodPlace[playerid] = 0;
	PlayerInfo[playerid][pLevel] = 0;
	PlayerInfo[playerid][pAdmin] = 0;
	PlayerInfo[playerid][pDonateRank] = 0;
	PlayerInfo[playerid][pBMX] = 0;
	PlayerInfo[playerid][gPupgrade] = 0;
	PlayerInfo[playerid][pConnectTime] = 0;
	PlayerInfo[playerid][pReg] = 0;
	PlayerInfo[playerid][pSex] = 0;
	PlayerInfo[playerid][pAge] = 0;
	PlayerInfo[playerid][pOrigin] = 0;
	PlayerInfo[playerid][pExp] = 0;
	PlayerInfo[playerid][pAccount] = 0;
	PlayerInfo[playerid][pCrimes] = 0;
	PlayerInfo[playerid][pDeaths] = 0;
	PlayerInfo[playerid][pArrested] = 0;
	PlayerInfo[playerid][pWantedDeaths] = 0;
	PlayerInfo[playerid][pPhoneBook] = 0;
	PlayerInfo[playerid][pLottoNr] = 0;
	PlayerInfo[playerid][pJob] = 0;
	PlayerInfo[playerid][pPayCheck] = 0;
	PlayerInfo[playerid][pHeadValue] = 0;
	PlayerInfo[playerid][pJailed] = 0;
	PlayerInfo[playerid][pJailCell] = 0;
	PlayerInfo[playerid][pJailTime] = 0;
	PlayerInfo[playerid][pMats] = 0;
	PlayerInfo[playerid][pWeed] = 0;
	PlayerInfo[playerid][pCocaine] = 0;
	PlayerInfo[playerid][pLSD] = 0;
	PlayerInfo[playerid][pHeroin] = 0;
	PlayerInfo[playerid][pMorphine] = 0;
	PlayerInfo[playerid][pLeader] = 0;
	PlayerInfo[playerid][pMember] = 0;
	PlayerInfo[playerid][pFMember] = 0;
	PlayerInfo[playerid][pFLeader] = 0;
	PlayerInfo[playerid][pRank] = 0;
	PlayerInfo[playerid][pContractTime] = 0;
	PlayerInfo[playerid][pBoxSkill] = 0;
	PlayerInfo[playerid][pSHealth] = 0.0;
	PlayerInfo[playerid][pHealth] = 50.0;
    PlayerInfo[playerid][pPos_x] = 1612.3240;
	PlayerInfo[playerid][pPos_y] = -2330.1670;
	PlayerInfo[playerid][pPos_z] = 13.5469;
	PlayerInfo[playerid][pInt] = 0;
	PlayerInfo[playerid][pLocal] = 255;
	PlayerInfo[playerid][pTeam] = 3;
	PlayerInfo[playerid][pModel] = 7;
	new randphone = 100000 + random(899999);//minimum 1000  max 9999 //giving one at the start
	PlayerInfo[playerid][pPnumber] = randphone;
	PlayerInfo[playerid][pPcarkey] = 0;
	PlayerInfo[playerid][pPcarkey2] = 0;
	PlayerInfo[playerid][pPcarkey3] = 0;
	PlayerInfo[playerid][pPhousekey] = 255;
	PlayerInfo[playerid][pGangKey] = 255;
	PlayerInfo[playerid][pPbiskey] = 255;
	PlayerInfo[playerid][pCarLic] = 0;
	PlayerInfo[playerid][pFlyLic] = 0;
	PlayerInfo[playerid][pGunLic] = 0;
	PlayerInfo[playerid][pGun1] = 0;
	PlayerInfo[playerid][pGun2] = 0;
	PlayerInfo[playerid][pGun3] = 0;
	PlayerInfo[playerid][pGun4] = 0;
	PlayerInfo[playerid][pGun5] = 0;
	PlayerInfo[playerid][pAmmo1] = 0;
	PlayerInfo[playerid][pAmmo2] = 0;
	PlayerInfo[playerid][pAmmo3] = 0;
	PlayerInfo[playerid][pAmmo4] = 0;
	PlayerInfo[playerid][pAmmo5] = 0;
	PlayerInfo[playerid][pCarTime] = 0;
	PlayerInfo[playerid][pPayDay] = 0;
	PlayerInfo[playerid][pPayDayPU] = 0;
	PlayerInfo[playerid][pPayDayHad] = 0;
	PlayerInfo[playerid][pWatch] = 0;
	PlayerInfo[playerid][pCrashed] = 0;
	PlayerInfo[playerid][pWins] = 0;
	PlayerInfo[playerid][pLoses] = 0;
	PlayerInfo[playerid][pAlcoholPerk] = 0;
	PlayerInfo[playerid][pDrugPerk] = 0;
	PlayerInfo[playerid][pMiserPerk] = 0;
	PlayerInfo[playerid][pPainPerk] = 0;
	PlayerInfo[playerid][pTraderPerk] = 0;
	PlayerInfo[playerid][pTut] = 0;
	PlayerInfo[playerid][pWarns] = 0;
	PlayerInfo[playerid][pFuel] = 0;
    PlayerInfo[playerid][pGasCan] = 0;
    PlayerInfo[playerid][pSwat] = 0;
	PlayerInfo[playerid][pVirWorld] = 0;
	PlayerInfo[playerid][pRequestingBackup] = 0;
	PlayerInfo[playerid][pRoadblock] = 0;
	PlayerInfo[playerid][pFishTool] = 0;
	strmid(PlayerInfo[playerid][pNote1], "None", 0, strlen("None"), 255);
	PlayerInfo[playerid][pNote1s] = 0;
	strmid(PlayerInfo[playerid][pNote2], "None", 0, strlen("None"), 255);
	PlayerInfo[playerid][pNote2s] = 0;
	strmid(PlayerInfo[playerid][pNote3], "None", 0, strlen("None"), 255);
	PlayerInfo[playerid][pNote3s] = 0;
	strmid(PlayerInfo[playerid][pNote4], "None", 0, strlen("None"), 255);
	PlayerInfo[playerid][pNote4s] = 0;
	strmid(PlayerInfo[playerid][pNote5], "None", 0, strlen("None"), 255);
	PlayerInfo[playerid][pNote5s] = 0;
	PlayerInfo[playerid][pLighter] = 0;
	PlayerInfo[playerid][pCigarettes] = 0;
	PlayerInfo[playerid][pMask] = 0;
	PlayerInfo[playerid][pMaskuse] = 0;
	PlayerInfo[playerid][pHideNumber] = 0;
	PlayerInfo[playerid][pSpeaker] = 0;
	PlayerInfo[playerid][pLocked] = 0;
	PlayerInfo[playerid][pWT] = 0;
	PlayerInfo[playerid][pWTc] = 0;
	strmid(PlayerInfo[playerid][pAccent], "None", 0, strlen("None"), 255);
	strmid(PlayerInfo[playerid][pPrisonDate], "00/00/00", 0, strlen("00/00/00"), 255);
	strmid(PlayerInfo[playerid][pFakeName], "None", 0, strlen("None"), 255);
	PlayerInfo[playerid][pDrivWarn] = 0;
	PlayerInfo[playerid][pGenWarn] = 0;
	PlayerInfo[playerid][pLang1] = 0;
	PlayerInfo[playerid][pLang2] = 0;
    new str[256];
    GetPlayerName(playerid, plname, sizeof(plname));
	format(str, sizeof(str), "Vehicles/Players/%s.cfg", plname);
	if(dini_Exists(str))
	{
	    strmid(PlayerVehicle[playerid][pVeh1], dini_Get(str, "Vehicle1"), 0, strlen(dini_Get(str, "Vehicle1")), 255);
	    strmid(PlayerVehicle[playerid][pVeh2], dini_Get(str, "Vehicle2"), 0, strlen(dini_Get(str, "Vehicle2")), 255);
	    strmid(PlayerVehicle[playerid][pVeh3], dini_Get(str, "Vehicle3"), 0, strlen(dini_Get(str, "Vehicle3")), 255);
	    strmid(PlayerVehicle[playerid][pVeh4], dini_Get(str, "Vehicle4"), 0, strlen(dini_Get(str, "Vehicle4")), 255);
	    strmid(PlayerVehicle[playerid][pVeh5], dini_Get(str, "Vehicle5"), 0, strlen(dini_Get(str, "Vehicle5")), 255);
	    pToolkit[playerid] = dini_Int(str, "Toolkit");
		//return 1;
	}
	else
	{
	    dini_Create(str);
	    strmid(PlayerVehicle[playerid][pVeh1], "None", 0, strlen("None"), 255);
	    strmid(PlayerVehicle[playerid][pVeh2], "None", 0, strlen("None"), 255);
	    strmid(PlayerVehicle[playerid][pVeh3], "None", 0, strlen("None"), 255);
	    strmid(PlayerVehicle[playerid][pVeh4], "None", 0, strlen("None"), 255);
	    strmid(PlayerVehicle[playerid][pVeh5], "None", 0, strlen("None"), 255);
	    //return 1;
	}
	for(new iv = 0; iv < MAX_VEHICLES; iv++)
	{
		if(VehicleInfo[iv][vOwned] == 1)
		{
		    if(!strcmp(plname, VehicleInfo[iv][vOwner], true))
			{
			    format(str, sizeof(str), "%s.%s", plname, VehicleNames[GetVehicleModel(iv)-400]);
				if(strcmp(str, PlayerVehicle[playerid][pVeh1], true) == 0)
				{
					veh1[playerid] = iv;
				}
				else if(strcmp(str, PlayerVehicle[playerid][pVeh2], true) == 0)
				{
				    veh2[playerid] = iv;
				}
				else if(strcmp(str, PlayerVehicle[playerid][pVeh3], true) == 0)
				{
				    veh3[playerid] = iv;
				}
				else if(strcmp(str, PlayerVehicle[playerid][pVeh4], true) == 0)
				{
				    veh4[playerid] = iv;
				}
				else if(strcmp(str, PlayerVehicle[playerid][pVeh5], true) == 0)
				{
				    veh5[playerid] = iv;
				}
				break ;
			}
		}
	}
	pColor[playerid] = -1;
	pToAccept[playerid] = 255;
	vToAccept[playerid] = 999;
	prToAccept[playerid] = 0;
	ClearCrime(playerid);
	ClearGroceries(playerid);
	ClearMarriage(playerid);
	SetPlayerColor(playerid,COLOR_GRAD2);
	HouseEntered[playerid] = 255;
	BizEntered[playerid] = 255;
	//map icons
    SetPlayerMapIcon(playerid, 1, 1220.6315,-1812.1742,16.5938, 55, COLOR_YELLOW);  // Driving School
    SetPlayerMapIcon(playerid, 5, 396.2429, -2074.728, 7.835938, 25, COLOR_YELLOW);  // Fishing School
    SetPlayerMapIcon(playerid, 6, 1528.779, -1678.113, 5.890625, 30, COLOR_YELLOW);  // Police Station
    SetPlayerMapIcon(playerid, 7, 595.2537,-1249.9132,18.2637, 52, COLOR_YELLOW);  // Bank
    SetPlayerMapIcon(playerid, 9, 1178.03, -1323.41, 14.10, 22, COLOR_YELLOW);  // Hospital
    SetPlayerMapIcon(playerid, 11, 2410.1682,-1220.7765,25.2978, 49, COLOR_YELLOW);	// Pig Pen
    SetPlayerMapIcon(playerid, 12, 2312.9451,-1645.0206,14.8270, 49, COLOR_YELLOW);	// Ten Green
    SetPlayerMapIcon(playerid, 14, 1498.4476,-1582.8242,13.5469, 50, COLOR_YELLOW);	// Restaurant
    SetPlayerMapIcon(playerid, 15, 2468.4919,-2092.9902,13.5469, 51, COLOR_YELLOW);	// Truck Place
    SetPlayerMapIcon(playerid, 16, 2146.3523,-2267.7498,14.2344, 18, COLOR_YELLOW);	// Gun Dealer Reg.
	SetPlayerMapIcon(playerid, 21, 2105.4858,-1806.4725,13.5547, 29, COLOR_YELLOW);	// Pizza stack
	SetPlayerMapIcon(playerid, 22, 2229.9011,-1721.2582,13.5613, 54, COLOR_YELLOW);	// Gym
	SetPlayerMapIcon(playerid, 23, 2244.3423,-1665.5542,15.4766, 45, COLOR_YELLOW);	// Binco
	SetPlayerMapIcon(playerid, 27, 816.6108,856.7028,12.7891, 11, COLOR_YELLOW);	// Dozer
	GetPlayerName(playerid, plname, sizeof(plname));
	format(string, sizeof(string), "users/%s.ini", plname);
    SendClientMessage(playerid, COLOR_YELLOW2, "RolePlay Script v0.3c se incarca.");
    AC_OnPlayerConnect(playerid);
    UpdateID();
    if(!fexist(string))
	{
		gPlayerAccount[playerid] = 0;
	}
	else if(fexist(string))
	{
		gPlayerAccount[playerid] = 1;
	}
	new string3[256];
	format(string3, sizeof(string3), "pLogs/%s.admin.log", plname);
    if(!fexist(string3))
		fcreate(string3);
    format(string3, sizeof(string3), "pLogs/%s.crime.log", plname);
    if(!fexist(string3))
		fcreate(string3);
	return 1;
}
Reply
#5

Someone knows the problem?
Reply
#6

You have the pLogs folder?

BTW Dont lose time on this shitty rp's edit,make you own.
Reply
#7

Quote:
Originally Posted by Kaylux
Посмотреть сообщение
There will be a problem with your code I guess. Hard to solve things like this.
Show your onplayerconnect
What a bullshit, you seriously don't know.
Reply
#8

OnPlayerconnect is the problem?
Reply
#9

CoLLy your OnPlayerUpdate is terribly at fault, to fix this make a callback ongamemodeinit make a timer calling that function every lets say 30 seconds looping thru all the players aswell as use something like DINI or y_ini, for example

pawn Код:
forward SaveAccounts();

public OnGameModeInit()
{
SetTimer("SaveAccounts", 30000, 1);
return 1;
}

public SaveAccounts()
{
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
    if(IsPlayerConnected(playerid))
    {
        if(gPlayerLogged[playerid])
        {
            new string3[64];
            new playername3[MAX_PLAYER_NAME];
            GetPlayerName(playerid, playername3, sizeof(playername3));
            format(string3, sizeof(string3), "users/%s.ini", playername3);
            if(dini_Exists(string3))
            {
                new var[64];
                dini_IntSet(string3, "Key", PlayerInfo[playerid][pKey]);
                PlayerInfo[playerid][pCash] = GetCash(playerid);
                dini_IntSet(string3, "Level", PlayerInfo[playerid][pLevel]);
                dini_IntSet(string3, "AdminLevel", PlayerInfo[playerid][pAdmin]);
                dini_IntSet(string3, "DonateRank", PlayerInfo[playerid][pDonateRank]);
                dini_IntSet(string3, "BMX", PlayerInfo[playerid][pBMX]);
                dini_IntSet(string3, "Upgrade", PlayerInfo[playerid][gPupgrade]);
Continue the rest of the dini_IntSet and dini_Set till everyone of them is done, then try it, this will not only reduce lag but let more players actually join w/o a crash, never use SA-MP fwrite fopen etc function, they made my server crash when ppl even talked or connected...



Also I Just Helped Yet Another GF Edit Server D:
Reply
#10

Thanks man buy it's an convertor or something?I must make it manually?
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)