Han ocurrido los siguientes errores:
Warning [2] Undefined variable $unreadreports - Line: 119 - File: global.php(961) : eval()'d code PHP 8.4.6 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/global.php(961) : eval()'d code 119 errorHandler->error_callback
/global.php 961 eval
/printthread.php 16 require_once



MxEMexico
[Aporte] Rangos por Puntos. - Versión para impresión

+- MxEMexico (https://www.mxemexico.com)
+-- Foro: Extras (https://www.mxemexico.com/forumdisplay.php?fid=162)
+--- Foro: Pawn/Scripting. (https://www.mxemexico.com/forumdisplay.php?fid=100)
+--- Tema: [Aporte] Rangos por Puntos. (/showthread.php?tid=1693)



Rangos por Puntos. - Sky^^ - 08-26-2017

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.


RE: Rangos por Puntos. - Snower - 08-26-2017

No entiendo nada de esto xd, pero a alguien le servirá. Gracias por tu aporte!


RE: Rangos por Puntos. - Sky^^ - 08-26-2017

(08-26-2017, 02:16 AM)Snower escribió: No entiendo nada de esto xd, pero a alguien le servirá. Gracias por tu aporte!

Gracias  :approved:


RE: Rangos por Puntos. - !Test! LaLo - 08-26-2017

Gracias esto se me hará útil.