PDA

View Full Version : TextDraw Help Needed Please Help!


RedbullGD
03/05/2014, 01:31 PM
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!.

Pottus
03/05/2014, 01:38 PM
http://wiki.sa-mp.com/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.

RedbullGD
03/05/2014, 01:54 PM
Pottus;3020225']http://wiki.sa-mp.com/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.

MaxBerger
03/05/2014, 01:56 PM
What about

if (strcmp("/textdrawoff", cmdtext, true, 20) == 0)

iZN
03/05/2014, 01:59 PM
Simply count the characters?

if (strcmp("/textdrawon", cmdtext, true, 11) == 0)

As [uL]Pottus said, I'd also recommend using ZCMD (http://forum.sa-mp.com/showthread.php?t=91354) which is way faster than using strcmp().

RedbullGD
03/05/2014, 04:01 PM
Thank you all i repp++ u all :D