formatted string on dialog help
#1

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)
Reply
#2

You're not using strcat properly. Read the SA-MP Wiki on its parameters. Use the format callback instead.
Reply
#3

pawn Code:
format(string, "%s has made you a level %d admin!", name, level);
gives the same error
Reply
#4

Have you done:

Code:
new string[24];
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.
Reply
#5

Quote:
Originally Posted by masterart
View Post
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);
Reply
#6

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
Code:
sizeof(string)
Reply
#7

Quote:
Originally Posted by ComDuck
View Post
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!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)