Help me!
#1

Hey guy.

I made a money drop.

So if a player dies it will drup 5 cash pickups and each pickup will give the player 100$ cash.

My problem: The player walks in the pickups and they will be gone. If the player respawns the pickups will appear again.

How to fix that the pickups will stay gone after a player picked it up?

Codes:
PHP код:
public OnPlayerPickUpPickup(playerid, pickupid)
{
    if(
pickupid == cash)
    {
        
GivePlayerMoney(playerid,100);
    }
    else if(
pickupid == cash2)
    {
        
GivePlayerMoney(playerid,100);
    }
    else if(
pickupid == cash3)
    {
        
GivePlayerMoney(playerid,100);
    }
    else if(
pickupid == cash4)
    {
        
GivePlayerMoney(playerid,100);
    }
    else if(
pickupid == cash5)
    {
        
GivePlayerMoney(playerid,100);
    }
    return 
1;
} 
PHP код:
public OnPlayerDeath(playerid, killerid, reason)
{
    new 
Float:x,Float:y,Float:z;
    
ResetPlayerMoney(playerid);
      
GetPlayerPos(playerid,x,y,z);
    
cash = CreatePickup(1212,8,x,y,z);
    
cash2 = CreatePickup(1212,8,x+1,y,z);
    
cash3 = CreatePickup(1212,8,x-1,y,z);
    
cash4 = CreatePickup(1212,8,x,y+1,z);
    
cash5 = CreatePickup(1212,8,x,y-1,z);
} 
Please help me
Reply
#2

Anyone knows why the pickup comes back?
Reply
#3

DestroyPickup(pickupname);
Reply
#4

Thank you!
Reply
#5

Parameters of CreatePickup(model, type, Float:X, Float:Y, Float:Z, virtualworld)
Set type to 3 : Disappears after pickup, respawns after death.
By the way you can optimize your code.
PHP код:
public OnPlayerPickUpPickup(playerid, pickupid) 
{
    switch(
pickid)
    {
        case 
cash : GivePlayerMoney(playerid,100); 
        case 
cash2 : GivePlayerMoney(playerid,100); 
        
        case 
cash3 : GivePlayerMoney(playerid,100); 
        
        case 
cash4 : GivePlayerMoney(playerid,100); 
        case 
cash5 : GivePlayerMoney(playerid,100); 
    }
    return 
1; 
} 
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)