12.11.2013, 19:19
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;
}

