Getting problem with playerid (0)
#10

savePlayerstats function:
Код:
public saveStats()
{
	for(new i = 0; i < MAX_PLAYERS; i++)
	{
		if(IsPlayerConnected(i) && playerData[i][playerLoggedIn])
		{
			savePlayerStats(i);
		}
	}
}
ClearStats function:
Код:
stock ClearStats(playerid)
{
	if (playerData[playerid][playerLoggedIn])
	{
		forceRobberyCancel(playerid);

		// Reset main stats
		playerData[playerid][playerLevel] 			= 0;
		playerData[playerid][playerMoney]			= 0;
		playerData[playerid][playerBank]			= 0;
		playerData[playerid][playerScore]			= 0;
		playerData[playerid][playerXP]				= 0;
		playerData[playerid][playerIP]				= 0;
		playerData[playerid][playerInterior]		= 0;
		playerData[playerid][playerVWorld]			= 0;
		playerData[playerid][playerJailTime] 		= 0;
		playerData[playerid][playerMuteTime] 		= 0;
		playerData[playerid][playerCheckpointTime]	= 0;
		playerData[playerid][playerRobTime]			= 0;
		playerData[playerid][playerSafeObj]			= 0;
		playerData[playerid][playerClass]			= 0;
		playerData[playerid][playerWantedLevel]     = 0;
		playerData[playerid][playerVIPLevel]		= 0;
		playerData[playerid][playerRope]			= 0;
		playerData[playerid][playerJailKit]			= 0;
		playerData[playerid][playerScissors]		= 0;
		playerData[playerid][playerButtPlug]		= 0;
		playerData[playerid][playerBiggerPockets]	= 0;
		playerData[playerid][playerSecureWallet]	= 0;
		playerData[playerid][playerCourierLevel]    = 0;
		playerData[playerid][playerBanned]          = 0;
		playerData[playerid][playerLastVehicleID]   = 0;
		playerData[playerid][playerWarnings]        = 0;
		playerData[playerid][playerHelper]			= 0;
		playerData[playerid][playerWeed]			= 0;
		playerData[playerid][playerExplosives]		= 0;
		playerData[playerid][vipWeapon]             = 0;
		playerData[playerid][innocentKills]			= 0;
		playerData[playerid][aInnocentKills]		= 0;
		playerData[playerid][healthInsurance]		= 0;

		// Reset stats
		playerData[playerid][playerKills]			= 0;
		playerData[playerid][playerDeaths]			= 0;
		playerData[playerid][playerRobberies]		= 0;
		playerData[playerid][playerTimesJailed]		= 0;
		playerData[playerid][copArrests]			= 0;
		playerData[playerid][rulesRead]				= 0;
		playerData[playerid][streetRobberies] 		= 0;
		playerData[playerid][streetRapes] 			= 0;
		playerData[playerid][playersTied] 			= 0;
		playerData[playerid][playersKidnapped] 		= 0;
		playerData[playerid][copDetains]			= 0;
		playerData[playerid][copKills]				= 0;
		playerData[playerid][forkliftCompleted]		= 0;
		playerData[playerid][bankRobs]				= 0;
		playerData[playerid][bombsDefused]			= 0;

		// Reset Jobs
		playerData[playerid][lastCarDrop]			= -1;
		playerData[playerid][playerJob]				= -1;

		// Reset ID systems
		playerData[playerid][playerLastTicket] 		= -1;
		playerData[playerid][playerBailTo] 			= -1;
		playerData[playerid][playerBailPrice] 		= -1;
		playerData[playerid][playerAdminJailed] 	= -1;
		playerData[playerid][playerGunOffer] 		= -1;
		playerData[playerid][playerGunDealer] 		= -1;
		playerData[playerid][playerHousePass]       = -1;
		playerData[playerid][lastRecipient]         = -1;
		playerData[playerid][playerCustomSkin]		= -1;
		playerData[playerid][vehicleMenu]			= -1;
		playerData[playerid][playerStoreID]			= 0;
		playerData[playerid][playerCheckID]         = 0;
		playerData[playerid][playerInsideHouse]     = 0;
		playerData[playerid][playerInsideBusiness]  = 0;
		playerData[playerid][adDetected]			= 0;
		playerData[playerid][shotWarnings]			= 0;
		playerData[playerid][cbugWarnings]			= 0;
		playerData[playerid][carSwing]				= 0;

		// Reset Trucking
		if (playerData[playerid][truckingStatus] > 0)
		{
			DestroyDynamicRaceCP(playerData[playerid][truckingCheckpoint]);
		}

		playerData[playerid][truckingStatus]        = -1;
		playerData[playerid][truckingMission]       = -1;

		playerData[playerid][playerMissionCPTime] 	= 0;

		// Reset Forklift
		if (playerData[playerid][forkliftStatus] > 0)
		{
			DestroyObject(playerData[playerid][forkliftObject]);
		}

		playerData[playerid][forkliftStatus]		= -1;
		playerData[playerid][forkliftDamage]		= -1;

		// Reset Bus

		if (playerData[playerid][busStatus] > 0)
		{
			DestroyDynamicRaceCP(playerData[playerid][busCP]);
		}

		playerData[playerid][busStatus] 			= -1;

		// Reset Sweeper

		if (playerData[playerid][sweepStatus] > 0)
		{
			DestroyDynamicRaceCP(playerData[playerid][sweepCP]);
		}

		// Reset medic
		if (playerData[playerid][medicStatus] > 0)
		{
			playerData[playerid][medicStatus] = -1;
			playerData[playerid][medicMission] = -1;

			RemovePlayerMapIcon(playerid, 69);
			DestroyDynamicRaceCP(playerData[playerid][medicCheckpoint]);
		}

		playerData[playerid][sweepStatus] 			= -1;

		// Reset DM
		playerData[playerid][dmStreak] 			= 0;

		// Reset booleans
		playerData[playerid][playerGangID]			= INVALID_GANG_ID;
		playerData[playerid][hasSTD] 				= false;
		playerData[playerid][isInEvent]             = false;
		playerData[playerid][playerPingImmune]      = false;
		playerData[playerid][hasSpawned]            = false;
		playerData[playerid][playerLoggedIn] 		= false;
		playerData[playerid][playerAdminDuty]		= false;
		playerData[playerid][playerCanTaze]			= false;
		playerData[playerid][playerCanCuff]			= false;
		playerData[playerid][playerCanArrest]		= false;
		playerData[playerid][playerCanEMP]			= false;
		playerData[playerid][playerIsTazed]			= false;
		playerData[playerid][playerIsCuffed]		= false;
		playerData[playerid][playerIsInHouse]		= false;
		playerData[playerid][playerHitmarker]		= false;
		playerData[playerid][playerCanRape]			= false;
		playerData[playerid][playerCanRob]			= false;
		playerData[playerid][playerCanRepair]		= false;
		playerData[playerid][adminWeapon]			= false;
		playerData[playerid][pEnterHouse]			= false;
		playerData[playerid][showALog]              = false;
		playerData[playerid][iscourier]             = false;
		playerData[playerid][pmSpy]            		= false;
		playerData[playerid][isBanned]              = false;
		playerData[playerid][playerBeenBanned]      = false;
		playerData[playerid][playerDied]	        = false;
		playerData[playerid][suicide] 				= false;
		playerData[playerid][vipColour]				= false;
		playerData[playerid][isInDM]				= false;
		playerData[playerid][hasBackpack] 			= false;
		playerData[playerid][hasParrot] 			= false;
		playerData[playerid][luckyCharm] 			= false;
		playerData[playerid][weaponSkill]			= false;
		playerData[playerid][playerDefuseKit]		= false;
		playerData[playerid][allowSpec]				= true;
		playerData[playerid][canEscape]				= true;

		playerData[playerid][canAsk] 				= true;
		playerData[playerid][canReport] 			= true;
		playerData[playerid][useAdminName]			= false;

		if (playerData[playerid][vSellTo] != -1)
		{
			// Remove the sale
			new sellto = playerData[playerid][vSellTo];
			playerData[sellto][vBuyFrom] = -1;
			SendClientMessage(sellto, COLOR_WHITE, "{B7B7B7}[SERVER] {FFFFFF}The vehicle offer has expired, the seller has quit.");
		}

		if (playerData[playerid][vBuyFrom] != -1)
		{
			// Remove the sale
			new buyfrom = playerData[playerid][vBuyFrom];
			playerData[buyfrom][vSellTo] = -1;
			SendClientMessage(buyfrom, COLOR_WHITE, "{B7B7B7}[SERVER] {FFFFFF}The vehicle offer has expired, the buyer has quit.");
		}

		// Progress Bars
		if (GetProgressBarValue(playerData[playerid][breakin]) != INVALID_BAR_VALUE)
		{
			DestroyProgressBar(playerData[playerid][breakin]);
		}

		DestroyProgressBar(playerData[playerid][robbery]);
	}
}
Reply


Messages In This Thread
Getting problem with playerid (0) - by GuthiX - 23.05.2016, 15:03
Re: Getting problem with playerid (0) - by Micko123 - 23.05.2016, 15:06
Re: Getting problem with playerid (0) - by Dayrion - 23.05.2016, 15:30
Re: Getting problem with playerid (0) - by GuthiX - 23.05.2016, 16:22
Re: Getting problem with playerid (0) - by GuthiX - 24.05.2016, 04:42
Re: Getting problem with playerid (0) - by GuthiX - 24.05.2016, 18:08
Re: Getting problem with playerid (0) - by MBilal - 24.05.2016, 18:51
Re: Getting problem with playerid (0) - by GuthiX - 25.05.2016, 04:51
Re: Getting problem with playerid (0) - by Dayrion - 25.05.2016, 05:38
Re: Getting problem with playerid (0) - by GuthiX - 25.05.2016, 12:54

Forum Jump:


Users browsing this thread: 3 Guest(s)