SA-MP Forums Archive
setproperty / getproperty and print / printf / format - 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: setproperty / getproperty and print / printf / format (/showthread.php?tid=152986)



setproperty / getproperty and print / printf / format - [Ger]Little_Grandpa - 06.06.2010

after reading the wiki i did following:
pawn Код:
new blabla=1000;
setproperty(0,"",blabla,"ABCDEFG");
new noob[120];
getproperty(0,"",blabla,noob);
printf("%s",noob);
it prints:
Код:
D
its ALWAYS the 4th character... he should print "ABCDEFG" but he only prints the 4th...
BUT FOLLOWING WORKS FINE:
pawn Код:
new blabla=1000;
setproperty(0,"",blabla,"ABCDEFG");
new noob[120];
getproperty(0,"",blabla,noob);
print(noob);
why? whats the diffrence between print and printf? i need to put that in a format(...), so i can't use print...


Re: setproperty / getproperty and print / printf / format - Zeex - 06.06.2010

getproperty gives you a packed string and you need unpack it before using (most of functions don't like packed ones, and it seems that printf() is one of them)

pawn Код:
new blabla=1000;
setproperty(0,"",blabla,"ABCDEFG");
new noob[120];
getproperty(0,"",blabla,noob);
strunpack(noob, noob);
printf("%s", noob);



Re: setproperty / getproperty and print / printf / format - [Ger]Little_Grandpa - 06.06.2010

thx very much