sscanf
#1

I keep entering text but i get the sscanf message, what have i done wrong?
pawn Код:
CMD:textobject(playerid,params[])
{
    #pragma unused params
    if(!IsCnRAdmin(playerid)) return UnknownCMD(playerid);
    new text[256];
    if(sscanf(params, "s[128]", text)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /textobject (Text)");
    new Float:X, Float:Y, Float:Z, Float:A;
    GetPlayerFacingAngle(playerid, A);
    GetPlayerPos(playerid, X, Y, Z);
    if(strlen(text) < 2) return SendClientMessage(playerid, COLOR_RED, "The Text Length Is Too Short.");
    new myrobject = CreateObject(myzobject,  X+3, Y, Z+1, 0.0, 0.0, A, 300.0);
    SetObjectMaterialText(myrobject, text, 0, OBJECT_MATERIAL_SIZE_256x128,\
    "Arial", 28, 0, COLOR_RED, 0xFF000000, OBJECT_MATERIAL_TEXT_ALIGN_CENTER);
    new result[128];
    format(result,sizeof(result), "The Object is been created with ID %d", myrobject);
    SendClientMessage(playerid, COLOR_RED, result);
    return 1;
}
Reply
#2

pawn Код:
new text[128];
    if(sscanf(params, "s[128]", text)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /textobject (Text)");
The cell size in those two was different. You had 256 in one, but 128 in the other.
Reply
#3

Um.. I changed both to 256 but it is still the same..
Reply
#4

Remove the pragma unused params. You're telling the compiler to ignore the params (I believe, correct me if I am wrong). Besides you are using the params, so it's worth a shot.
Reply
#5

Still the same :/
Reply
#6

Tested this exact command locally, it worked, it must be a problem with your sscanf.

pawn Код:
CMD:textobject(playerid,params[])
{
    new text[256];
    if(sscanf(params, "s[128]", text)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /textobject (Text)");
    new Float:X, Float:Y, Float:Z, Float:A;
    GetPlayerFacingAngle(playerid, A);
    GetPlayerPos(playerid, X, Y, Z);
    if(strlen(text) < 2) return SendClientMessage(playerid, COLOR_RED, "The Text Length Is Too Short.");
    new myrobject = CreateObject(16442,  X+3, Y, Z+1, 0.0, 0.0, A, 300.0);
    SetObjectMaterialText(myrobject, text, 0, OBJECT_MATERIAL_SIZE_256x128,\
    "Arial", 28, 0, COLOR_RED, 0xFF000000, OBJECT_MATERIAL_TEXT_ALIGN_CENTER);
    new result[128];
    format(result,sizeof(result), "The Object is been created with ID %d", myrobject);
    SendClientMessage(playerid, COLOR_RED, result);
    return 1;
}
Reply
#7

Tested this one too, it is the same..
Reply
#8

Quote:
Originally Posted by Ananisiki
Посмотреть сообщение
Tested this one too, it is the same..
Re-check your sscanf plugin and includes. Right now I've got 2.8.1
Reply
#9

pawn Код:
[02:28:13]  ===============================

[02:28:13]       sscanf plugin loaded.    

[02:28:13]          Version:  2.8.1        

[02:28:13]    (c) 2012 Alex "******" Cole  

[02:28:13]  ===============================
Reply
#10

Quote:
Originally Posted by Ananisiki
Посмотреть сообщение
pawn Код:
[02:28:13]  ===============================

[02:28:13]       sscanf plugin loaded.    

[02:28:13]          Version:  2.8.1        

[02:28:13]    (c) 2012 Alex "******" Cole  

[02:28:13]  ===============================
Do other commands work?
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)