Help with /stats
#1

Код:
ShowStats(playerid,targetid)
{
    if(IsPlayerConnected(playerid) && IsPlayerConnected(targetid))
	{
		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[targetid][pSex])
		{
			case 0: atext = "None";
			case 1: atext = "Male";
			case 2: atext = "Female";
		}
		switch (STDPlayer[targetid])
		{
			case 0: dtext = "None";
			case 1: dtext = "Chlamydia";
			case 2: dtext = "Gonorrhea";
			case 3: dtext = "Syphilis";
		}
		switch (PlayerInfo[targetid][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";
			default: jtext = "None";
		}
		if(PlayerInfo[targetid][pJob] >= 0)
		{
            new level;
		    switch(PlayerInfo[targetid][pJob])
		    {
		        case 1: level = PlayerInfo[targetid][pDetSkill];
		        case 2: level = PlayerInfo[targetid][pLawSkill];
		        case 3: level = PlayerInfo[targetid][pSexSkill];
		        case 4: level = PlayerInfo[targetid][pDrugsSkill];
		        case 7: level = PlayerInfo[targetid][pMechSkill];
		        case 9: level = PlayerInfo[targetid][pArmsSkill];
		        case 12: level = PlayerInfo[targetid][pBoxSkill];
		        case 17: level = PlayerInfo[targetid][pSmugglerSkill];
		        case 0, 5, 8, 14: level = -1;
		    }
		    if(level >= 0 && level <= 49) jlevel = "1";
            else if(level >= 50 && level <= 99) jlevel = "2";
            else if(level >= 100 && level <= 199) jlevel = "3";
            else if(level >= 200 && level <= 399) jlevel = "4";
            else if(level >= 400) jlevel = "5";
            else if(level == -1) jlevel = "None";
        }
		new married[20];
		strmid(married, PlayerInfo[targetid][pMarriedTo], 0, strlen(PlayerInfo[targetid][pMarriedTo]), 255);
		new ptime = PlayerInfo[targetid][pConnectTime];
		new cash = PlayerInfo[targetid][pCash];
		new deaths = PlayerInfo[targetid][pDeaths];
		new bigfish = PlayerInfo[targetid][pBiggestFish];
		new pot = PlayerInfo[targetid][pPot];
		new potseeds = PlayerInfo[targetid][pPotSeeds];
		new crack = PlayerInfo[targetid][pCrack];
		new packages = Packages[playerid];
		new crates = Crates[playerid];
		new mats = PlayerInfo[targetid][pMats];
		new rope = PlayerInfo[targetid][pRope];
		new cigars = PlayerInfo[targetid][pCigars];
		new sprunk = PlayerInfo[targetid][pSprunk];
		new blindfolds = PlayerInfo[targetid][pBlindfolds];
		new tikis = PlayerInfo[targetid][pTikis];
		new cookies = PlayerInfo[targetid][pCookies];
		new spray = PlayerInfo[targetid][pSpraycan];
		new crimes = PlayerInfo[targetid][pCrimes];
		new arrested = PlayerInfo[targetid][pArrested];
		new level = PlayerInfo[targetid][pLevel];
		new exp = PlayerInfo[targetid][pExp];
		new kills = PlayerInfo[targetid][pKills];
		new pnumber = PlayerInfo[targetid][pPnumber];
		new account = PlayerInfo[targetid][pAccount];
		new nxtlevel = PlayerInfo[targetid][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[targetid][pWarns];
		new points = PlayerInfo[targetid][gPupgrade];
		new jtime = PlayerInfo[targetid][pJailTime];
		new deck = PlayerInfo[targetid][pDeck];
		new wtc = PlayerInfo[targetid][pWTc];
		new products = PlayerInfo[targetid][pProducts];
        new biz = PlayerInfo[targetid][pBizKey];
		if(biz != -1)
		{
			format(btext,sizeof(btext),"%s (%d)",BizInfo[biz][bName],biz);
		}
		else
		{
			btext = "None";
		}

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

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

		new rod[20], bait[20], baita, line[20];
		switch(PlayerInfo[targetid][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[targetid][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[targetid][pBaitAmount];
		if(baita == 0) { bait = "None"; }
		switch(PlayerInfo[targetid][pLine])
		{
		    case 0: line = "None";
		    case 1: line = "Regular Line";
		}
		//vip
		new vip[20];
		if(PlayerInfo[targetid][pDonateRank] == 0)
		{
			vip = "None";
		}
		else if(PlayerInfo[targetid][pDonateRank] == 1)
		{
			vip = "Bronze";
		}
		else if(PlayerInfo[targetid][pDonateRank] == 2)
		{
			vip = "Silver";
		}
		else if(PlayerInfo[targetid][pDonateRank] == 3)
		{
			vip = "Gold";
		}
		if(PlayerInfo[targetid][pHouseID] == 0)
		{
		    strins(htext, "None", 0);
		}
		else
		{
			new location[MAX_ZONE_NAME];
			Get2DZone(location, MAX_ZONE_NAME, HouseInfo[PlayerInfo[targetid][pHouseID]][hOutsideX], HouseInfo[PlayerInfo[targetid][pHouseID]][hOutsideY], HouseInfo[PlayerInfo[targetid][pHouseID]][hOutsideZ]);
		    format(htext, sizeof(htext), "%d %s", PlayerInfo[targetid][pHouseID], location);
		}
		new screw;
		if(PlayerInfo[targetid][pScrew] > 0)
		{
		    screw = 1;
		}
		new Float:health;
		new Float:armor;
		GetPlayerHealth(targetid,health);
		GetPlayerArmour(targetid,armor);
		new shealth = PlayerInfo[targetid][pSHealth];
		new shp = PlayerInfo[targetid][pSHP];
		new name[MAX_PLAYER_NAME];
		GetPlayerRPName(targetid, name, sizeof(name));
		SendClientMessage(playerid, COLOR_GREY, "______________________________________Stats Of Diverse Roleplay__________________________ ");
		format(coordsstring, sizeof(coordsstring), "{1E90FF}[Account]: {FFFFFF}Name:[%s] Sex:[%s] Level:[%d] Respect:[%d/%d] Phone:[%d]",PlayerRPName(targetid),atext,level,exp,expamount,pnumber);
		SendClientMessage(playerid, COLOR_WHITE,coordsstring);
	        format(coordsstring, sizeof(coordsstring), "{1E90FF}[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), "{1E90FF}[Details]: {FFFFFF}Married To:[%s] Affiliation:[%s] Rank:[%s (%d)]",married,GetPlayerFactionName(targetid),GetPlayerRank(targetid),PlayerInfo[targetid][pRank]);
  		SendClientMessage(playerid, COLOR_WHITE,coordsstring);
		format(coordsstring, sizeof(coordsstring), "{1E90FF}[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), "{1E90FF}[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), "{1E90FF}[Inventory]: {FFFFFF}Materials:[%d] Pot:[%d] Crack:[%d] Package:[%d] Crates:[%d] Seeds:[%d] Products:[%d]",mats,pot,crack,packages,crates,potseeds,products);
        SendClientMessage(playerid, COLOR_WHITE,coordsstring);
   		format(coordsstring, sizeof(coordsstring), "{1E90FF}[Inventory]: {FFFFFF}Ropes:[%d] Blindfolds:[%d] Cigars:[%d] Sprunk:[%d] Spraycan:[%d] Screw Driver:[%d] Deck of Cards:[%d] WTc:[%d]",rope,blindfolds,cigars,sprunk,spray,screw,deck,wtc);
  	    SendClientMessage(playerid, COLOR_WHITE,coordsstring);
   		format(coordsstring, sizeof(coordsstring), "{1E90FF}[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), "{1E90FF}[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);
        SendClientMessage(playerid, COLOR_GREY, "______________________________________End Of Stats__________________________ ");
		if(PlayerInfo[playerid][pAdmin] >= 2)
		{
			format(coordsstring, sizeof(coordsstring), "{7CFC00}[Admin Info] {FFFFFF}Vehicle 1 ID: %d | Vehicle 1 TID: %d | Vehicle 2 ID: %d | Vehicle 2 TID: %d", PlayerInfo[targetid][pCar][0], CarInfo[PlayerInfo[targetid][pCar][0]][c_ID], PlayerInfo[targetid][pCar][1], CarInfo[PlayerInfo[targetid][pCar][1]][c_ID]);
			SendClientMessage(playerid, COLOR_WHITE,coordsstring);
			format(coordsstring, sizeof(coordsstring), "{7CFC00}[Admin Info] {FFFFFF}Int: %d | VW: %d | Warnings: %d | JailTime: %d | Tikis: %d | Cookies: %d | Skin: %d",intir,vw,warns,jtime,tikis,cookies,skin);
			SendClientMessage(playerid, COLOR_WHITE,coordsstring);
		}
		SendClientMessage(playerid, COLOR_LIGHTBLUE, "___________________________________________________________________________________________________________________________________________________________________");
 }
	return 1;
}
CAN ANYONE HELP ME TO PUT THIS IN DIALOG BOX PLEASE? You help is kindly appreciated.
Reply
#2

Код:
format(coordsstring, sizeof(coordsstring), "%s{1E90FF}[Details]: {FFFFFF}Money:[$%d] Bank:[$%d] Next Level Cost:[%d] Job:[%s] Job Level:[%s]", coordsstring, cash,account,costlevel,jtext,jlevel);
Just add %s at the beggining of next formatted lane and then define it first after ".
Don't do it with first lane of stats string.
After that simply show it to player via ShowPlayerDialog
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)