/stats in dialog
#1

How to make my /stats show in a dialog

Код:
		new string2[1000]
		format(string2, sizeof(string2), "%s - Level %d | %s | Age: %d | Total wealth: $%d | Playing hours: %d | Phone number: %s | RP Skill: %d",GetPlayerNameEx(targetid), level, sext, age, totalwealth, ptime, pnumber, rpskill);
		SendClientMessageEx(playerid, COLOR_GRAD2, string2);
		format(coordsstring, sizeof(coordsstring), "Cash: $%d | Bank balance: $%d | Upgrade points: %d | Spawn armor: %.0f | Next level: %d/%d hours ($%d)", cash, account, upgradep, shealth, exp, expamount, costlevel);
		SendClientMessageEx(playerid, COLOR_GRAD2, string2);
		format(string2, sizeof(string2), "%s: %s | Rank: %s (%d) | Division: %s | Job: %s (level: %d) | Job 2: %s (level: %d)", facfam, employer, rank, PlayerInfo[targetid][pRank], division, jtext,jlevel,jtext2, jlevel2);
		SendClientMessageEx(playerid, COLOR_GRAD2, string2);
		format(string2, sizeof(string2), "Crimes: %d | Arrests: %d | Insurance: %s | Wanted level: %d | Health: %.1f | Armor: %.1f | Paintball Tokens: %d",crimes,arrests,insur, wanted, health, armor, ptokens);
		SendClientMessageEx(playerid, COLOR_GRAD2, string2);
		format(string2, sizeof(string2), "Married to: %s | Biggest fish: %d | Pot: %d | Crack: %d | Packages: %d | Crates: %d | Radio frequency: %d mhz",married,bigfish,pot,crack,packages,crates, radiofreq);
        SendClientMessageEx(playerid, COLOR_GRAD2, string2);
		format(string2, sizeof(string2), "Materials: %d | Rope: %d | Rag: %d | Cigars: %d | Sprunk: %d | Spray: %d | Screwdrivers: %d | VIP tokens: %d | Checks: %d | VIP: %s",mats,rope,rag,cigars,sprunk,spray, PlayerInfo[targetid][pScrewdriver],tokens,checks,drank);
        SendClientMessageEx(playerid, COLOR_GRAD2, string2);
		format(string2, sizeof(string2), "OOCMutes: %d | ADMutes: %d | NMutes: %d | RMutes: %d | Weapons Restricted: %d | Gang Warns: %d | Warnings: %d", oocmutes, admutes, nmutes, PlayerInfo[targetid][pRMutedTotal],PlayerInfo[targetid][pWRestricted], PlayerInfo[targetid][pGangWarn], warns);
		SendClientMessageEx(playerid, COLOR_GRAD2, string2);
		if (PlayerInfo[playerid][pAdmin] >= 2)
		{
		    format(string2, sizeof(string2), "House: %d | House 2: %d | Renting: %d | Int: %d | VW: %d | Real VW: %d | Jail: %d sec | WJail: %d sec | AFK: %i", housekey,housekey2,rentkey,intir,vw,realvw,jailt,wjailt, playerAFKTime[targetid]);
		    SendClientMessageEx(playerid, COLOR_GRAD5,coordsstring);
		}
		if (PlayerInfo[playerid][pAdmin] >= 1337)
		{
		    /*if(PlayerInfo[targetid][pAdmin] >= 2 && PlayerInfo[playerid][pAdmin] >= 2)
			{
			    format(coordsstring, sizeof(coordsstring), "Accepted reports: %d | Trashed reports: %d", PlayerInfo[targetid][pAcceptReport], PlayerInfo[targetid][pTrashReport]);
			    SendClientMessageEx(playerid, COLOR_GRAD5,coordsstring);
			}*/
			if(PlayerInfo[targetid][pHelper] >= 2 && PlayerInfo[playerid][pAdmin] >= 2)
			{
			    format(string2, sizeof(string2), "Hours on duty: %d | Accepted help requests: %d", PlayerInfo[targetid][pDutyHours], PlayerInfo[targetid][pAcceptedHelp]);
			    SendClientMessageEx(playerid, COLOR_GRAD5,coordsstring);
			}
		}
Anyone who helps +rep
Reply
#2

bump: Please help me I need this badly
Reply
#3

wait a minute, i will convert it...
Reply
#4

Why you don't search? There are many codes.
Reply
#5

It should look something like this:

Код:
ShowPlayerDialog(playerid,1,DIALOG_STYLE_MSGBOX,"Player Statistics","Kills: \n Deaths:\n Money:\n Admin Level:\n Rank:\n","OK","");
Code from the website:
Код:
// Define the dialog IDs either with an enum:
enum
{
    DIALOG_LOGIN,
    DIALOG_WELCOME,
    DIALOG_WEAPONS
}
 
// Alternatively, the more common method, defines:
#define DIALOG_LOGIN 1
#define DIALOG_WELCOME 2
#define DIALOG_WEAPONS 3
 
// Enums are recommended, as you don't have to keep track of used IDs. However, enums use memory to store the defines, whereas defines are processed in the 'pre-processor' (compiling) stage.
 
// Example for DIALOG_STYLE_MSGBOX:
ShowPlayerDialog(playerid, DIALOG_WELCOME, DIALOG_STYLE_MSGBOX, "Notice", "You connected to the server", "Close", "");
 
// Example for DIALOG_STYLE_INPUT:
ShowPlayerDialog(playerid,DIALOG_LOGIN, DIALOG_STYLE_INPUT, "Login", "Enter your password below:", "Login", "Cancel");
 
// Example for DIALOG_STYLE_LIST:
ShowPlayerDialog(playerid, DIALOG_WEAPONS, DIALOG_STYLE_LIST, "Weapons", "AK47\nM4\nSniper Rifle", "Option 1", "Option 2");
 
//example for DIALOG_STYLE_PASSWORD
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "Login", "Enter your password below:", "Login", "Cancel");
Go here to learn more on scripting techniques: https://sampwiki.blast.hk/wiki/
Reply
#6

Quote:
Originally Posted by AiRaLoKa
Посмотреть сообщение
wait a minute, i will convert it...
Thanks dude...
Reply
#7

first, you have to define the DIALOG_STATS

Код:
		new str1[256],str2[256],str3[256],str4[256],str5[256],str6[256],string[1024];
		format(str1, sizeof(str1), "%s - Level %d | %s | Age: %d | Total wealth: $%d | Playing hours: %d | Phone number: %s | RP Skill: %d",GetPlayerNameEx(targetid), level, sext, age, totalwealth, ptime, pnumber, rpskill);
		format(coordsstring, sizeof(coordsstring), "Cash: $%d | Bank balance: $%d | Upgrade points: %d | Spawn armor: %.0f | Next level: %d/%d hours ($%d)", cash, account, upgradep, shealth, exp, expamount, costlevel);
		format(str2, sizeof(str2), "%s: %s | Rank: %s (%d) | Division: %s | Job: %s (level: %d) | Job 2: %s (level: %d)", facfam, employer, rank, PlayerInfo[targetid][pRank], division, jtext,jlevel,jtext2, jlevel2);
		format(str3, sizeof(str3), "Crimes: %d | Arrests: %d | Insurance: %s | Wanted level: %d | Health: %.1f | Armor: %.1f | Paintball Tokens: %d",crimes,arrests,insur, wanted, health, armor, ptokens);
		format(str4, sizeof(str4), "Married to: %s | Biggest fish: %d | Pot: %d | Crack: %d | Packages: %d | Crates: %d | Radio frequency: %d mhz",married,bigfish,pot,crack,packages,crates, radiofreq);
		format(str5, sizeof(str5), "Materials: %d | Rope: %d | Rag: %d | Cigars: %d | Sprunk: %d | Spray: %d | Screwdrivers: %d | VIP tokens: %d | Checks: %d | VIP: %s",mats,rope,rag,cigars,sprunk,spray, PlayerInfo[targetid][pScrewdriver],tokens,checks,drank);
		format(str6, sizeof(str6), "OOCMutes: %d | ADMutes: %d | NMutes: %d | RMutes: %d | Weapons Restricted: %d | Gang Warns: %d | Warnings: %d", oocmutes, admutes, nmutes, PlayerInfo[targetid][pRMutedTotal],PlayerInfo[targetid][pWRestricted], PlayerInfo[targetid][pGangWarn], warns);
		format(string, sizeof(string), "%s\n%s\n%s\n%s\n%s\n%s\n%s\n",str1,coordsstring,str2,str3,str4,str5,str6);
		ShowPlayerDialog(playerid, DIALOG_STATS, DIALOG_STYLE_MSGBOX, string, "Close","");
		if (PlayerInfo[playerid][pAdmin] >= 2)
		{
		    format(string2, sizeof(string2), "House: %d | House 2: %d | Renting: %d | Int: %d | VW: %d | Real VW: %d | Jail: %d sec | WJail: %d sec | AFK: %i", housekey,housekey2,rentkey,intir,vw,realvw,jailt,wjailt, playerAFKTime[targetid]);
		    SendClientMessageEx(playerid, COLOR_GRAD5,coordsstring);
		}
		if (PlayerInfo[playerid][pAdmin] >= 1337)
		{
		    /*if(PlayerInfo[targetid][pAdmin] >= 2 && PlayerInfo[playerid][pAdmin] >= 2)
			{
			    format(coordsstring, sizeof(coordsstring), "Accepted reports: %d | Trashed reports: %d", PlayerInfo[targetid][pAcceptReport], PlayerInfo[targetid][pTrashReport]);
			    SendClientMessageEx(playerid, COLOR_GRAD5,coordsstring);
			}*/
			if(PlayerInfo[targetid][pHelper] >= 2 && PlayerInfo[playerid][pAdmin] >= 2)
			{
			    format(string2, sizeof(string2), "Hours on duty: %d | Accepted help requests: %d", PlayerInfo[targetid][pDutyHours], PlayerInfo[targetid][pAcceptedHelp]);
			    SendClientMessageEx(playerid, COLOR_GRAD5,coordsstring);
			}
		}
you can edit it by yourself
Reply
#8

Quote:
Originally Posted by CoreyDaniels
Посмотреть сообщение
It should look something like this:

Код:
ShowPlayerDialog(playerid,1,DIALOG_STYLE_MSGBOX,"Player Statistics","Kills: \n Deaths:\n Money:\n Admin Level:\n Rank:\n","OK","");
Code from the website:
Код:
// Define the dialog IDs either with an enum:
enum
{
    DIALOG_LOGIN,
    DIALOG_WELCOME,
    DIALOG_WEAPONS
}
 
// Alternatively, the more common method, defines:
#define DIALOG_LOGIN 1
#define DIALOG_WELCOME 2
#define DIALOG_WEAPONS 3
 
// Enums are recommended, as you don't have to keep track of used IDs. However, enums use memory to store the defines, whereas defines are processed in the 'pre-processor' (compiling) stage.
 
// Example for DIALOG_STYLE_MSGBOX:
ShowPlayerDialog(playerid, DIALOG_WELCOME, DIALOG_STYLE_MSGBOX, "Notice", "You connected to the server", "Close", "");
 
// Example for DIALOG_STYLE_INPUT:
ShowPlayerDialog(playerid,DIALOG_LOGIN, DIALOG_STYLE_INPUT, "Login", "Enter your password below:", "Login", "Cancel");
 
// Example for DIALOG_STYLE_LIST:
ShowPlayerDialog(playerid, DIALOG_WEAPONS, DIALOG_STYLE_LIST, "Weapons", "AK47\nM4\nSniper Rifle", "Option 1", "Option 2");
 
//example for DIALOG_STYLE_PASSWORD
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "Login", "Enter your password below:", "Login", "Cancel");
Go here to learn more on scripting techniques: https://sampwiki.blast.hk/wiki/
no. easy with format. like

format(Stats,sizeof(Stats),"%sJailed players: %i\n", Stats);
strcat(string,Stats);
ShowPlayerDialog(playerid, DialogStats, DIALOG_STYLE_MSGBOX, "Your Stats", Stats, "Close", "");
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)