SA-MP Forums Archive
Printf doesn't work? :S - 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: Printf doesn't work? :S (/showthread.php?tid=205118)



Printf doesn't work? :S - ғαιιοцт - 31.12.2010

Hey,

I have a problem with printf function; tmp is set to "blablabla" and this is the code:

Код:
			printf("[team] %s: %s", name, playerid, tmp); //returns: "[team] Fallout: "
			print(tmp); //returns: blablabla
it doesn't show the tmp in the first line :S
and when I print 'tmp' variable, it shows me the text 'blablabla' so it's not an empty string!

I tried to first format the string, and then sending it with print(); function but that also doesn't work :


Re: Printf doesn't work? :S - blackwave - 31.12.2010

pawn Код:
printf("[team] %s (%d): %s", name, playerid, tmp);



Re: Printf doesn't work? :S - [03]Garsino - 31.12.2010

pawn Код:
printf("[team] %s (%d): %s", name, playerid, tmp);
You forgot the '%d' placeholder


Re: Printf doesn't work? :S - Iuri - 31.12.2010

Try to increase the string length..(ex.: new string[256]; )..other method i don't know..because i got the same thing you have in my Administrator System, but it works.

Edit: Isn't the playerid detected with
pawn Код:
"%i"
?


Re: Printf doesn't work? :S - ғαιιοцт - 31.12.2010

aaah I didn't see that it was missing :O
I thought like "wtf? I use %s and tmp isn't empty so why doesn't it just show??"

hehe
thanks!


Re: Printf doesn't work? :S - ғαιιοцт - 31.12.2010

Quote:
Originally Posted by Iuri
Посмотреть сообщение
Try to increase the string length..(ex.: new string[256]; )..other method i don't know..because i got the same thing you have in my Administrator System, but it works.

Edit: Isn't the playerid detected with
pawn Код:
"%i"
?
%i or %d both possible,

I always use %i since it is an integer

oh sorry for double-posting