Bribe Pickup
#1

hey, i want your advice:
1. do i have to make MAX_BRIBES system and looping all the bribes ?
2. or i have to make CreatePickup on each bribe under OnGameModeInIt ?

3. after all that, how to make the pickup disappear after some player pick it up, and respawn after 20 seconds ?
do i have to make SetTimer ?
Reply
#2

You have to make CreatePickup on each bribe, And to make it dissaper and respawn
pawn Код:
CreatePickup(pickup id, spawn type 2, X,Y,Z -1);//change spawn type 2
Read more here about spawn types https://sampwiki.blast.hk/wiki/PickupTypes
Reply
#3

can i change the time of the type, i want to set it manually
Reply
#4

Yes you can , check this
https://sampwiki.blast.hk/wiki/SetTimerEx
https://sampwiki.blast.hk/wiki/DestroyPickup

Script
pawn Код:
SetTimerEx("RemovePickup", 3000, false, "i", playerid); //add that underyour pickup ,and change 3000 to timer you want.
add this any where in your script
pawn Код:
forward RemovePickup(playerid);
public RemovePickup(playerid)
{
    DestroyPickup(your pickup name); //change that to your pickup name.
    return 1;
}
Reply
#5

i think this will remove the pickup for only the player that picked it, i want to make it destroy for all players if any player picked it
Reply
#6

pawn Код:
// on the top

new bribepickup[MAX_BRIBES];

// gamemode / filterscript init

bribepickup[0] = CreatePickup(1247, 1, X, Y, Z, -1);

// and onplayerpickup

for(new pickup = 0; pickup < MAX_BRIBES; pickup++)
{
     if(pickupid == bribepickup[pickup])
     DestroyPickup(pickupid);
     // here you add some lines if ya want, i Mean WL --
}
Reply
#7

Quote:
Originally Posted by erminpr0
Посмотреть сообщение
pawn Код:
// on the top

new bribepickup[MAX_BRIBES];

// gamemode / filterscript init

bribepickup[0] = CreatePickup(1247, 1, X, Y, Z, -1);

// and onplayerpickup

for(new pickup = 0; pickup < MAX_BRIBES; pickup++)
{
     if(pickupid == bribepickup[pickup])
     DestroyPickup(pickupid);
     // here you add some lines if ya want, i Mean WL --
}
this will destroy it and makes it not come back again,
1. should i use Timer ?
2. where to put the timer, GameModeInIt ?
Reply
#8

Top
pawn Код:
#define MAX_PICKUPS_IN_ENUM     2

enum pickups
{
    pModel,
    Float:pX,
    Float:pY,
    Float:pZ,
    pWorld
};
new PickupIDS[MAX_PICKUPS_IN_ENUM][pickups] =
{
    {pickup_model, X, Y, Z, VirtualWorld},
    // {...}, next
    {pickup_model, X, Y, Z, VirtualWorld}
};

new PickupID[2];

@RespawnPickup(pickupid,picked);
@RespawnPickup(pickupid,picked)
{
    DestroyPickup(pickupid);
    CreatePickup(PickupIDS[picked][pModel], 1, PickupIDS[picked][pX], PickupIDS[picked][pY], PickupIDS[picked][pZ], PickupIDS[picked][pWorld]);
    return 1;
}
OnGameModeInit
pawn Код:
for(new i=0; i != MAX_PICKUPS_IN_ENUM; i++)
    PickupID[!!i] = CreatePickup(PickupIDS[i][pModel], 1, PickupIDS[i][pX], PickupIDS[i][pY], PickupIDS[i][pZ], PickupIDS[i][pWorld]);
Somewhere
pawn Код:
public OnPlayerPickUpPickup(playerid, pickupid)
{
    if(PickupID[0] <= pickupid <= PickupID[1])
    {
        DestroyPickup(pickupid);
        new Pick = pickupid - PickupID[0];
        CreatePickup(PickupIDS[Pick][pModel], 1, PickupIDS[Pick][pX], PickupIDS[Pick][pY], PickupIDS[Pick][pZ], 1000);
        SetTimerEx("@RespawnPickup", 20000, false, "ii", pickupid, Pick);
        return 1;
    }
    return 0;
}
If you don't need virtualworld just remove that array
Reply
#9

thanks for replying, don't i have to script the type of pickup ?
pawn Код:
enum pickups
{
    pModel,
    Float:pX,
    Float:pY,
    Float:pZ,
    pWorld
};
[EDIT] can you explain what is number 2 ?
pawn Код:
new PickupID[2];
Reply
#10

You don't need:
- if pickups are with one ID all
- sets type if only on foot pickupable
- virtual world if all pickups are in one world

PickupID[2] is for storing pickup ids
[2] means 0-1 so

PickupID[0] = first created pickup ID
PickupID[1] = last created pickup ID
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)