Is this possible?
#1

Is there a way to script like this:

Код:
new Examp = 
{
     Example,
     Example2,
     Example3,
     Example4
};

so that i can do: Examp = 0; // so that all turns to 0? or if i do Examp = 1; that all turns to 1?
if there is a way to do this? can you give me a example?
Thanks
Reply
#2

Not sure what you mean exactly, example:

pawn Код:
new Examp[4] = //4 is the size of the array
{
     0,
     5,
     4,
     3
};
Which means.

Код:
Examp[0] = 0   Examp[1] = 5   Examp[2] = 4   Examp[3] = 3
To change values, you can do it either manually like this:

pawn Код:
Examp[0] = 0;
Examp[1] = 0;
Examp[2] = 0;
Examp[3] = 0;
Or with loop like this:

pawn Код:
for(new i; i < sizeof Examp; i++)
{
    Examp[i] = 0;
}
Reply
#3

Hmm thanks for the info.

but cant you do this?
Код:
new Examp = 
{
     Example = 0,
     Example2 = 0,
     Example3 = 1,
     Example4 = 0
};

or this will not work?
Again thanks for your Help.
Reply
#4

use enums
Reply
#5

No, you can't do it like this in PAWN. How do you want to use it later?
Reply
#6

pawn Код:
enum HeyThere
{
Example,
Example2,
Example3,
Example4
}

new Examp[HeyThere] =
{
  0,
  0,
  0,
  0
};
Reply
#7

Hmm Thanks For the code Huss3n.

Is there a other way to Script or are those the only way?
Reply
#8

Quote:
Originally Posted by NeverKnow
Посмотреть сообщение
Hmm Thanks For the code Huss3n.

Is there a other way to Script or are those the only way?
Depends how you're willing to use it later. What do you want to do?
Reply
#9

Quote:
Originally Posted by YouareX
Посмотреть сообщение
Depends how you're willing to use it later. What do you want to do?
I want to use it To change Maps
Reply
#10

Quote:
Originally Posted by NeverKnow
Посмотреть сообщение
I want to use it To change Maps
Well, that doesn't explain anything... Use either one from above, whichever you prefer better.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)