[HELP]Several CreatePickups under 1 Variable
#1

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,
Reply
#2

Anyone?
Reply
#3

#define pickid 15; // number of pickups
Weapon[pickid];

Weapon[1] = create pick code.

Onplayerpickup
If(pickupid == weapon[1])
{
//code here
}
Reply
#4

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?
Reply
#5

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]) {
Reply
#6

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
Reply
#7

Yes it starts from 0.
Reply
#8

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...
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)