Problem with function: '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: Problem with function: 'format' (
/showthread.php?tid=222988)
Problem with function: 'format' -
[HLF]Southclaw - 08.02.2011
Hi, I'm having a problem with format.
I'm writing a small account script for a friends server.
The function 'format' doesn't seem to be working properly:
pawn Код:
new str[128];
format(str, 128, "%s, 0", inputtext);
print(str); // PRINT 1
printf("%s, 0", inputtext); // PRINT 2
Fini_SetStr(GetName(playerid));
"PRINT 1" :
's'
"PRINT 2" :
'<password>, 0'
I don't see any problem with it
It's not the writing function [Fini] because the print is set before that, and the string appears wrong.
This is confusing and pissing me off, any help would be appreciated.
Re: Problem with function: 'format' -
Mean - 08.02.2011
Nooot sure...
pawn Код:
new str[128];
format(str, 128, "%s, 0", inputtext); // This will print everything inside the " ", why did you put , 0 ?
print(str); // PRINT 1
printf("%s, 0", inputtext);
Fini_SetStr(GetName(playerid));
And do u got inputtext defined?
Re: Problem with function: 'format' -
[HLF]Southclaw - 08.02.2011
'inputtext' is from the callback OnDialogResponse, if I set up a print with it, it prints the password fine.
"%s, 0" - 0 is the admin level parameter, this is register dialog, admin defaults to 0
Re: Problem with function: 'format' -
dice7 - 08.02.2011
Use strcat