Problem with sscanf2 - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Server (
https://sampforum.blast.hk/forumdisplay.php?fid=6)
+--- Forum: Server Support (
https://sampforum.blast.hk/forumdisplay.php?fid=19)
+--- Thread: Problem with sscanf2 (
/showthread.php?tid=605153)
Problem with sscanf2 -
LaFrace - 15.04.2016
When i try to make command like this(for private message): /es [Playerid] [Text] then i dont get error but when i try to use this in game the script thinks that kelleleid(player ID who gets the message) is 101, and this happens what ever i type, so when i type "/es 2 Hello." Script send Message like this: ES(vдlja) MyName(MyID) -->
101:{FFFFFF} Hello. And player with ID 2 dont recive the message.
I didnt find any help in forum, please someone give me some advice.
Код:
if(!strcmp(cmd, "/es"))
{
new kelleleid, tekst;
sscanf(params, "is[256]", kelleleid, tekst);
new kellelenimi[MAX_PLAYER_NAME], kesnimi[MAX_PLAYER_NAME];
GetPlayerName(kelleleid, kellelenimi, sizeof(kellelenimi));
GetPlayerName(playerid, kesnimi, sizeof(kesnimi));
new string[256];
format(string, sizeof(string), "ES(vдlja) %s(%d) --> %i:{FFFFFF} %s", kesnimi, playerid, kelleleid, tekst);
SendClientMessage(playerid, COLOR_YELLOW, string);
format(string, sizeof(string), "ES(sisse) %s(%d) --> %i:{FFFFFF} %s", kesnimi, playerid, kelleleid, tekst);
SendClientMessage(kelleleid, COLOR_YELLOW, string);
return 1;
}
Re: Problem with sscanf2 -
LaFrace - 15.04.2016
I just found fix, i needed to use:
new kelleleid, tekst[256];