SA-MP Forums Archive
sscanf error - 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 (/showthread.php?tid=497764)



sscanf error - Lidor124 - 28.02.2014

its friend's code and idk what's wrong too :P
error is undentified symbol 'params' on line with sscanf

NOTE: he has sscanf latest version + plugin.

Код:
if(!strcmp(cmdtext, "/createtext",true))
 {
  new text[128];
  if(sscanf(params, "s[128]",text)) return SendClientMessage(playerid, 0xFF0000AA, "Usage: /CreateText [text]");
  new StrinG1[128];
  GetPlayerPos(playerid,X,Y,Z);
  format(StrinG1,sizeof StrinG1,"%s",text);
  Create3DTextLabel(StrinG1,0x0099FFAA,X,Y,Z,40.0,0,0);
  return 1;
 }



Respuesta: sscanf error - CuervO - 28.02.2014

If using strcmp under OnPlayerCommandText there are no parameters (params[]), just cmdtext[].


Re: sscanf error - Konstantinos - 28.02.2014

You don't have params so you've to use cmdtext. sscanf is not necessary for that kind of use, so use isnull instead.

pawn Код:
#if !defined isnull
    #define isnull(%1) \
                ((!(%1[0])) || (((%1[0]) == '\1') && (!(%1[1]))))
#endif
pawn Код:
if (!strcmp(cmdtext, "/createtext", true, 11))
{
    if (isnull(cmdtext[12])) return SendClientMessage(playerid, 0xFF0000AA, "Usage: /CreateText [text]");
    GetPlayerPos(playerid, X, Y, Z);
    Create3DTextLabel(cmdtext[12], 0x0099FFAA, X, Y, Z, 40.0, 0, 0);
    return 1;
}



Re: sscanf error - UnknownGamer - 28.02.2014

Get YCMD + SSCANF2, and do use this:

pawn Код:
#define COLOR_1 0x0099FFAA
#define SCM SendClientMessage

YCMD:acam(playerid, params[], help)
{
    if(help) return SCM(playerid, COLOR_GREY, "Not supported");

    new string[128], Float:x, Float:y, Float:z;
    if(isnull(params)) return SCM(playerid, COLOR_1, "USAGE: /CreateText [text]");
    GetPlayerPos(playerid,x,y,z);
    format(string, sizeof(string), "%s", params);
    Create3DTextLabel(string, COLOR_1, x, y, z, 40.0, 0, 0);
    return 1;
}