Welcome Soldier.



[APORTE] Rangos por Puntos.

Sky^^ Sin conexión
User
#1
Un aporte simple, tal vez a alguien le sirva.


Código:
Código PHP:
<?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.
[Imagen: 76561198095047868.png]

Perfil de amxmodx-es: Skylar
[+] 7 users say Thank You to Sky^^ for this post
Responder



Mensajes en este tema
Rangos por Puntos. - por Sky^^ - 08-26-2017, 02:09 AM
RE: Rangos por Puntos. - por Snower - 08-26-2017, 02:16 AM
RE: Rangos por Puntos. - por Sky^^ - 08-26-2017, 02:33 AM
RE: Rangos por Puntos. - por !Test! LaLo - 08-26-2017, 03:49 PM



Usuarios navegando en este tema:
1 invitado(s)



Sobre M X E M E X I C O

Comunidad MxE © 2020 - La mejorar comunidad de Counter Strike 1.6 .