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



sscanf - Ananisiki - 14.03.2014

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



Re: sscanf - Threshold - 14.03.2014

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.


Re: sscanf - Ananisiki - 14.03.2014

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


Re: sscanf - CuervO - 14.03.2014

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.


Re: sscanf - Ananisiki - 14.03.2014

Still the same :/


Re: sscanf - CuervO - 14.03.2014

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



Re: sscanf - Ananisiki - 14.03.2014

Tested this one too, it is the same..


Re: sscanf - CuervO - 14.03.2014

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


Re: sscanf - Ananisiki - 14.03.2014

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]  ===============================



Re: sscanf - CuervO - 14.03.2014

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?