SA-MP Forums Archive
sscanf error[+rep] - 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)
+--- Thread: sscanf error[+rep] (/showthread.php?tid=409264)



sscanf error[+rep] - ZBits - 20.01.2013

Hello There,

pawn Код:
COMMAND:warn(playerid, params[])
{
if(PlayerInfo[playerid][PlayerAdmin] <= 1) return SendClientMessage(playerid,COLOR_RED,"You Cant Use This Command !!!");
new targetid,String[128];
if (sscanf(params,"us", targetid, String)) return SendClientMessage(playerid, COLOR_WHITE, "Usage: "SININE"/warn "SININE"[ID] [reason]");
if (!IsPlayerConnected(targetid)) return SendClientMessage(playerid, COLOR_RED, "Player is not connected!");
new Name[MAX_PLAYER_NAME];GetPlayerName(playerid,Name,sizeof(Name));
new string[156];format(string, sizeof string, ""RED"You have been "RED"warned "RED"by "RED"%s "RED"for "RED"%s",Name,String);
SendClientMessage(targetid,COLOR_RED,string);
new OtherName[MAX_PLAYER_NAME];
GetPlayerName(targetid,OtherName,sizeof(OtherName));
format(string, sizeof string, "%s has been warned by %s for %s",OtherName,Name,string);
SendClientMessageToAll(COLOR_RED,string);
return 1;
}
and i get this sscanf error

Код:
sscanf warning: Strings without a length are deprecated, please add a destination size
Help....Tried what other topics said.


Re: sscanf error[+rep] - LarzI - 20.01.2013

Simply change your sscanf line to this:
pawn Код:
if (sscanf(params,"us[128]", targetid, String))



Re: sscanf error[+rep] - ZBits - 20.01.2013

Found it.Thanks anyways +repped


Re: sscanf error[+rep] - navroopsingh - 06.02.2013

lol that was quick!