SA-MP Forums Archive
Help me boys - 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: Help me boys (/showthread.php?tid=625839)



Help me boys - Hunud - 07.01.2017

How to make from

PlayerTextDrawHide(playerid, Intro[playerid][0]);
PlayerTextDrawHide(playerid, Intro[playerid][1]);
PlayerTextDrawHide(playerid, Intro[playerid][2]);

This is 3 lines but how to make 1 line but it will hide all


Re: Help me boys - SyS - 07.01.2017

Use loop


Re: Help me boys - Lordzy - 07.01.2017

You can do it by looping.
pawn Код:
for(new i = 0; i < 3; i++)
    PlayerTextDrawHide(playerid, Intro[playerid][i]));
Or if you've got other codes and if you're referring to hide them or combine them into a function, you can search for creating functions or stocks. But the first option on this case would be using a loop.


Re: Help me boys - Hunud - 07.01.2017

ok but what if i have 5 of 6 textdraws? sorry me no good at script


Re: Help me boys - SyS - 07.01.2017

Quote:
Originally Posted by Lordzy
Посмотреть сообщение
You can do it by looping.
pawn Код:
for(new i = 0; i < 3; i++)
    PlayerTextDrawHide(playerid, Intro[playerid][i]));
Or if you've got other codes and if you're referring to hide them or combine them into a function, you can search for creating functions or stocks. But the first option on this case would be using a loop.
Don't use statements like functions or stocks because they are not same


Re: Help me boys - Lordzy - 07.01.2017

Quote:
Originally Posted by Sreyas
Посмотреть сообщение
Don't use statements like functions or stocks because they are not same
In case if the same code segments are repeated elsewhere in script, I'd prefer combining them as a stock (as per PAWN defined). It could reduce copies of codes that are used more than once.


Re: Help me boys - Hunud - 07.01.2017

help pls


Re: Help me boys - Skimmer - 07.01.2017

I modified Lordzy's code.

pawn Код:
for(new i = 0; i < sizeof(Intro[playerid]); i++)
    PlayerTextDrawHide(playerid, Intro[playerid][i]));



Re: Help me boys - Lordzy - 07.01.2017

Quote:
Originally Posted by Skimmer
Посмотреть сообщение
I modified Lordzy's code.

pawn Код:
for(new i = 0; i < sizeof(Intro[playerid]); i++)
    PlayerTextDrawHide(playerid, Intro[playerid][i]));
You might face an error, it should be : sizeof(Intro[]));


Re: Help me boys - Hunud - 14.01.2017

FIXED