[HELP]Several CreatePickups under 1 Variable -
tuuker - 28.12.2012
Hello!
I'm trying to create several pickups under one variable.
For example:
under one,
new weapon; variable i want to create multiple pickups at different coordinates but with same model id and variable, so OnPlayerPickup i can just call that pickupid(weapon variable) and make them all act same as i want.
Thanks,
Re: [HELP]Several CreatePickups under 1 Variable -
tuuker - 28.12.2012
Anyone?
Re: [HELP]Several CreatePickups under 1 Variable -
RedCrossER - 28.12.2012
#define pickid 15; // number of pickups
Weapon[pickid];
Weapon[1] = create pick code.
Onplayerpickup
If(pickupid == weapon[1])
{
//code here
}
Re: [HELP]Several CreatePickups under 1 Variable -
tuuker - 28.12.2012
So if i would make 3 weapon pickups under same pickup name, for example:
pawn Код:
new Weapon[3];
Weapon[0] = CreatePickup... blabla...
Weapon[1] = CreatePickup... blabla...
Weapon[2]= CreatePickup... blabla...
OnPlayerPickup
if(pickupid == Weapon[0],Weapon[1],Weapon[2]) {
//blabla do that, that..
would work fine? As i like to use pickup type 1 so i can tell it myself when to destroy that pickup, how would i get if its [2] or [1] which one to destroy if player is at that pickup?
Re: [HELP]Several CreatePickups under 1 Variable -
RedCrossER - 28.12.2012
Quote:
Originally Posted by tuuker
So if i would make 3 weapon pickups under same pickup name, for example:
pawn Код:
new Weapon[3];
Weapon[0] = CreatePickup... blabla... Weapon[1] = CreatePickup... blabla... Weapon[2]= CreatePickup... blabla...
OnPlayerPickup if(pickupid == Weapon[0],Weapon[1],Weapon[2]) { //blabla do that, that..
would work fine? As i like to use pickup type 1 so i can tell it myself when to destroy that pickup, how would i get if its [2] or [1] which one to destroy if player is at that pickup?
|
Yes it will , but what you mean to do with weapon[0], ? You weapon[1] or weapon[2] ? If yes then this is wrong
pawn Код:
if(pickupid == Weapon[0],Weapon[1],Weapon[2]) {
The correct code is :
pawn Код:
if(pickupid == Weapon[0] || Weapon[1] || Weapon[2]) {
Re: [HELP]Several CreatePickups under 1 Variable -
tuuker - 28.12.2012
I thought that massives usually starts from 0.
Btw yeah lol, these || as or would make things more easier, don't know what i was thinking, i went too advance tried to do couple of pickups checks and stuff to get which pickup is player at, but thanks to || it makes things much easier, thanks for your advice
Re: [HELP]Several CreatePickups under 1 Variable -
RedCrossER - 28.12.2012
Yes it starts from 0.
Re: [HELP]Several CreatePickups under 1 Variable -
tuuker - 28.12.2012
Btw
pawn Код:
DestroyPickup(Weapon[0] || Weapon[1] || Weapon[2]);
wouldn't work well on destroy. Gotta make more longer code to check if its 0 or 1 or 2 or is there any easier way. I have idea but it will be damn long...