SA-MP Forums Archive
Dialog string help. :x - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Dialog string help. :x (/showthread.php?tid=243205)



Dialog string help. :x - Skylar Paul - 21.03.2011

EDITED: Problem fixed, thank you Admantis!

Solution: Strcat


Re: Dialog string help. :x - admantis - 21.03.2011

https://sampwiki.blast.hk/wiki/Strcat


Re: Dialog string help. :x - Skylar Paul - 21.03.2011

Quote:
Originally Posted by admantis
View Post
Just tried using that, how would I go about doing something like this?

pawn Code:
strcat(string, "{0FA0D1}Name: {FFFFFF}%s (ID: %d)\n{0FA0D1}VIP Rank: {FFFFFF}%s (%d)\n{0FA0D1}Skin ID: {FFFFFF}%d\n{0FA0D1}Job:{FFFFFF} %s\n{0FA0D1}Money: {FFFFFF}$%d\n{0FA0D1}Faction: {FFFFFF}%s |", pName(playerid), playerid, VIPName, PVar[playerid][VIPLevel], PVar[playerid][pSkin], JobName, PVar[playerid][pMoney], FactionName);
    strcat(string, "{0FA0D1}Rank: {FFFFFF}%s (Rank: %d)\n{0FA0D1}Materials: {FFFFFF}%d | {0FA0D1}Drugs: {FFFFFF}%d", FactionRankName, PVar[playerid][pFRank], PVar[playerid][pMaterials], PVar[playerid][pDrugs]);
    ShowPlayerDialog(playerid, STATS, DIALOG_STYLE_MSGBOX, "{0FA0D1}Godfather Reborn: Statistics", string, "Hide", "");



Re: Dialog string help. :x - admantis - 22.03.2011

You need to format the string then concenate it with strcat.
pawn Code:
format(string, sizeof(string)"{0FA0D1}Rank: {FFFFFF}%s (Rank: %d)\n{0FA0D1}Materials: {FFFFFF}%d | {0FA0D1}Drugs: {FFFFFF}%d", FactionRankName, PVar[playerid][pFRank], PVar[playerid][pMaterials], PVar[playerid][pDrugs]);
strcat(holder, string, sizeof(holder)); // You need a new variable called 'holder' to hold all the data concenated with strcat



Re: Dialog string help. :x - Skylar Paul - 22.03.2011

Quote:
Originally Posted by admantis
View Post
You need to format the string then concenate it with strcat.
pawn Code:
format(string, sizeof(string)"{0FA0D1}Rank: {FFFFFF}%s (Rank: %d)\n{0FA0D1}Materials: {FFFFFF}%d | {0FA0D1}Drugs: {FFFFFF}%d", FactionRankName, PVar[playerid][pFRank], PVar[playerid][pMaterials], PVar[playerid][pDrugs]);
strcat(holder, string, sizeof(holder)); // You need a new variable called 'holder' to hold all the data concenated with strcat
Thank you VERY much! We really need a reputation system on these forums..


Re: Dialog string help. :x - admantis - 22.03.2011

Yeah, no problem, but I doubt it's going to be soon.