#1 |
Un aporte simple, tal vez a alguien le sirva.
Código:
Salu2.
Código:
Código PHP:
#include <amxmodx>
new gRange[ 33 ], gPoints[ 33 ];
enum _:REQUIREDRANGES
{
NAME[32],
PRICE
};
new const RangesInfo[ ][ REQUIREDRANGES ] =
{
{ "Rango 1", 100 },
{ "Rango 2", 200 },
{ "Rango 3", 300 },
{ "Rango 4", 400 },
{ "Rango 5", 500 }
};
public plugin_init( )
{
register_plugin( "RangesForPoints", "1.0", "Skylar and Kikizon" );
register_event( "DeathMsg", "event_Death", "a" );
register_clcmd( "say /rango", "CheckRange" );
register_clcmd( "say /puntos", "CheckPoints" );
}
public event_Death( )
{
new Attacker = read_data( 1 );
new Victim = read_data( 2 );
if( Victim == Attacker ) return;
if( !is_user_alive( Attacker ) ) return;
UpdateRange( Attacker, 2 );
}
public CheckRange( id )
{
client_print( id, print_chat, "Eres rango %s.", RangesInfo[ gRange[ id ] ][ NAME ] );
return PLUGIN_HANDLED;
}
public CheckPoints( id )
{
client_print( id, print_chat, "Tienes %d punto%s.", gPoints[ id ], gPoints[ id ] == 1 ? "" : "s" );
return PLUGIN_HANDLED;
}
public UpdateRange( id, points )
{
gPoints[ id ] += points;
new Range = gRange[ id ];
while( gPoints[ id ] >= RangesInfo[ gRange[ id ] ][ PRICE ] )
++gRange[ id ];
if( Range < gRange[ id ] )
client_print( id, print_chat, "Felicidades! Subiste al rango %s.", RangesInfo[ gRange[ id ] ][ NAME ] );
}
Salu2.