Textdraw crashes server
#1

I am making a map testing gamemode, and one feature it has is when you type /showtag it shows a textdraw with text made with /createtag. When you enter the params in for /createtag though, the server crashes. Im not very experienced with working with strings.

pawn Код:
CMD:createtag(playerid, params[])
    {
    new string[64];
    if(sscanf(params, "s", params))
        {
        SendClientMessage(playerid, 0xFFFFFFFF, "Usage: /createtag [text]");
        return 1;
        }
    else
        {
        format(string,sizeof(string),"%s");
        Textdraw1 = TextDrawCreate(490.000000, 410.000000, string);
        TextDrawAlignment(Textdraw1, 2);
        TextDrawBackgroundColor(Textdraw1, 255);
        TextDrawFont(Textdraw1, 1);
        TextDrawLetterSize(Textdraw1, 0.600000, 3.199999);
        TextDrawColor(Textdraw1, -1);
        TextDrawSetOutline(Textdraw1, 1);
        TextDrawSetProportional(Textdraw1, 1);
        SendClientMessage(playerid, COLGREEN, "[SERVER]{FFFFFF} Your tag has been set to %s.");
        return 1;
        }
   
    }
Reply
#2

Your server crashes coz you are creating a textdraw without any text in it.
Here is your problem;
pawn Код:
format(string,sizeof(string),"%s"); // format nothing..

format(string,sizeof(string),"%s", params); // this should work
Also, your SendClientMessage at the end wont show the params (%s), you need to format that to if you want the text you created to show.
Reply
#3

That fixed it, thanks.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)