Looping thru array in 2 directions
#1

Hello folks.

I want to make a custom class selection. A couple of days ago, I had an idea to detect in which direction player is moving in class selection. It returns 1 for a move right and -1 for a move left.

Everything till here works perfect, however I came to face another problem. I am not that experienced with loops so I came here to seek for a little help of yours.

Here is my list of skins:

pawn Код:
enum e_CLASS_DATA
{
    e_CLASS_ID,
    e_CLASS_SKIN,
    e_CLASS_TEAM,
    e_CLASS_INTERIOR,
    Float:e_CLASS_POS[4]
};

new const cData[MAX_CLASSES][e_CLASS_DATA] =
{
    {0, 271, 0, 7, {766.6708, -68.6765, 1001.5692, 270.0}},
    {1, 102, 1, 7, {766.6708, -68.6765, 1001.5692, 270.0}},
    {2, 115, 2, 7, {766.6708, -68.6765, 1001.5692, 270.0}},
    {3, 109, 3, 7, {766.6708, -68.6765, 1001.5692, 270.0}},
    {4, 100, 4, 7, {766.6708, -68.6765, 1001.5692, 270.0}},
    {5, 280, 5, 7, {766.6708, -68.6765, 1001.5692, 270.0}},
    {6,   2, 6, 7, {766.6708, -68.6765, 1001.5692, 270.0}}
};
What I want to do is when player is switching keys into those two directions, set his skins.

From where I stuck was going from ID 0 to the last ID in the array. Lets say a player makes a whole turn left. In normal class selection you go to the last classid. What I look to do is go from ID 0 to the last ID 6 and the opposite, from 6 to 0.

Thank you.
Reply


Messages In This Thread
Looping thru array in 2 directions - by Cypress - 10.06.2014, 08:49
Re: Looping thru array in 2 directions - by Cypress - 10.06.2014, 08:57
Re: Looping thru array in 2 directions - by Cypress - 10.06.2014, 09:01
Re: Looping thru array in 2 directions - by Djole1337 - 10.06.2014, 09:03
Re: Looping thru array in 2 directions - by Cypress - 10.06.2014, 09:06
Re: Looping thru array in 2 directions - by Djole1337 - 10.06.2014, 09:07
Re: Looping thru array in 2 directions - by Cypress - 10.06.2014, 09:09
Re: Looping thru array in 2 directions - by Djole1337 - 10.06.2014, 09:11
Re: Looping thru array in 2 directions - by Djole1337 - 10.06.2014, 09:17
Re: Looping thru array in 2 directions - by Cypress - 10.06.2014, 09:20

Forum Jump:


Users browsing this thread: 1 Guest(s)