Using functions and variables in dialogs - 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: Using functions and variables in dialogs (
/showthread.php?tid=642338)
Using functions and variables in dialogs -
aoky - 28.09.2017
Can I get an example code for something along the lines of this? I'm just looking to understand how they did something like this through the style of dialog used.
PHP Code:
ShowPlayerDialog(playerid, dialogid, DIALOG_STYLE_TABLIST_HEADERS, "Buy Weapon",
"Weapon\tPrice\tAmmo\n\
Deagle\t$5000\t100\n\
Sawnoff\t$5000\t100\n\
Pistol\t$1000\t50", // Etc.
"Select", "Cancel");
How can we use things like GetPlayerName and our custom functions. Haven't worked with dialogs in a long time.
Re: Using functions and variables in dialogs -
raydx - 28.09.2017
https://sampwiki.blast.hk/wiki/Format
Re: Using functions and variables in dialogs -
aoky - 28.09.2017
Quote:
Originally Posted by raydx
|
I've tried this, although my outcome didn't work. Any chance you can give me an example on how this could work?
Re: Using functions and variables in dialogs -
raydx - 28.09.2017
Code:
new string[150], string2[40];
//Dialog title:
format(string2, 40, "Injuries of %s", PlayerName(playerid));
//List:
format(string, 150, "%s%s\t%s\t%s\n", string, Injury[playerid][injury_type],Injury[playerid][injury_location], Injury[playerid][injury_weapon]);
//Headers:
format(string, 150, "Injury Type\tLocation\tWeapon\n%s", string);
//Showing dialog:
ShowPlayerDialog(playerid, dialogid, DIALOG_STYLE_TABLIST_HEADERS, string2, string);