[Tutorial] String Formatting
#21

Nice tutorial!
Reply
#22

Really usefull tutorial
Reply
#23

^Thanks.
I would like to hear everyone's opinion about the tutorial, thank you.
Reply
#24

there is a small mistake ...
Code:
native strformat(dest[], size=sizeof dest, bool: pack=false, const format[], . . . )
this functions does not exist in pawn ... ((
Reply
#25

i want a message

E.x " Good ob for killing (playername)

any help
Reply
#26

Quote:
Originally Posted by krogsgaard20
View Post
The reason for using "23 + MAX_PLAYER_NAME" and not 128 is because the smaller array sizes, the better. 128 is way too much for our small message in this tutorial. Allways make arrays as small as possible.
Quote:
Originally Posted by Toreno
View Post
True, using a 128 array size is over than you need.

@ krogsgaard20,
To be honest, that tutorial taught me alot.
Good tutorial and good job!
You're right that using small arrays will be better instead of setting them to 128, but, will you really going to count every formatted string you send? Don't you two prefer to just guess the maximum string?

Also, I agree with Y_Less, although I don't know what 3 means. But its true that this one would be better:
pawn Code:
new str[64];
GetPlayerName(playerid,str,MAX_PLAYER_NAME);
format(str,sizeof(str),"Hello %s",str);
Reply
#27

You can quite easily count the characters you need by looking at the 'Col' value in the bottom-right-corner of Pawno (or any other editor for that matter) for the start and end of the string and subtracting them from each other.

As for point 3 that Y_Less stated, I assume that will pad the string with dots, in some way.
Reply
#28

Did you people even noticed that last post was posted 6 months ago and the thread\tutorial created 1 year ago... ?
means you're answering to questions that were asked 1 year ago
Reply
#29

Quote:
Originally Posted by Vince
View Post
You can quite easily count the characters you need by looking at the 'Col' value in the bottom-right-corner of Pawno (or any other editor for that matter) for the start and end of the string and subtracting them from each other.

As for point 3 that Y_Less stated, I assume that will pad the string with dots, in some way.
I'm pretty sure that most of scripters will prefer to use a specific value for string length, such as 16, 32, 64 and etc instead of using the amount of characters in the string.

Also, using the 'col' value will still require to find the number without spaces, functions or any other type of code that can be found in a line of a string.
Reply
#30

thx, it was rly helpfull
Reply
#31

nice tutorial
Reply
#32

I've got a problem idk its reason,
error 012: invalid function call, not a valid address
warning 215: expression has no effect
error 001: expected token: ";", but found ")"
error 029: invalid expression, assumed zero
fatal error 107: too many error messages on one line

Line :

Quote:

format(string,sizeof(string),"(( %s %s: %s ))",atext,RemoveUnderScore(playerid),result);

Reply
#33

Quote:
Originally Posted by JasonRiggs
View Post
I've got a problem idk its reason,
error 012: invalid function call, not a valid address
warning 215: expression has no effect
error 001: expected token: ";", but found ")"
error 029: invalid expression, assumed zero
fatal error 107: too many error messages on one line

Line :
Code:
format(string,sizeof(string),"%s %s %s",atext,RemoveUnderScore(playerid),result);
Reply
#34

Yea dudes, but SendClientMessage limit is actually 144 .
Reply
#35

Quote:
Originally Posted by RoW001
View Post
Yea dudes, but SendClientMessage limit is actually 144 .
That limit is not exclusive to only that function, It's the output's limit.
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)