SA-MP Forums Archive
Annoying pickup-problem! - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Annoying pickup-problem! (/showthread.php?tid=326968)



Annoying pickup-problem! - Twisted_Insane - 19.03.2012

'Sup y'all!

Since a longer time, I got this problem now! I've created a script which creates Deathpickups with money when a player dies, and first, it worked very well at all! It's supposed to give the player random money between $10 and $100 when he picks up one of these random cash-pickups! BUT, since 2 or 3 weeks, I just tested it again, and all of the pickups which are getting created are working well! Only always ONE of them gives me suddenly about 100k! :O

I don't know what I added last, and I also removed any filterscript I've got at the moment! Here is my full code, I hope someone is able to help me!^^

PHP код:
   #define DEATH_PICKUPS 10
    
new DeathPickups[ MAX_PLAYERS ][ DEATH_PICKUPS ],
    
bool:DeathPickupsCreated[ MAX_PLAYERS ]; 
PHP код:
public OnPlayerDeath(playerid, killerid, reason)
    {
    
        if(
DeathPickupsCreated[playerid] == true)
        {
            for(new 
a; a < DEATH_PICKUPS; a++)
            {
                
DestroyPickup(DeathPickups[playerid][a]);
            }
            
            
DeathPickupsCreated[playerid] = false;
        }
        
        new 
Float:P[3];
        
GetPlayerPos(playerid, P[0], P[1], P[2] );
        
        for(new 
a; a < DEATH_PICKUPS; a++)
        {
            
DeathPickups[playerid][a] = CreatePickup(1212, 3, P[0] + random( 3 ) - random( 3 ), P[ 1 ] + random( 3 ) - random( 3 ), P[ 2 ] - 0.5 , -1 );
            
DeathPickupsCreated[playerid] = true;
        }
//the rest of the callback 
PHP код:
    public OnPlayerPickUpPickup(playerid, pickupid)
    {
        for(new 
a; a < MAX_PLAYERS; a++)
        {
            for(new 
b; b < DEATH_PICKUPS; b++)
            {
                if(
pickupid == DeathPickups[a][b])
                {
                    
GivePlayerMoney(playerid, random (100));
                    
                    
DestroyPickup(pickupid);
                }
            }
        }
    
    
        return 
1;
    } 



Re: Annoying pickup-problem! - Twisted_Insane - 21.03.2012

Does anyone know what the problem could be?