An easier way to do this?
#1

Okay, so I'm making a stunt server and I wanna create some pickups in the Deathmatch areas. Now here's what I did in the past to do this:

new DMBaseballPickup1,
DMBaseballPickup2;

/// And 3-4


DMBaseballlPickup1= CreatePickup(...)
DMBaseballPickup2= CreatePickup(....)

// Then on Player Pickup//


But is there a simpler way? I've heard arrays can help in this matter but I've used arrays only in random spawns till now, I've got no idea how to put it all in arrays and sort it out per deathmatch arena.
Reply
#2

pawn Код:
new DMBaseballPickup[5];

DMBaseballPickup[0] = Create........
DMBaseballPickup[1] = Create........
Try that ^
Reply
#3

new NAMEOFPIKCUP[THENUMBEROFARRAY]

EX:

pawn Код:
new LOL[3]

// it will create like this to be used.

LOL[0]
LOL[1]
LOL[2]
Reply
#4

lol
he doesnt mean what u guys replied
he mean instead of type that much if he can create
with again and again creating variables and putting pickups in object
is there any way?
pawn Код:
enum pickup_Info{
model,
pType,
Float:pX,
Float:pY,
Float:pZ,
world
}

new PickupsArray[][pickup_Info] =
{
     { modelid,pos x, pos y,pos z , virtual world}, // cordinates here in format modelid,pos x, pos y,pos z , virtula world
     {1234,1, 1, 1, 1, 0}//e.g. // just an example
};
// name Pickupsnot actually namein just comment in front of each line in pickup array
and in filter script init
Код HTML:
public OnFilterScriptInit()
{
    for(new o = 0; o < sizeof(Objects); o++)
    {
     CreatePickup(PickupsArray[o][model],PlayerArray[o][pType],PickupsArray[o][pX],PickupsArray[o][pY],PickupsArray[o][pZ],PickupsArray[o][pRZ],PickupsArray[o][world]);
    }
}
// now use Pickup(the number like inside OnPlayerPickupPickup
PHP код:
public OnPlayerPickupPickup(playerid pickupid)
{
     if(
pickupid == PickupArray[4]) // will be the 4th pickup inside array
     
{
 
//rest  code here
     
}

i actualy my self never tried it :P
Reply
#5

Build Your Own Pickup system using enumeration and arrays.
pawn Код:
// Add it below include files.
#define MAX_PICKUPS 200

enum pickup
{
     pID,
     pModel,
     pType,
     Float:pX,
     Float:pY,
     Float:pZ,
     pWorld,
}
new PickupVar[MAX_PICKUPS][pickup];
Thats a basic format of using. Store the values in these arrays and load them accordingly using for loop.

EX:
pawn Код:
for(new i=0;i >= MAX_PICKUPS;i++) return CreatePickup(PickupVar[i][pModel],PickupVar[i][pType],PickupVar[i][pX],PickupVar[i][pY],PickupVar[i][pZ],PickupVar[i][pWorld]);
Reply
#6

I don't understand how's this practically gonna help me out with pickups. + I want the pickups to be at random locations. Can someone explain and help me?
Reply
#7

Gangs why ya resigned from COD5 man?
Reply
#8

Bump.

@Fearless: I'm going mass inactive + I wanted to learn scripting with a free mind. I haven't told the second reason to anyone in COD5 as I didn't wanna look like a copycat suspect. + I'm working on a stunt, not a TDM
Reply
#9

Bumping.
Reply
#10

Quote:

new rnd = random(5000));
new stop = 0;
do
{
CreatePickup(1242, 2,15*rnd, 15*rnd, 15*rnd, -1);
}
until (stop == 1);

This will make it random
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)