sscanf2 lenght problem - 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: sscanf2 lenght problem (
/showthread.php?tid=418333)
sscanf2 lenght problem -
RACGaming - 24.02.2013
I have a probelm with sscanf2, if I type "/me oooooooooooooooooooooooooooooooooooooooooooooooooo " then I get only "* Nick_Derlos oooooooooooooooooooooooooooooo"(Maybe counting get messd up but something like that).
My code:
pawn Код:
COMMAND:me(playerid, params[500])
{
if(SisseLogitud[playerid] == 0) return SendClientMessage(playerid, COLOR_RED, "Palun logi kхigepealt sisse");
new paramid[380];
if(!sscanf(params, "s", paramid))
{
if(Mask[playerid] == 0)
{
new jutt[128], nimi[MAX_PLAYER_NAME];
GetPlayerName(playerid, nimi, sizeof(nimi));
format(jutt, sizeof(jutt), "* %s %s", nimi, paramid);
ProxDetector(30.0, playerid,jutt,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
}
else if(Mask[playerid] == 1)
{
new jutt[128];
format(jutt, sizeof(jutt), "* Tundmatu %s", paramid);
ProxDetector(30.0, playerid, jutt,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
}
}
else SendClientMessage(playerid,COLOR_GREY, "KASUTA: /me [tegevus]");
return 1;
}
Whats wrong?
Sorry for my bad English and dont mind the language..
Re: sscanf2 lenght problem -
RajatPawar - 24.02.2013
You don't need paramid as 380, since the max output is 128. Anyways, do it like this:
pawn Код:
if(!sscanf(params, "s[thesizeoftheparam]", paramid)
which in your case means "s[380]".
Re: sscanf2 lenght problem -
Misiur - 24.02.2013
pawn Код:
COMMAND:me(playerid, params[500])
//to
COMMAND:me(playerid, params[])
if(!sscanf(params, "s", paramid))
//to
if(!sscanf(params, "s[380]", paramid))
Max client message is 128, you have to split that later