sscanf error
#1

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;
 }
Reply
#2

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

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;
}
Reply
#4

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;
}
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)