formatted string on dialog help - 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: formatted string on dialog help (
/showthread.php?tid=663710)
formatted string on dialog help -
masterart - 09.02.2019
pawn Code:
strcat(string, "%s has made you a level %d admin!", name, level);
ShowPlayerDialog(playerid, 6, DIALOG_STYLE_MSGBOX, "Euphoria", string, "Ok", "");
gives me this error:
pawn Code:
error 035: argument type mismatch (argument 3)
Re: formatted string on dialog help -
ComDuck - 09.02.2019
You're not using strcat properly.
Read the SA-MP Wiki on its parameters. Use the
format callback instead.
Re: formatted string on dialog help -
masterart - 09.02.2019
pawn Code:
format(string, "%s has made you a level %d admin!", name, level);
gives the same error
Re: formatted string on dialog help -
Proxus - 09.02.2019
Have you done:
You'll need to do this otherwise it won't work.
Also, you can change [24] to anything you want, it was just an example of the strlength.
Re: formatted string on dialog help -
ComDuck - 09.02.2019
Quote:
Originally Posted by masterart
pawn Code:
format(string, "%s has made you a level %d admin!", name, level);
gives the same error
|
Because you didn't follow the format callback's parameters correctly. You forgot to include the size of the variable you are storing the string into.
Code:
format(string, sizeof(string), "%s has made you a level %d admin!", name, level);
Re: formatted string on dialog help -
Mazio - 09.02.2019
Greetings Masterart,
After having a look on your code, one can simply tell that you have not read Format callback properly over wiki.
Use this:
Code:
format(string, sizeof(string), "%s has made you a level %d admin!", name, level);
You forgot
Re: formatted string on dialog help -
masterart - 09.02.2019
Quote:
Originally Posted by ComDuck
Because you didn't follow the format callback's parameters correctly. You forgot to include the size of the variable you are storing the string into.
Code:
format(string, sizeof(string), "%s has made you a level %d admin!", name, level);
|
this worked, thanks guys!