Is this possible? - 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: Is this possible? (
/showthread.php?tid=371191)
Is this possible? -
NeverKnow - 22.08.2012
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
Re: Is this possible? -
Youarex - 22.08.2012
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;
}
Re: Is this possible? -
NeverKnow - 22.08.2012
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.
Re: Is this possible? - HuSs3n - 22.08.2012
use enums
Re: Is this possible? -
MadeMan - 22.08.2012
No, you can't do it like this in PAWN. How do you want to use it later?
Re: Is this possible? - HuSs3n - 22.08.2012
pawn Код:
enum HeyThere
{
Example,
Example2,
Example3,
Example4
}
new Examp[HeyThere] =
{
0,
0,
0,
0
};
Re: Is this possible? -
NeverKnow - 22.08.2012
Hmm Thanks For the code Huss3n.
Is there a other way to Script or are those the only way?
Re: Is this possible? -
Youarex - 22.08.2012
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?
Re: Is this possible? -
NeverKnow - 22.08.2012
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
Re: Is this possible? -
Youarex - 22.08.2012
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.