for on array
#2

The for loop is made to make the script check all Tele_CMD of pTele till the right one is found. If it wasnt for the for loop inside OnPlayerCommandPerformed, you would have to:
PHP код:
CMD:dm1(...)
{
    
setpos
}
CMD:dm2(...)
{
    
setpos
}
.
.
etc

Its, infact, tiresome to script so many commands.. Now this makes your work easy as hell. To add a TP command, you can just add: {"cmdname".......VirtualWorld} to the bottom of the Array...

When do you make Enum+Array? Array can only hold one type of variable when it stands alone.. But with Enum, it becomes flexible.. It can store: Float, Integer, String, Bool, Timer, Text, PlayerText, etc with the help of ENUM.
In your case, the Enum makes space inside the Array from 0-15 for string, 16 for Tele_pos_x, etc.. Again, I am just saying it from what I KNOW, and I dont think am good enough to teach others.. Refer: https://sampforum.blast.hk/showthread.php?tid=318307
Reply


Messages In This Thread
for on array - by Onepind - 13.12.2014, 21:40
Re: for on array - by Mic_H - 14.12.2014, 01:42
Re: for on array - by Onepind - 14.12.2014, 20:18
Re: for on array - by Onepind - 15.12.2014, 21:35

Forum Jump:


Users browsing this thread: 1 Guest(s)