error in code.
#1

Код:
CMD:ocheck(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] < 99999)
	{
		SendClientMessage(playerid, COLOR_GRAD1, "You are not authorized to use that command!");
		return 1;
	}
	if(isnull(params)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /ocheck [Full name(case senstive]");
	if(doesAccountExist(params))
	{
		new atext[20]; // Sex
		new dtext[20]; // STD
        new jtext[20]; // Job
        new btext[40]; // Biz
        new jlevel[20]; // Job Level
        new htext[MAX_ZONE_NAME]; // House
        new cartext1[56]; // car 1
        new cartext2[56]; // car 2
   		new coordsstring[128];
		switch (PlayerInfo[MAX_PLAYERS][pSex])
		{
			case 0: atext = "None";
			case 1: atext = "Male";
			case 2: atext = "Female";
		}
		switch (STDPlayer[MAX_PLAYERS)
		{
			case 0: dtext = "None";
			case 1: dtext = "Chlamydia";
			case 2: dtext = "Gonorrhea";
			case 3: dtext = "Syphilis";
		}
		switch (PlayerInfo[MAX_PLAYERS][pJob])
		{
			case 0: jtext = "None";
			case 1: jtext = "Detective";
			case 2: jtext = "Lawyer";
			case 3: jtext = "Whore";
			case 4: jtext = "Drug Dealer";
			case 5: jtext = "Product Dealer";
			case 7: jtext = "Mechanic";
			case 8: jtext = "Bodyguard";
			case 9: jtext = "Arms Dealer";
			case 12: jtext = "Boxer";
			case 14: jtext = "Taxi Driver";
			case 17: jtext = "Drug Smuggler";
			case 18: jtext = "Trucker";
			default: jtext = "None";
		}
		if(PlayerInfo[MAX_PLAYERS][pJob] >= 0)
		{
            new level;
		    switch(PlayerInfo[MAX_PLAYERS][pJob])
		    {
		        case 1: level = PlayerInfo[MAX_PLAYERS][pDetSkill];
		        case 2: level = PlayerInfo[MAX_PLAYERS][pLawSkill];
		        case 3: level = PlayerInfo[MAX_PLAYERS][pSexSkill];
		        case 4: level = PlayerInfo[MAX_PLAYERS][pDrugsSkill];
		        case 7: level = PlayerInfo[MAX_PLAYERS][pMechSkill];
		        case 9: level = PlayerInfo[MAX_PLAYERS][pArmsSkill];
		        case 12: level = PlayerInfo[MAX_PLAYERS][pBoxSkill];
		        case 17: level = PlayerInfo[MAX_PLAYERS][pSmugglerSkill];
		        case 18: level = PlayerInfo[MAX_PLAYERS][pTruckSkill];
		        case 0, 5, 8, 14: level = -1;
		    }
		    if(level >= 0 && level <= 24) jlevel = "1";
            else if(level >= 25 && level <= 49) jlevel = "2";
            else if(level >= 50 && level <= 74) jlevel = "3";
            else if(level >= 75 && level <= 99) jlevel = "4";
            else if(level >= 100) jlevel = "5";
            else if(level == -1) jlevel = "None";
        }
		new married[20];
		strmid(married, PlayerInfo[MAX_PLAYERS][pMarriedTo], 0, strlen(PlayerInfo[MAX_PLAYERS][pMarriedTo]), 255);
		new ptime = PlayerInfo[MAX_PLAYERS][pConnectTime];
		new cash = PlayerInfo[MAX_PLAYERS][pCash];
		new deaths = PlayerInfo[MAX_PLAYERS][pDeaths];
		new bigfish = PlayerInfo[MAX_PLAYERS][pBiggestFish];
		new pot = PlayerInfo[MAX_PLAYERS][pPot];
		new potseeds = PlayerInfo[MAX_PLAYERS][pPotSeeds];
		new crack = PlayerInfo[MAX_PLAYERS][pCrack];
		new packages = Packages[playerid];
		new crates = Crates[playerid];
		new mats = PlayerInfo[MAX_PLAYERS][pMats];
		new rope = PlayerInfo[MAX_PLAYERS][pRope];
		new cigars = PlayerInfo[MAX_PLAYERS][pCigars];
		new sprunk = PlayerInfo[MAX_PLAYERS][pSprunk];
		new blindfolds = PlayerInfo[MAX_PLAYERS][pBlindfolds];
		new tikis = PlayerInfo[MAX_PLAYERS][pTikis];
		new spray = PlayerInfo[MAX_PLAYERS][pSpraycan];
		new crimes = PlayerInfo[MAX_PLAYERS][pCrimes];
		new arrested = PlayerInfo[MAX_PLAYERS][pArrested];
		new level = PlayerInfo[MAX_PLAYERS][pLevel];
		new exp = PlayerInfo[MAX_PLAYERS][pExp];
		new kills = PlayerInfo[MAX_PLAYERS][pKills];
		new pnumber = PlayerInfo[MAX_PLAYERS][pPnumber];
		new account = PlayerInfo[MAX_PLAYERS][pAccount];
		new nxtlevel = PlayerInfo[MAX_PLAYERS][pLevel]+1;
		new expamount = nxtlevel*levelexp;
		new costlevel = nxtlevel*levelcost;
		new intir = GetPlayerInterior(playerid);
		new vw = GetPlayerVirtualWorld(targetid);
		new skin = GetPlayerSkin(targetid);
		new warns = PlayerInfo[MAX_PLAYERS][pWarns];
		new points = PlayerInfo[MAX_PLAYERS][gPupgrade];
		new jtime = PlayerInfo[MAX_PLAYERS][pJailTime];
		new deck = PlayerInfo[MAX_PLAYERS][pDeck];
		new wtc = PlayerInfo[MAX_PLAYERS][pWTc];
		new products = PlayerInfo[MAX_PLAYERS][pProducts];
        new biz = PlayerInfo[MAX_PLAYERS][pBizKey];
		if(biz != -1)
		{
			format(btext,sizeof(btext),"%s (%d)",BizInfo[biz][bName],biz);
		}
		else
		{
			btext = "None";
		}

		if(PlayerInfo[MAX_PLAYERS][pCar][0] > 0)
		{
			format(cartext1, sizeof(cartext1), "%s (%s)",	GetVehicleFriendlyNameFromModel(CarInfo[PlayerInfo[MAX_PLAYERS][pCar][0]][c_Model]),
															CarInfo[PlayerInfo[MAX_PLAYERS][pCar][0]][c_Plate]);
		}
		else
		{
		    format(cartext1, sizeof(cartext1), "None");
		}

		if(PlayerInfo[MAX_PLAYERS][pCar][1] > 0)
		{
			format(cartext2, sizeof(cartext2), "%s (%s)",	GetVehicleFriendlyNameFromModel(CarInfo[PlayerInfo[MAX_PLAYERS][pCar][1]][c_Model]),
															CarInfo[PlayerInfo[MAX_PLAYERS][pCar][1]][c_Plate]);
		}
		else
		{
		    format(cartext2, sizeof(cartext2), "None");
		}


		new rod[20], bait[20], baita, line[20];
		switch(PlayerInfo[MAX_PLAYERS][pFishRod])
		{
		    case 0: rod = "None";
		    case 1: rod = "Old Rod";
		    case 2: rod = "Beginners Rod";
		    case 3: rod = "Fishermans Rod";
			case 4: rod = "Elite Rod";
		}
		switch(PlayerInfo[MAX_PLAYERS][pBait])
		{
		    case 0: bait = "None";
		    case 1: bait = "Weak Bait";
		    case 2: bait = "Regular Bait";
		    case 3: bait = "Strong Bait";
			case 4: bait = "Elite Bait";
		}
		baita = PlayerInfo[MAX_PLAYERS][pBaitAmount];
		if(baita == 0) { bait = "None"; }
		switch(PlayerInfo[MAX_PLAYERS][pLine])
		{
		    case 0: line = "None";
		    case 1: line = "Regular Line";
		}
		//vip
		new vip[20];
		if(PlayerInfo[MAX_PLAYERS][pDonateRank] == 0)
		{
			vip = "None";
		}
		else if(PlayerInfo[MAX_PLAYERS][pDonateRank] == 1)
		{
			vip = "Bronze";
		}
		else if(PlayerInfo[MAX_PLAYERS][pDonateRank] == 2)
		{
			vip = "Silver";
		}
		else if(PlayerInfo[MAX_PLAYERS][pDonateRank] == 3)
		{
			vip = "Gold";
		}
		if(PlayerInfo[MAX_PLAYERS][pHouseID] == 0)
		{
		    strins(htext, "None", 0);
		}
		else
		{
			new location[MAX_ZONE_NAME];
			Get2DZone(location, MAX_ZONE_NAME, HouseInfo[PlayerInfo[MAX_PLAYERS][pHouseID]][hOutsideX], HouseInfo[PlayerInfo[MAX_PLAYERS][pHouseID]][hOutsideY], HouseInfo[PlayerInfo[MAX_PLAYERS][pHouseID]][hOutsideZ]);
		    format(htext, sizeof(htext), "%d %s", PlayerInfo[MAX_PLAYERS][pHouseID], location);
		}
		new screw;
		if(PlayerInfo[MAX_PLAYERS][pScrew] > 0)
		{
		    screw = 1;
		}
		new Float:health;
		new Float:armor;
		GetPlayerHealth(targetid,health);
		GetPlayerArmour(targetid,armor);
		new shealth = PlayerInfo[MAX_PLAYERS][pSHealth];
		new shp = PlayerInfo[MAX_PLAYERS][pSHP];
		new name[MAX_PLAYER_NAME];
		GetPlayerRPName(targetid, name, sizeof(name));
		SendClientMessage(playerid, COLOR_YELLOW, "_______________________________________________________________________________________");
		format(coordsstring, sizeof(coordsstring), "{33CCFF}[Account]{FFFFFF}: Name:[%s] Sex:[%s] Level:[%d] Respect:[%d/%d] Phone:[%d]",PlayerRPName(MAX_PLAYERS),atext,level,exp,expamount,pnumber);
		SendClientMessage(playerid, COLOR_WHITE,coordsstring);
	    format(coordsstring, sizeof(coordsstring), "{33CCFF}[Details]{FFFFFF}: Money:[$%d] Bank:[$%d] Next Level Cost:[%d] Job:[%s] Job Level:[%s]",cash,account,costlevel,jtext,jlevel);
		SendClientMessage(playerid, COLOR_WHITE,coordsstring);
		format(coordsstring, sizeof(coordsstring), "{33CCFF}[Details]{FFFFFF}: Married To:[%s] Affiliation:[%s] Rank:[%d]",married,GetPlayerFactionName(targetid),PlayerInfo[MAX_PLAYERS][pRank]);
		SendClientMessage(playerid, COLOR_WHITE,coordsstring);
		format(coordsstring, sizeof(coordsstring), "{33CCFF}[Upgrades]{FFFFFF}: Upgrade Points:[%d] Armor Upgrade:[%d] Health Upgrade:[%d] VIP:[%s]",points,shealth,shp,vip);
		SendClientMessage(playerid, COLOR_WHITE,coordsstring);
		format(coordsstring, sizeof(coordsstring), "{33CCFF}[Property]{FFFFFF}: House:[%s] | Vehicle 1:[%s] | Vehicle 2:[%s] | Business:[%s]",htext,cartext1,cartext2,btext);
   		SendClientMessage(playerid, COLOR_WHITE,coordsstring);
   		format(coordsstring, sizeof(coordsstring), "{33CCFF}[Inventory]{FFFFFF}: Materials:[%d] Pot:[%d] Crack:[%d] Package:[%d] Crates:[%d] Seeds:[%d] Products:[%d] WTc:[%d]",mats,pot,crack,packages,crates,potseeds,products, wtc);
   		SendClientMessage(playerid, COLOR_WHITE,coordsstring);
   		format(coordsstring, sizeof(coordsstring), "{33CCFF}[Inventory]{FFFFFF}: Ropes:[%d] Blindfolds:[%d] Cigars:[%d] Sprunk:[%d] Spraycan:[%d] Screw Driver:[%d] Deck of Cards:[%d]",rope,blindfolds,cigars,sprunk,spray,screw,deck);
   		SendClientMessage(playerid, COLOR_WHITE,coordsstring);
   		format(coordsstring, sizeof(coordsstring), "{33CCFF}[Inventory]{FFFFFF}: Rod:[%s] Bait:[%s] Bait Left:[%d] Fishing Line[%s]", rod, bait, baita, line);
   		SendClientMessage(playerid, COLOR_WHITE,coordsstring);
   		format(coordsstring, sizeof(coordsstring), "{33CCFF}[Records]{FFFFFF}: Playing Hours:[%d] Kills:[%d] Deaths:[%d] Biggest Fish:[%d] Crimes Commited:[%d] Times Arrested:[%d]",ptime,kills,deaths,bigfish,crimes,arrested);
   		SendClientMessage(playerid, COLOR_WHITE,coordsstring);
   		}
   		return 1;
}
Getting this error
PHP код:
RP.pwn(32980) : error 032: array index out of bounds (variable "PlayerInfo")
RP.pwn(32986) : error 032: array index out of bounds (variable "STDPlayer")
RP.pwn(32993) : error 032: array index out of bounds (variable "PlayerInfo")
RP.pwn(33010) : error 032: array index out of bounds (variable "PlayerInfo")
RP.pwn(33013) : error 032: array index out of bounds (variable "PlayerInfo")
RP.pwn(33015) : error 032: array index out of bounds (variable "PlayerInfo")
RP.pwn(33016) : error 032: array index out of bounds (variable "PlayerInfo")
RP.pwn(33017) : error 032: array index out of bounds (variable "PlayerInfo")
RP.pwn(33018) : error 032: array index out of bounds (variable "PlayerInfo")
RP.pwn(33019) : error 032: array index out of bounds (variable "PlayerInfo")
RP.pwn(33020) : error 032: array index out of bounds (variable "PlayerInfo")
RP.pwn(33021) : error 032: array index out of bounds (variable "PlayerInfo")
RP.pwn(33022) : error 032: array index out of bounds (variable "PlayerInfo")
RP.pwn(33023) : error 032: array index out of bounds (variable "PlayerInfo")
RP.pwn(33034) : error 032: array index out of bounds (variable "PlayerInfo")
RP.pwn(33035) : error 032: array index out of bounds (variable "PlayerInfo")
RP.pwn(33036) : error 032: array index out of bounds (variable "PlayerInfo")
RP.pwn(33037) : error 032: array index out of bounds (variable "PlayerInfo")
RP.pwn(33038) : error 032: array index out of bounds (variable "PlayerInfo")
RP.pwn(33039) : error 032: array index out of bounds (variable "PlayerInfo")
RP.pwn(33040) : error 032: array index out of bounds (variable "PlayerInfo")
RP.pwn(33041) : error 032: array index out of bounds (variable "PlayerInfo")
RP.pwn(33044) : error 032: array index out of bounds (variable "PlayerInfo")
RP.pwn(33045) : error 032: array index out of bounds (variable "PlayerInfo")
RP.pwn(33046) : error 032: array index out of bounds (variable "PlayerInfo")
RP.pwn(33047) : error 032: array index out of bounds (variable "PlayerInfo"
Reply
#2

Replace
pawn Код:
switch(PlayerInfo[MAX_PLAYERS]
pawn Код:
switch(PlayerInfo[playerid]
Reply
#3

Actually, i want print stats of offline players.
Reply
#4

That won't be achieved using MAX_PLAYERS.
Reply
#5

Could you help me, how to do it?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)