SA-MP Forums Archive
Textdraw crashes server - 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: Textdraw crashes server (/showthread.php?tid=439432)



Textdraw crashes server - Mattakil - 25.05.2013

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



Re: Textdraw crashes server - Richie© - 25.05.2013

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.


Re: Textdraw crashes server - Mattakil - 25.05.2013

That fixed it, thanks.