Stats cmd.
#1

I made a stats cmd but it doesn't work correctly here is the Stats publice:
Код:
public Stats(playerid,targetid)
{
 	new coordsstring[768],coordsstringA[128],coordsstringB[128],coordsstringC[128];
	new skin = PlayerInfo[playerid][pSkin];
	new time = PlayerInfo[playerid][pPlayTime];
	new alevel = PlayerInfo[playerid][pAdmin];
	new respect = PlayerInfo[playerid][pRespect];
	new level = PlayerInfo[playerid][pScore];
	new pmember = PlayerInfo[playerid][pFaction];
	new pleader = PlayerInfo[playerid][pLeader];
	new atext[20];
	if(PlayerInfo[playerid][pMale] == 1) { atext = "Male"; }
	else if(PlayerInfo[playerid][pFemale] == 1) { atext = "Female"; }
 	new ttext[20];
  	if(PlayerInfo[playerid][pSurvivors] == 1) { ttext = "Survivor"; }
	else if(PlayerInfo[playerid][pOthers] == 1) { ttext = "The Others"; }
	new stext[20];
	if(PlayerInfo[playerid][pHunter] == 1) { stext = "Hunter"; }
	else if(PlayerInfo[playerid][pDoctor] == 1) { stext = "Doctor"; }
	else if(PlayerInfo[playerid][pDrugAddict] == 1) { stext = "Drug Addict"; }
	else if(PlayerInfo[playerid][pThief] == 1) { stext = "Plunderer"; }
	else if(PlayerInfo[playerid][pFisher] == 1) { stext = "Fisherman"; }
	else if(PlayerInfo[playerid][pTech] == 1) { stext = "Technican"; }
	else { stext = "None"; }
 	new ftext[20];
 	if(pmember == 1 || pleader == 1)
	{ ftext = "TBWM"; }
	else if(pmember == 2 || pleader == 2)
	{ ftext = "The Rakyat"; }
	else if(pmember == 3 || pleader == 3)
	{ ftext = "The Regiment"; }
	else if(pmember == 0 || pleader == 0)
	{ ftext = "None"; }
 	new rtext[64];
	format(rtext,sizeof(rtext),"%s",GetPlayerRank(playerid));
	new vtext[20];
	if(PlayerInfo[playerid][pVip] == 1) { vtext = "Bronze Vip"; }
	else if(PlayerInfo[playerid][pVip] == 2) { vtext = "Silver Vip"; }
	else if(PlayerInfo[playerid][pVip] == 3) { vtext = "Gold Vip"; }
	else { vtext = "Regular Member"; }
 	new relation[20];
	strmid(relation, PlayerInfo[playerid][pRelationWith], 0, strlen(PlayerInfo[playerid][pRelationWith]), 255);
	if(PlayerInfo[playerid][pRelationShip] == 0) { relation = "None"; }
	new name[MAX_PLAYER_NAME];
	new Float:health;
	GetPlayerHealth(playerid,health);
	GetPlayerName(playerid, name, sizeof(name));
	format(coordsstring,sizeof(coordsstring), "Name:[%s] Level:[%d] Sex:[%s] Health:[%.1f]",name,level,atext,health);
	format(coordsstringA,sizeof(coordsstringA), "Team:[%s] Respect:[%d] Talent:[%s] Playerhours:[%d]",ttext,respect,stext,time);
	format(coordsstringB,sizeof(coordsstringB), "Membership:[%s] Relationship:[%s] Skin:[%d] Admin Level:[%d]",vtext,relation,skin,alevel);
	format(coordsstringC,sizeof(coordsstringC), "Faction:[%s] Rank:[%s]",ftext,rtext);
	ShowPlayerDialog(playerid,STATS,DIALOG_STYLE_MSGBOX,"Stats",coordsstring,coordsstringA,"Close","");
}
It only writes 3 stats in the dialog.
Reply
#2

Try something like this
pawn Код:
new coordsstring[2048];
    format(coordsstring,sizeof(coordsstring), "Name:[%s] Level:[%d] Sex:[%s] Health:[%.1f]\n Team:[%s] Respect:[%d] Talent:[%s] Playerhours:[%d]\n Membership:[%s] Relationship:[%s] Skin:[%d] Admin Level:[%d]\n Faction:[%s] Rank:[%s]",name,level,atext,health,ttext,respect,stext,time,vtext,relation,skin,aleve,ftext,rtext);
    ShowPlayerDialog(playerid,STATS,DIALOG_STYLE_MSGBOX,"Stats",coordsstring,"Close","");


this should help but i dont know cause untested
Reply
#3

It worked, thank you very much +rep.
Reply
#4

so cause i think you not know it i will explain it:

the \n between every 4th stat is a linebreak and forcs the string to begin a new line so if you add more stats just add some new lines ^^
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)