SA-MP Forums Archive
Making this short - 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: Making this short (/showthread.php?tid=344298)



Making this short - Faisal_khan - 20.05.2012

Hi SA-MP Community,
Can I make this short:
pawn Код:
if(clickedid == Textdraw7 || Textdraw22 || Textdraw23 || Textdraw24 || Textdraw25 || Textdraw26 || Textdraw27 || Textdraw28 || Textdraw29 || Textdraw30 || Textdraw31 || Textdraw32 || Textdraw33 || Textdraw34)



Re: Making this short - zombieking - 20.05.2012

Yea:

pawn Код:
#DEFINE TDs Textdraw7 || Textdraw22 || Textdraw23 || Textdraw24 || Textdraw25 || Textdraw26 || Textdraw27 || Textdraw28 || Textdraw29 || Textdraw30 || Textdraw31 || Textdraw32 || Textdraw33 || Textdraw34
Then:

pawn Код:
if(clickedid == TDs)



Re: Making this short - Faisal_khan - 20.05.2012

Hmm.. it gives me error
Код:
Unknown Directive
On this line:
pawn Код:
#DEFINE TDs Textdraw7 || Textdraw22 || Textdraw23 || Textdraw24 || Textdraw25 || Textdraw26 || Textdraw27 || Textdraw28 || Textdraw29 || Textdraw30 || Textdraw31 || Textdraw32 || Textdraw33 || Textdraw34



Re: Making this short - Jonny5 - 20.05.2012

#DEFINE

should be all lower case

#define


Re: Making this short - jessejanssen - 21.05.2012

It should be:

pawn Код:
if(clickedid == Textdraw7 || clickedid == Textdraw22 || clickedid == Textdraw23 || clickedid == Textdraw24 || clickedid == Textdraw25 || clickedid == Textdraw26 || clickedid == Textdraw27 || clickedid == Textdraw28 || clickedid == Textdraw29 || clickedid == Textdraw30 || clickedid == Textdraw31 || clickedid == Textdraw32 || clickedid == Textdraw33 || clickedid == Textdraw34)
So I would do it like this:
pawn Код:
public OnPlayerClickTextDraw(playerid, Text:clickedid)
{
new Text:cid = clickedid
if(cid == Textdraw7 || cid == Textdraw22 || cid == Textdraw23 || cid == Textdraw24 || cid == Textdraw25 || cid == Textdraw26 || cid == Textdraw27 || cid == Textdraw28 || cid == Textdraw29 || cid == Textdraw30 || cid == Textdraw31 || cid == Textdraw32 || cid == Textdraw33 || cid == Textdraw34)
}
At least, I guess the cid also has to be a 'Text:', else just remove that part and it should work fine. ( I've not worked with clickable textdraws yet so that's why I'm not sure. )

Best regards,
Jesse


Re: Making this short - Faisal_khan - 21.05.2012

Quote:
Originally Posted by Jonny5
Посмотреть сообщение
#DEFINE

should be all lower case

#define
Yours is working thnx all +2rep to all.