PHP Kod:
#include < amxmodx >
#include < nvault >
#include < fun >
#include < hamsandwich >
new lvls[ 33 ][ 3 ];
new cvars[ 2 ];
new others[ 2 ];
new const cinovi[ ][ ] = {
{"#1 Baslangic",0},
{"#2 Amator",10},
{"#3 Kalfa",20},
{"#4 Usta Bunnyci",30},
{"#5 Engel Tanimaz",40},
{"#6 Uzman Deathruncu",50},
{"#7 Deathrun Ustasi",60},
{"#8 Hizli Bunnyci",90},
{"#9 Profesyonel Bunnyci",100},
{"#10 Saygi Deger Oyuncu",110}
};
public plugin_init( ) {
register_plugin( "[DR] LvL System", "1.1", "Malli Bojan" );
others[ 0 ] = nvault_open( "[DR] LvL System" );
others[ 1 ] = CreateHudSyncObj( );
cvars[ 0 ] = register_cvar( "dr_xp_for_lvl", "8" );
cvars[ 1 ] = register_cvar( "dr_max_level", "100" );
RegisterHam(Ham_Spawn, "player", "bePS", 1);
}
public bePS(id){
switch( lvls[ id ][ 0 ] ) {
case 0..9: lvls[ id ][ 2 ] = 0;
case 10..19: lvls[ id ][ 2 ] = 1;
case 20..29: lvls[ id ][ 2 ] = 2;
case 30..39: lvls[ id ][ 2 ] = 3;
case 40..49: lvls[ id ][ 2 ] = 4;
case 50..59: lvls[ id ][ 2 ] = 5;
case 60..69: lvls[ id ][ 2 ] = 6;
case 70..79: lvls[ id ][ 2 ] = 7;
case 80..89: lvls[ id ][ 2 ] = 8;
case 90..999: lvls[ id ][ 2 ] = 9;
}
if(lvls[ id ][ 2 ] == 9){
set_user_health(id,get_user_health(id) + 50)
}
if(lvls[ id ][ 2 ] == 8){
set_user_health(id,get_user_health(id) + 45)
}
else if(lvls[ id ][ 2 ] == 7){
set_user_health(id,get_user_health(id) + 35)
}
else if(lvls[ id ][ 2 ] == 6){
set_user_health(id,get_user_health(id) + 30)
}
else if(lvls[ id ][ 2 ] == 5){
set_user_health(id,get_user_health(id) + 25)
}
else if(lvls[ id ][ 2 ] == 4){
set_user_health(id,get_user_health(id) + 15)
}
else if(lvls[ id ][ 2 ] == 3){
set_user_health(id,get_user_health(id) + 10)
}
else if(lvls[ id ][ 2 ] == 2){
set_user_health(id,get_user_health(id) + 5)
}
else if(lvls[ id ][ 2 ] == 1){
set_user_health(id,get_user_health(id) + 3)
}
else if(lvls[ id ][ 2 ] == 0){
set_user_health(id,get_user_health(id) + 1)
}
}
public client_death( napadac, zrtva ) {
if( !is_user_connected( napadac ) || ( napadac == zrtva ) || ( lvls[ napadac ][ 0 ] == get_pcvar_num( cvars[ 1 ] ) ) )
return;
lvls[ napadac ][ 1 ]++;
if( lvls[ napadac ][ 1 ] >= get_pcvar_num( cvars[ 0 ] ) ) {
lvls[ napadac ][ 0 ]++;
lvls[ napadac ][ 1 ] = 0;
}
set_user_fade( napadac );
}
public save_info( id ) {
new szData[ 256 ], szAuthID[ 33 ];
get_user_authid( id, szAuthID, charsmax( szAuthID ) );
formatex( szData, charsmax(szData), "%i %i", lvls[ id ][ 0 ], lvls[ id ][ 1 ] );
nvault_set( others[ 0 ], szAuthID, szData );
}
public load_info( id ) {
new szData[ 256 ], szAuthID[ 33 ], szInfo[ 2 ][ 33 ];
get_user_authid( id, szAuthID, charsmax( szAuthID ) );
nvault_get( others[ 0 ], szAuthID, szData, charsmax( szData ) );
parse( szData, szInfo[ 0 ], charsmax( szInfo[ ] ), szInfo[ 1 ], charsmax( szInfo[ ] ) );
lvls[ id ][ 0 ] = str_to_num( szInfo[ 0 ] );
lvls[ id ][ 1 ] = str_to_num( szInfo[ 1 ] );
}
public client_putinserver( id ) {
set_task( 1.0, "ShowHud", id, _, _, "b" );
load_info( id );
}
public client_disconnect( id )
save_info( id );
public ShowHud( id ) {
switch( lvls[ id ][ 0 ] ) {
case 0..9: lvls[ id ][ 2 ] = 0;
case 10..19: lvls[ id ][ 2 ] = 1;
case 20..29: lvls[ id ][ 2 ] = 2;
case 30..39: lvls[ id ][ 2 ] = 3;
case 40..49: lvls[ id ][ 2 ] = 4;
case 50..59: lvls[ id ][ 2 ] = 5;
case 60..69: lvls[ id ][ 2 ] = 6;
case 70..79: lvls[ id ][ 2 ] = 7;
case 80..89: lvls[ id ][ 2 ] = 8;
case 90..999: lvls[ id ][ 2 ] = 9;
}
new isim[32]
get_user_name(id,isim,31)
set_hudmessage( 120, 60, random_num( 0, 255 ), 0.01, 0.22 );
ShowSyncHudMsg( id, others[ 1 ], "[ %s ]^n[HP: %d]^n[Level: %d]^n[Frag: %d/%d]^n[Rutbe: %s]",isim, get_user_health( id ), lvls[ id ][ 0 ], lvls[ id ][ 1 ], get_pcvar_num( cvars[ 0 ] ), cinovi[ lvls[ id ][ 2 ] ] );
}
stock set_user_fade( index ) {
message_begin( MSG_ONE_UNRELIABLE, get_user_msgid( "ScreenFade" ), _, index );
write_short( ( 1 << 12 ) * 1 );
write_short( floatround( ( 1 << 12 ) * 0.01 ) );
write_short( 0x0000 );
write_byte( 0 );
write_byte( 170 );
write_byte( 255 );
write_byte( 150 );
message_end( );
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ ansicpg1254\\ deff0\\ deflang1055{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ f0\\ fs16 \n\\ par }
*/