Problem with /stats as dialog - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Problem with /stats as dialog (
/showthread.php?tid=443191)
Problem with /stats as dialog -
RedWolfX - 10.06.2013
Hello, I am converting my /stats command to dialogs, but it just shows the end of stats.
This is my code:
Code:
new string2[128];
new coordsstring[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(string2,sizeof(string2), "Name:[%s] Level:[%d] Sex:[%s] Health:[%.1f]",name,level,atext,health);
strcat(string2,coordsstring);
format(string2,sizeof(string2), "Team:[%s] Respect:[%d] Talent:[%s] Playerhours:[%d]",ttext,respect,stext,time);
strcat(string2,coordsstring);
format(string2,sizeof(string2), "Membership:[%s] Relationship:[%s] Skin:[%d] Admin Level:[%d]",vtext,relation,skin,alevel);
strcat(string2,coordsstring);
format(string2,sizeof(string2), "Faction:[%s] Rank:[%s]",ftext,rtext);
strcat(string2,coordsstring);
ShowPlayerDialog(playerid,STATS,DIALOG_STYLE_MSGBOX,"Stats",string2,"Close","");
It just shows Faction and rank. Why is that? Cant figure out why
Re: Problem with /stats as dialog -
rpg894 - 10.06.2013
what do you expect? In pawn language if you say a = 1, a = 2, a = 3, and then search for a, the a is 3. use strcut
Re: Problem with /stats as dialog -
Red_Dragon. - 10.06.2013
I suggest using strcat in separate lines and keep enlarging the string size till it fits all the stats.