TextDraw Help Needed Please Help!
#1

Hey guys.Hope everything's fine.
First of all here is my script.
Код:
// This is a comment
// uncomment the line below if you want to write a filterscript
//#define FILTERSCRIPT

#include <a_samp>
new Text:ServerTextdraw[4];

public OnFilterScriptInit()
{

	// TextDraws
    ServerTextdraw[0] = TextDrawCreate(5, 310, "/Cmds/Teles/Help/Rules");
    TextDrawFont(ServerTextdraw[0] , 1);
    TextDrawLetterSize(ServerTextdraw[0] , 0.3, 1.4);
    TextDrawColor(ServerTextdraw[0] , 0xFF00FFFF);
    TextDrawSetOutline(ServerTextdraw[0] , 1);
    TextDrawSetProportional(ServerTextdraw[0] , 1);
    TextDrawSetShadow(ServerTextdraw[0] , 0);

    ServerTextdraw[1] = TextDrawCreate(250,  7 , "StuntzGodZ Stunting:176.31.103.65:11980");
    TextDrawFont(ServerTextdraw[1] , 1);
    TextDrawLetterSize(ServerTextdraw[1] , 0.3, 1.4);
    TextDrawColor(ServerTextdraw[1], 0xFF0000AA);
    TextDrawSetOutline(ServerTextdraw[1] , 1);
    TextDrawSetProportional(ServerTextdraw[1] , 1);
    TextDrawSetShadow(ServerTextdraw[1] , 0);

    ServerTextdraw[2] = TextDrawCreate(410, 310, "Stunt/Freeroam/Race/Drift/Dm/Fun/Parkour");
    TextDrawFont(ServerTextdraw[2] , 1);
    TextDrawLetterSize(ServerTextdraw[2] , 0.3, 1.4);
    TextDrawColor(ServerTextdraw[2] , 0xFF00FFFF);
    TextDrawSetOutline(ServerTextdraw[2] , 1);
    TextDrawSetProportional(ServerTextdraw[2] , 1);
    TextDrawSetShadow(ServerTextdraw[2] , 0);

    ServerTextdraw[3] = TextDrawCreate(200, 400, "Forum Address : www.stuntzgodzserver.forumbuild.com");
    TextDrawFont(ServerTextdraw[3] , 1);
    TextDrawLetterSize(ServerTextdraw[3] , 0.3, 1.4);
    TextDrawColor(ServerTextdraw[3] , 0xFF0000AA);
    TextDrawSetOutline(ServerTextdraw[3] , 1);
    TextDrawSetProportional(ServerTextdraw[3] , 1);
    TextDrawSetShadow(ServerTextdraw[3] , 0);
	
	
	return 1;
}

public OnFilterScriptExit()
{
	return 1;
}




public OnPlayerConnect(playerid)
{
    // TextDraws
	TextDrawShowForPlayer(playerid,ServerTextdraw[0]);
	TextDrawShowForPlayer(playerid,ServerTextdraw[1]);
	TextDrawShowForPlayer(playerid,ServerTextdraw[2]);
	TextDrawShowForPlayer(playerid,ServerTextdraw[3]);

	return 1;
}



public OnPlayerCommandText(playerid, cmdtext[])
{
 if (strcmp("/textdrawoff", cmdtext, true, 10) == 0)
	{
		TextDrawHideForPlayer(playerid,ServerTextdraw[0]);
	    TextDrawHideForPlayer(playerid,ServerTextdraw[1]);
	    TextDrawHideForPlayer(playerid,ServerTextdraw[2]);
	    TextDrawHideForPlayer(playerid,ServerTextdraw[3]);
		return 1;
	}

    if (strcmp("/textdrawon", cmdtext, true, 10) == 0)
	{
		TextDrawShowForPlayer(playerid,ServerTextdraw[0]);
	    TextDrawShowForPlayer(playerid,ServerTextdraw[1]);
	    TextDrawShowForPlayer(playerid,ServerTextdraw[2]);
	    TextDrawShowForPlayer(playerid,ServerTextdraw[3]);
		return 1;
	}

	return 0;
}
So the /textdrawoff is working well. But when i type /textdrawon it doesnt show the textdraw again please help!.
Reply
#2

https://sampwiki.blast.hk/wiki/Strcmp

That code only compares 10 characters this will always be equal to zero if (strcmp("/textdrawoff", cmdtext, true, 10) == 0) if you use /textdrawoff or /textdrawon do yourself a favor and use ZCMD even if you have one command.
Reply
#3

Quote:
Originally Posted by [uL]Pottus
Посмотреть сообщение
https://sampwiki.blast.hk/wiki/Strcmp

That code only compares 10 characters this will always be equal to zero if (strcmp("/textdrawoff", cmdtext, true, 10) == 0) if you use /textdrawoff or /textdrawon do yourself a favor and use ZCMD even if you have one command.
Pottus Thanks for your precious time. But i'm very new to be frank i really don't know how to script it so can u do it for me please.
Reply
#4

What about

Код:
if (strcmp("/textdrawoff", cmdtext, true, 20) == 0)
Reply
#5

Simply count the characters?

pawn Код:
if (strcmp("/textdrawon", cmdtext, true, 11) == 0)
As [uL]Pottus said, I'd also recommend using ZCMD which is way faster than using strcmp().
Reply
#6

Thank you all i repp++ u all
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)