String errors. - 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: String errors. (
/showthread.php?tid=164642)
String errors. -
Nonameman - 01.08.2010
Hey!
It's me again, I just saw in my server's console when I use my /me or /pm command, an error message appears in it:
"sscanf warning: strings without a lenght are deprecated, please add a destination size"
It's new for me, please help how can i solve this problem. Thanks.
pawn Код:
dcmd_me(playerid, params[])
{
new
msg[100],
str[128];
if(sscanf(params, "s", msg)) return SendClientMessage(playerid, colorFAIL, "Hasznбlat: /me <szцveg>");
if(strlen(msg) < 1) return SendClientMessage(playerid, colorFAIL, "Min. 1 karakter!");
if(strlen(msg) > 100) return SendClientMessage(playerid, colorFAIL, "Max. 100 karakter!");
format(str, sizeof(str), "%s %s.", GetName(playerid), msg);
SendClientMessageToAll(color, str);
return 1;
}
Re: String errors. -
iggy1 - 01.08.2010
pawn Код:
dcmd_me(playerid, params[])
{
new
msg[100],
str[128];
if(sscanf(params, "s[100]", msg)) return SendClientMessage(playerid, colorFAIL, "Hasznбlat: /me <szцveg>");
if(strlen(msg) < 1) return SendClientMessage(playerid, colorFAIL, "Min. 1 karakter!");
if(strlen(msg) > 100) return SendClientMessage(playerid, colorFAIL, "Max. 100 karakter!");
format(str, sizeof(str), "%s %s.", GetName(playerid), msg);
SendClientMessageToAll(color, str);
return 1;
}
Try that notice the sscanf line
Edit: Noticed msg was 100cells so change sscanf line.
Re: String errors. -
Nonameman - 01.08.2010
Quote:
Originally Posted by iggy1
pawn Код:
dcmd_me(playerid, params[]) { new msg[100], str[128]; if(sscanf(params, "s[128]", msg)) return SendClientMessage(playerid, colorFAIL, "Hasznбlat: /me <szцveg>"); if(strlen(msg) < 1) return SendClientMessage(playerid, colorFAIL, "Min. 1 karakter!"); if(strlen(msg) > 100) return SendClientMessage(playerid, colorFAIL, "Max. 100 karakter!"); format(str, sizeof(str), "%s %s.", GetName(playerid), msg); SendClientMessageToAll(color, str); return 1; }
Try that notice the sscanf line
|
Aha, thanks a lot.
Re: String errors. -
iggy1 - 01.08.2010
No problem m8 i had that problem too when i started using the plugin
Re: String errors. -
smeti - 01.08.2010
https://sampforum.blast.hk/showthread.php?tid=55261
Search:
You don't need it (2)
Try:
pawn Код:
dcmd_me(playerid, params[])
{
new
msg[128];
if(sscanf(params, "s[128]", msg)) SendClientMessage(playerid, colorFAIL, "Hasznбlat: /me <szцveg>");
else if(strlen(msg) > 100) SendClientMessage(playerid, colorFAIL, "Max. 100 karakter!");
else {
format(msg, sizeof(msg), "%s %s.", GetName(playerid), msg);
SendClientMessageToAll(color, msg);
}
return true;
}