spawn random armor/health onplayerdeath
#8

I'd use it like that:
pawn Код:
// global variable:
new
    bool: RandomPickup_HealthArmour[ MAX_PLAYERS char ], // false = health and true = armour (saving space)
    RandomPickup
;

// When a player dies (get the position and set the as the coordinates of the pickup):
new
    r_health_armour = random( 2 )
;
if( !r_health_armour )
{
    RandomPickup_HealthArmour{ playerid } = false; // Health
    // Create health pickupid:
    RandomPickup = CreatePickup( ... ); // EDIT THE LINE
}
else
{
    RandomPickup_HealthArmour{ playerid } = true; // Armour
    // Create armour pickupid:
    RandomPickup = CreatePickup( ... ); // EDIT THE LINE
}

// When a player pickups the pickup:
if( pickupid == RandomPickup )
{
    new
        Float: amount
    ;
    if( !RandomPickup_HealthArmour{ playerid } ) // health pickupid
    {
        GetPlayerHealth( playerid, amount );
        SetPlayerHealth( playerid, amount + RandomEx( 5, 30 ) );
    }
    else
    {
        GetPlayerArmour( playerid, amount );
        SetPlayerArmour( playerid, amount + RandomEx( 5, 30 ) );
    }
    DestroyPickup( RandomPickup );
}

// the random function for 5-30 percent
stock RandomEx( min, max ) //By ******
{
    return random( max - min ) + min;
}
Reply


Messages In This Thread
spawn random armor/health onplayerdeath - by enzo27 - 12.11.2013, 18:11
Re: spawn random armor/health onplayerdeath - by DaniceMcHarley - 12.11.2013, 18:38
Re: spawn random armor/health onplayerdeath - by enzo27 - 12.11.2013, 18:52
Re: spawn random armor/health onplayerdeath - by erminpr0 - 12.11.2013, 18:57
Re: spawn random armor/health onplayerdeath - by enzo27 - 12.11.2013, 19:06
Re: spawn random armor/health onplayerdeath - by erminpr0 - 12.11.2013, 19:09
Re: spawn random armor/health onplayerdeath - by enzo27 - 12.11.2013, 19:13
Re: spawn random armor/health onplayerdeath - by Konstantinos - 12.11.2013, 19:19
Re: spawn random armor/health onplayerdeath - by enzo27 - 12.11.2013, 19:41
Re: spawn random armor/health onplayerdeath - by enzo27 - 12.11.2013, 20:15

Forum Jump:


Users browsing this thread: 1 Guest(s)