Discord sunucumuz açılmıştır, hepinizi bekleriz

https://discord.gg/43gGDQe6tS

Basit istek

Moderatör: Moderatörler

Forum kuralları
[font size=20] DİKKAT [/font]

Silinmiş konu içerikleri hiçbir şekilde kontrol edlimemektedir. İndirdiğiniz dosyaların sorumluluğu tamamiyle size aittir.
Mutlaka indirdiğiniz dosyaları antivirüs ile taratınız.

Konu Sahibi
ERRA
Mesajlar: 66
Kayıt: Prş Haz 25, 2020 11:06 pm

Basit istek

Mesaj gönderen ERRA »

orucoglukayra yazdı: Çrş Eki 20, 2021 7:15 am
ERRA yazdı: Sal Eki 19, 2021 10:16 pm
orucoglukayra yazdı: Sal Eki 19, 2021 7:51 pm Bu işler deneye deneye öğreniliyor.Attığımı inceleyin, anlamadığınız yer olursa tekrar yazabilirsiniz.Bildiğim kadarıyla yardımcı olurum.

Yaptığım işlem, trail eklentisi aldıktan sonra native tanıtıyorum. (Level sorgusu yapmamız için gerekli) ;

Kod: Tümünü seç

native crxranks_get_user_level(index); // Leveli çekmemizi sağlayacak
Daha sonra gerekli yerlere level sorgusu yapıcaz ;

Kod: Tümünü seç

    if(crxranks_get_user_level(id) != 30)
    {
        client_print( id, print_chat, "[CSD] Sadece Level 30lar Bu Menuye Girebilir!" ); 
        return PLUGIN_HANDLED; 
    }

Kod: Tümünü seç

#include < amxmodx >
#include < amxmisc >
#include < fakemeta >
#include < hamsandwich >

native crxranks_get_user_level(index);

#pragma semicolon 1

#define PLUGIN_VERSION "1.0.0"

#define TASKID        81732519124

#define TRAIL_ACTIVE 1
#define TRAIL_INACTIVE 0
#define TRAIL_LIFE 15
#define ACCES_FLAG  ADMIN_ALL

new gTrailSprite;
new gTrailRandomColor[ 33 ][ 3 ];
new bPlayerTrailStatus[ 33 ];
new Float:bflNextCheck[ 33 ];
new const gTrailSpriteIndex[] = "sprites/zbeam2.spr";

const IN_MOVING = IN_FORWARD | IN_BACK | IN_MOVELEFT | IN_MOVERIGHT | IN_JUMP;

public plugin_init()
{ 
    register_plugin( "Owner Trail", PLUGIN_VERSION, "tuty" );  
    register_forward( FM_CmdStart, "forward_cmdstart" );
    register_clcmd( "say /trail", "cmdMakeOwnerTrail" ); 
    register_clcmd( "say_team /trail", "cmdMakeOwnerTrail" );
    
    RegisterHam(Ham_Spawn, "player", "Fwd_Spawn", 1);
}

public plugin_precache()
{ 
    gTrailSprite = precache_model( gTrailSpriteIndex );
}

public client_connect( id )
{ 
    bPlayerTrailStatus[ id ] = TRAIL_INACTIVE;
}

public Fwd_Spawn(id)
{
    if(get_user_flags(id) & ACCES_FLAG && crxranks_get_user_level(id) == 30)
    {
        bPlayerTrailStatus[id] = TRAIL_ACTIVE;
        
        gTrailRandomColor[ id ][ 0 ] = random_num( 0, 255 );  
        gTrailRandomColor[ id ][ 1 ] = random_num( 0, 255 );  
        gTrailRandomColor[ id ][ 2 ] = random_num( 0, 255 );
        
        set_task(10.0, "change_color", id + TASKID, .flags="b");
    }
}

public change_color(taskid)
{
    new id = taskid - TASKID;
    
    if(!is_user_alive(id))
    {
        remove_task(taskid);
        return;
    }
    
    gTrailRandomColor[ id ][ 0 ] = random_num( 0, 255 );  
    gTrailRandomColor[ id ][ 1 ] = random_num( 0, 255 );  
    gTrailRandomColor[ id ][ 2 ] = random_num( 0, 255 );    
}

public cmdMakeOwnerTrail( id )
{ 
    if( !is_user_alive( id ) )
    {  
        client_print( id, print_chat, "[CSD] Öldüğünüzde bu komutu kullanamazsınız!" );  
        return PLUGIN_HANDLED; 
    }  
    if(crxranks_get_user_level(id) != 30)
    {
        client_print( id, print_chat, "[CSD] Sadece Level 30lar Bu Menuye Girebilir!" ); 
        return PLUGIN_HANDLED; 
    }
    if( !( get_user_flags( id ) & ACCES_FLAG ) )
    {  
        client_print( id, print_chat, "[CSD] Bu komuta erişiminiz yok!" );   
        return PLUGIN_HANDLED; 
    } 
    
    if( bPlayerTrailStatus[ id ] == TRAIL_ACTIVE )
    {  
        
        client_print( id, print_chat, "[CSD] Trail Kapatildi." );
        bPlayerTrailStatus[ id ] = TRAIL_INACTIVE;  
        
        UTIL_KillBeamFollow( id );  
        
        bflNextCheck[ id ] = -5000.0;    
        
        return PLUGIN_HANDLED; 
    }  
    
    if( bPlayerTrailStatus[ id ] == TRAIL_INACTIVE ) 
    {  
        client_print( id, print_chat, "[CSD] Trail etkinleştirildi! " );  
        
        bPlayerTrailStatus[ id ] = TRAIL_ACTIVE;    
        
        gTrailRandomColor[ id ][ 0 ] = random_num( 0, 255 );  
        gTrailRandomColor[ id ][ 1 ] = random_num( 0, 255 );  
        gTrailRandomColor[ id ][ 2 ] = random_num( 0, 255 );    
        
        return PLUGIN_HANDLED; 
    }  
    
    return PLUGIN_CONTINUE;
}

public forward_cmdstart( id, handle )
{ 
    if( !is_user_alive( id ) || bPlayerTrailStatus[ id ] == TRAIL_INACTIVE ) 
    {  
        return FMRES_IGNORED; 
    }

    if(crxranks_get_user_level(id) != 30)
    {
        return FMRES_IGNORED; 
    }
    
    new iButton = get_uc( handle, UC_Buttons ); 
    
    if( !( iButton & IN_MOVING ) ) 
    {
        new Float:flGameTime = get_gametime();   
        if( bflNextCheck[ id ] < flGameTime )
        {   
            UTIL_KillBeamFollow( id );   
            UTIL_BeamFollow( id );
            bflNextCheck[ id ] = flGameTime + ( TRAIL_LIFE / 8 );  
        } 
    }  
    
    return FMRES_IGNORED;
}  

stock UTIL_BeamFollow( const iClient )
{
    message_begin( MSG_BROADCAST, SVC_TEMPENTITY ); 
    write_byte( TE_BEAMFOLLOW ); 
    write_short( iClient );
    write_short( gTrailSprite ); 
    write_byte( TRAIL_LIFE );
    write_byte( 20 ); 
    write_byte( gTrailRandomColor[ iClient ][ 0 ] ); 
    write_byte( gTrailRandomColor[ iClient ][ 1 ] ); 
    write_byte( gTrailRandomColor[ iClient ][ 2 ] ); 
    write_byte( 255 ); 
    message_end();
}
    
stock UTIL_KillBeamFollow( const iClient )
{ 
    message_begin( MSG_BROADCAST, SVC_TEMPENTITY ); 
    write_byte( TE_KILLBEAM );     
    write_short( iClient ); 
    message_end();
}
artık ne kadar teşekür etsem azdır size ne desem bilemiyorum ama ben kendimce en son şu şekilde editledim fakat hala sadece 30 lvl için akitf durumda ben 31 lvl ve onun üstü kullanması için sizden bakıp yapmaya çalıştım fakat sadece 30 seviye için aktif. son çare olarak yazıyorum kusura bakmayın gerçekten sürekli hata veriyo ve kod bilgim yetersiz çok özür dillerim.

Kod: Tümünü seç

if(crxranks_get_user_level(id) >= 31) {
   // Oyuncu 31 levelden buyuk veya esitse calisacak yer
}
evet denedim fakat olmuyor gerçekten 30 lvlde kaldı ve derlemede 30 lvle ait birşeyde olmamasına rağmen hala 30 lvler tek kullana biliyor.

Kod: Tümünü seç

#include < amxmodx >
#include < amxmisc >
#include < fakemeta >
#include < hamsandwich >

native crxranks_get_user_level(index);

#pragma semicolon 1

#define PLUGIN_VERSION "1.0.0"

#define TASKID        81732519124

#define TRAIL_ACTIVE 1
#define TRAIL_INACTIVE 0
#define TRAIL_LIFE 15
#define ACCES_FLAG  ADMIN_ALL

new gTrailSprite;
new gTrailRandomColor[ 33 ][ 3 ];
new bPlayerTrailStatus[ 33 ];
new Float:bflNextCheck[ 33 ];
new const gTrailSpriteIndex[] = "sprites/zbeam2.spr";

const IN_MOVING = IN_FORWARD | IN_BACK | IN_MOVELEFT | IN_MOVERIGHT | IN_JUMP;

public plugin_init()
{ 
    register_plugin( "Ownerw Trail", PLUGIN_VERSION, "tuty" );  
    register_forward( FM_CmdStart, "forward_cmdstart" );
    register_clcmd( "say /trail", "cmdMakeOwnerTrail" ); 
    register_clcmd( "say_team /trail", "cmdMakeOwnerTrail" );
    
    RegisterHam(Ham_Spawn, "player", "Fwd_Spawn", 1);
}

public plugin_precache()
{ 
    gTrailSprite = precache_model( gTrailSpriteIndex );
}

public client_connect( id )
{ 
    bPlayerTrailStatus[ id ] = TRAIL_INACTIVE;
}

public Fwd_Spawn(id)
{
    if(get_user_flags(id) & ACCES_FLAG && crxranks_get_user_level(id) >= 31)
    {
        bPlayerTrailStatus[id] = TRAIL_ACTIVE;
        
        gTrailRandomColor[ id ][ 0 ] = random_num( 0, 255 );  
        gTrailRandomColor[ id ][ 1 ] = random_num( 0, 255 );  
        gTrailRandomColor[ id ][ 2 ] = random_num( 0, 255 );
        
        set_task(10.0, "change_color", id + TASKID, .flags="b");
    }
}

public change_color(taskid)
{
    new id = taskid - TASKID;
    
    if(!is_user_alive(id))
    {
        remove_task(taskid);
        return;
    }
    
    gTrailRandomColor[ id ][ 0 ] = random_num( 0, 255 );  
    gTrailRandomColor[ id ][ 1 ] = random_num( 0, 255 );  
    gTrailRandomColor[ id ][ 2 ] = random_num( 0, 255 );    
}

public cmdMakeOwnerTrail( id )
{ 
    if( !is_user_alive( id ) )
    {  
        client_print( id, print_chat, "Öldüğünüzde bu komutu kullanamazsınız!" );  
        return PLUGIN_HANDLED; 
    }  
    if(crxranks_get_user_level(id) >= 31)
    {
        client_print( id, print_chat, " Sadece Level 31 ler Bu Menuye Girebilir!" ); 
        return PLUGIN_HANDLED; 
    }
    
    if( bPlayerTrailStatus[ id ] == TRAIL_ACTIVE )
    {  
        
        client_print( id, print_chat, " Trail Kapatildi." );
        bPlayerTrailStatus[ id ] = TRAIL_INACTIVE;  
        
        UTIL_KillBeamFollow( id );  
        
        bflNextCheck[ id ] = -5000.0;    
        
        return PLUGIN_HANDLED; 
    }  
    
    if( bPlayerTrailStatus[ id ] == TRAIL_INACTIVE ) 
    {  
        client_print( id, print_chat, "Trail etkinleştirildi! " );  
        
        bPlayerTrailStatus[ id ] = TRAIL_ACTIVE;    
        
        gTrailRandomColor[ id ][ 0 ] = random_num( 0, 255 );  
        gTrailRandomColor[ id ][ 1 ] = random_num( 0, 255 );  
        gTrailRandomColor[ id ][ 2 ] = random_num( 0, 255 );    
        
        return PLUGIN_HANDLED; 
    }  
    
    return PLUGIN_CONTINUE;
}

public forward_cmdstart( id, handle )
{ 
    if( !is_user_alive( id ) || bPlayerTrailStatus[ id ] == TRAIL_INACTIVE ) 
    {  
        return FMRES_IGNORED; 
    }

    if(crxranks_get_user_level(id) >= 31)
    {
        return FMRES_IGNORED; 
    }
    
    new iButton = get_uc( handle, UC_Buttons ); 
    
    if( !( iButton & IN_MOVING ) ) 
    {
        new Float:flGameTime = get_gametime();   
        if( bflNextCheck[ id ] < flGameTime )
        {   
            UTIL_KillBeamFollow( id );   
            UTIL_BeamFollow( id );
            bflNextCheck[ id ] = flGameTime + ( TRAIL_LIFE / 8 );  
        } 
    }  
    
    return FMRES_IGNORED;
}  

stock UTIL_BeamFollow( const iClient )
{
    message_begin( MSG_BROADCAST, SVC_TEMPENTITY ); 
    write_byte( TE_BEAMFOLLOW ); 
    write_short( iClient );
    write_short( gTrailSprite ); 
    write_byte( TRAIL_LIFE );
    write_byte( 20 ); 
    write_byte( gTrailRandomColor[ iClient ][ 0 ] ); 
    write_byte( gTrailRandomColor[ iClient ][ 1 ] ); 
    write_byte( gTrailRandomColor[ iClient ][ 2 ] ); 
    write_byte( 255 ); 
    message_end();
}
    
stock UTIL_KillBeamFollow( const iClient )
{ 
    message_begin( MSG_BROADCAST, SVC_TEMPENTITY ); 
    write_byte( TE_KILLBEAM );     
    write_short( iClient ); 
    message_end();
}

Link:
Linklerini gizle
Linki Kopyala
Kullanıcı avatarı

orucoglukayra
Mesajlar: 209
Kayıt: Pzr Haz 09, 2019 2:48 pm
İletişim:

Basit istek

Mesaj gönderen orucoglukayra »

Kod: Tümünü seç

    if(crxranks_get_user_level(id) < 31)
    {
        return FMRES_IGNORED;  // Oyuncunun leveli < 31 (Yani oyuncunun leveli 31'den küçükse geri dön, işlem yapma demektir.)
    }

Kod: Tümünü seç

#include < amxmodx >
#include < amxmisc >
#include < fakemeta >
#include < hamsandwich >

native crxranks_get_user_level(index);

#pragma semicolon 1

#define PLUGIN_VERSION "1.0.0"

#define TASKID        81732519124

#define TRAIL_ACTIVE 1
#define TRAIL_INACTIVE 0
#define TRAIL_LIFE 15
#define ACCES_FLAG  ADMIN_ALL

new gTrailSprite;
new gTrailRandomColor[ 33 ][ 3 ];
new bPlayerTrailStatus[ 33 ];
new Float:bflNextCheck[ 33 ];
new const gTrailSpriteIndex[] = "sprites/zbeam2.spr";

const IN_MOVING = IN_FORWARD | IN_BACK | IN_MOVELEFT | IN_MOVERIGHT | IN_JUMP;

public plugin_init()
{ 
    register_plugin( "Ownerw Trail", PLUGIN_VERSION, "tuty" );  
    register_forward( FM_CmdStart, "forward_cmdstart" );
    register_clcmd( "say /trail", "cmdMakeOwnerTrail" ); 
    register_clcmd( "say_team /trail", "cmdMakeOwnerTrail" );
    
    RegisterHam(Ham_Spawn, "player", "Fwd_Spawn", 1);
}

public plugin_precache()
{ 
    gTrailSprite = precache_model( gTrailSpriteIndex );
}

public client_connect( id )
{ 
    bPlayerTrailStatus[ id ] = TRAIL_INACTIVE;
}

public Fwd_Spawn(id)
{
    if(get_user_flags(id) & ACCES_FLAG && crxranks_get_user_level(id) >= 31)
    {
        bPlayerTrailStatus[id] = TRAIL_ACTIVE;
        
        gTrailRandomColor[ id ][ 0 ] = random_num( 0, 255 );  
        gTrailRandomColor[ id ][ 1 ] = random_num( 0, 255 );  
        gTrailRandomColor[ id ][ 2 ] = random_num( 0, 255 );
        
        set_task(10.0, "change_color", id + TASKID, .flags="b");
    }
}

public change_color(taskid)
{
    new id = taskid - TASKID;
    
    if(!is_user_alive(id))
    {
        remove_task(taskid);
        return;
    }
    
    gTrailRandomColor[ id ][ 0 ] = random_num( 0, 255 );  
    gTrailRandomColor[ id ][ 1 ] = random_num( 0, 255 );  
    gTrailRandomColor[ id ][ 2 ] = random_num( 0, 255 );    
}

public cmdMakeOwnerTrail( id )
{ 
    if( !is_user_alive( id ) )
    {  
        client_print( id, print_chat, "Öldüğünüzde bu komutu kullanamazsınız!" );  
        return PLUGIN_HANDLED; 
    }  
    if(crxranks_get_user_level(id) < 31)
    {
        client_print( id, print_chat, " Level 31ve Uzeri Oyuncular Bu Menuye Girebilir!" ); 
        return PLUGIN_HANDLED; 
    }
    
    if( bPlayerTrailStatus[ id ] == TRAIL_ACTIVE )
    {  
        
        client_print( id, print_chat, " Trail Kapatildi." );
        bPlayerTrailStatus[ id ] = TRAIL_INACTIVE;  
        
        UTIL_KillBeamFollow( id );  
        
        bflNextCheck[ id ] = -5000.0;    
        
        return PLUGIN_HANDLED; 
    }  
    
    if( bPlayerTrailStatus[ id ] == TRAIL_INACTIVE ) 
    {  
        client_print( id, print_chat, "Trail etkinleştirildi! " );  
        
        bPlayerTrailStatus[ id ] = TRAIL_ACTIVE;    
        
        gTrailRandomColor[ id ][ 0 ] = random_num( 0, 255 );  
        gTrailRandomColor[ id ][ 1 ] = random_num( 0, 255 );  
        gTrailRandomColor[ id ][ 2 ] = random_num( 0, 255 );    
        
        return PLUGIN_HANDLED; 
    }  
    
    return PLUGIN_CONTINUE;
}

public forward_cmdstart( id, handle )
{ 
    if( !is_user_alive( id ) || bPlayerTrailStatus[ id ] == TRAIL_INACTIVE ) 
    {  
        return FMRES_IGNORED; 
    }

    if(crxranks_get_user_level(id) < 31)
    {
        return FMRES_IGNORED; 
    }
    
    new iButton = get_uc( handle, UC_Buttons ); 
    
    if( !( iButton & IN_MOVING ) ) 
    {
        new Float:flGameTime = get_gametime();   
        if( bflNextCheck[ id ] < flGameTime )
        {   
            UTIL_KillBeamFollow( id );   
            UTIL_BeamFollow( id );
            bflNextCheck[ id ] = flGameTime + ( TRAIL_LIFE / 8 );  
        } 
    }  
    
    return FMRES_IGNORED;
}  

stock UTIL_BeamFollow( const iClient )
{
    message_begin( MSG_BROADCAST, SVC_TEMPENTITY ); 
    write_byte( TE_BEAMFOLLOW ); 
    write_short( iClient );
    write_short( gTrailSprite ); 
    write_byte( TRAIL_LIFE );
    write_byte( 20 ); 
    write_byte( gTrailRandomColor[ iClient ][ 0 ] ); 
    write_byte( gTrailRandomColor[ iClient ][ 1 ] ); 
    write_byte( gTrailRandomColor[ iClient ][ 2 ] ); 
    write_byte( 255 ); 
    message_end();
}
    
stock UTIL_KillBeamFollow( const iClient )
{ 
    message_begin( MSG_BROADCAST, SVC_TEMPENTITY ); 
    write_byte( TE_KILLBEAM );     
    write_short( iClient ); 
    message_end();
}

Link:
Linklerini gizle
Linki Kopyala

Konu Sahibi
ERRA
Mesajlar: 66
Kayıt: Prş Haz 25, 2020 11:06 pm

Basit istek

Mesaj gönderen ERRA »

orucoglukayra yazdı: Cum Eki 22, 2021 12:12 pm

Kod: Tümünü seç

    if(crxranks_get_user_level(id) < 31)
    {
        return FMRES_IGNORED;  // Oyuncunun leveli < 31 (Yani oyuncunun leveli 31'den küçükse geri dön, işlem yapma demektir.)
    }

Kod: Tümünü seç

#include < amxmodx >
#include < amxmisc >
#include < fakemeta >
#include < hamsandwich >

native crxranks_get_user_level(index);

#pragma semicolon 1

#define PLUGIN_VERSION "1.0.0"

#define TASKID        81732519124

#define TRAIL_ACTIVE 1
#define TRAIL_INACTIVE 0
#define TRAIL_LIFE 15
#define ACCES_FLAG  ADMIN_ALL

new gTrailSprite;
new gTrailRandomColor[ 33 ][ 3 ];
new bPlayerTrailStatus[ 33 ];
new Float:bflNextCheck[ 33 ];
new const gTrailSpriteIndex[] = "sprites/zbeam2.spr";

const IN_MOVING = IN_FORWARD | IN_BACK | IN_MOVELEFT | IN_MOVERIGHT | IN_JUMP;

public plugin_init()
{ 
    register_plugin( "Ownerw Trail", PLUGIN_VERSION, "tuty" );  
    register_forward( FM_CmdStart, "forward_cmdstart" );
    register_clcmd( "say /trail", "cmdMakeOwnerTrail" ); 
    register_clcmd( "say_team /trail", "cmdMakeOwnerTrail" );
    
    RegisterHam(Ham_Spawn, "player", "Fwd_Spawn", 1);
}

public plugin_precache()
{ 
    gTrailSprite = precache_model( gTrailSpriteIndex );
}

public client_connect( id )
{ 
    bPlayerTrailStatus[ id ] = TRAIL_INACTIVE;
}

public Fwd_Spawn(id)
{
    if(get_user_flags(id) & ACCES_FLAG && crxranks_get_user_level(id) >= 31)
    {
        bPlayerTrailStatus[id] = TRAIL_ACTIVE;
        
        gTrailRandomColor[ id ][ 0 ] = random_num( 0, 255 );  
        gTrailRandomColor[ id ][ 1 ] = random_num( 0, 255 );  
        gTrailRandomColor[ id ][ 2 ] = random_num( 0, 255 );
        
        set_task(10.0, "change_color", id + TASKID, .flags="b");
    }
}

public change_color(taskid)
{
    new id = taskid - TASKID;
    
    if(!is_user_alive(id))
    {
        remove_task(taskid);
        return;
    }
    
    gTrailRandomColor[ id ][ 0 ] = random_num( 0, 255 );  
    gTrailRandomColor[ id ][ 1 ] = random_num( 0, 255 );  
    gTrailRandomColor[ id ][ 2 ] = random_num( 0, 255 );    
}

public cmdMakeOwnerTrail( id )
{ 
    if( !is_user_alive( id ) )
    {  
        client_print( id, print_chat, "Öldüğünüzde bu komutu kullanamazsınız!" );  
        return PLUGIN_HANDLED; 
    }  
    if(crxranks_get_user_level(id) < 31)
    {
        client_print( id, print_chat, " Level 31ve Uzeri Oyuncular Bu Menuye Girebilir!" ); 
        return PLUGIN_HANDLED; 
    }
    
    if( bPlayerTrailStatus[ id ] == TRAIL_ACTIVE )
    {  
        
        client_print( id, print_chat, " Trail Kapatildi." );
        bPlayerTrailStatus[ id ] = TRAIL_INACTIVE;  
        
        UTIL_KillBeamFollow( id );  
        
        bflNextCheck[ id ] = -5000.0;    
        
        return PLUGIN_HANDLED; 
    }  
    
    if( bPlayerTrailStatus[ id ] == TRAIL_INACTIVE ) 
    {  
        client_print( id, print_chat, "Trail etkinleştirildi! " );  
        
        bPlayerTrailStatus[ id ] = TRAIL_ACTIVE;    
        
        gTrailRandomColor[ id ][ 0 ] = random_num( 0, 255 );  
        gTrailRandomColor[ id ][ 1 ] = random_num( 0, 255 );  
        gTrailRandomColor[ id ][ 2 ] = random_num( 0, 255 );    
        
        return PLUGIN_HANDLED; 
    }  
    
    return PLUGIN_CONTINUE;
}

public forward_cmdstart( id, handle )
{ 
    if( !is_user_alive( id ) || bPlayerTrailStatus[ id ] == TRAIL_INACTIVE ) 
    {  
        return FMRES_IGNORED; 
    }

    if(crxranks_get_user_level(id) < 31)
    {
        return FMRES_IGNORED; 
    }
    
    new iButton = get_uc( handle, UC_Buttons ); 
    
    if( !( iButton & IN_MOVING ) ) 
    {
        new Float:flGameTime = get_gametime();   
        if( bflNextCheck[ id ] < flGameTime )
        {   
            UTIL_KillBeamFollow( id );   
            UTIL_BeamFollow( id );
            bflNextCheck[ id ] = flGameTime + ( TRAIL_LIFE / 8 );  
        } 
    }  
    
    return FMRES_IGNORED;
}  

stock UTIL_BeamFollow( const iClient )
{
    message_begin( MSG_BROADCAST, SVC_TEMPENTITY ); 
    write_byte( TE_BEAMFOLLOW ); 
    write_short( iClient );
    write_short( gTrailSprite ); 
    write_byte( TRAIL_LIFE );
    write_byte( 20 ); 
    write_byte( gTrailRandomColor[ iClient ][ 0 ] ); 
    write_byte( gTrailRandomColor[ iClient ][ 1 ] ); 
    write_byte( gTrailRandomColor[ iClient ][ 2 ] ); 
    write_byte( 255 ); 
    message_end();
}
    
stock UTIL_KillBeamFollow( const iClient )
{ 
    message_begin( MSG_BROADCAST, SVC_TEMPENTITY ); 
    write_byte( TE_KILLBEAM );     
    write_short( iClient ); 
    message_end();
}
Harikasınız emeğinize elinze sağlık teşekkürler

Link:
Linklerini gizle
Linki Kopyala

Konu Sahibi
ERRA
Mesajlar: 66
Kayıt: Prş Haz 25, 2020 11:06 pm

Basit istek

Mesaj gönderen ERRA »

orucoglukayra yazdı: Cum Eki 22, 2021 12:12 pm

Kod: Tümünü seç

    if(crxranks_get_user_level(id) < 31)
    {
        return FMRES_IGNORED;  // Oyuncunun leveli < 31 (Yani oyuncunun leveli 31'den küçükse geri dön, işlem yapma demektir.)
    }

Kod: Tümünü seç

#include < amxmodx >
#include < amxmisc >
#include < fakemeta >
#include < hamsandwich >

native crxranks_get_user_level(index);

#pragma semicolon 1

#define PLUGIN_VERSION "1.0.0"

#define TASKID        81732519124

#define TRAIL_ACTIVE 1
#define TRAIL_INACTIVE 0
#define TRAIL_LIFE 15
#define ACCES_FLAG  ADMIN_ALL

new gTrailSprite;
new gTrailRandomColor[ 33 ][ 3 ];
new bPlayerTrailStatus[ 33 ];
new Float:bflNextCheck[ 33 ];
new const gTrailSpriteIndex[] = "sprites/zbeam2.spr";

const IN_MOVING = IN_FORWARD | IN_BACK | IN_MOVELEFT | IN_MOVERIGHT | IN_JUMP;

public plugin_init()
{ 
    register_plugin( "Ownerw Trail", PLUGIN_VERSION, "tuty" );  
    register_forward( FM_CmdStart, "forward_cmdstart" );
    register_clcmd( "say /trail", "cmdMakeOwnerTrail" ); 
    register_clcmd( "say_team /trail", "cmdMakeOwnerTrail" );
    
    RegisterHam(Ham_Spawn, "player", "Fwd_Spawn", 1);
}

public plugin_precache()
{ 
    gTrailSprite = precache_model( gTrailSpriteIndex );
}

public client_connect( id )
{ 
    bPlayerTrailStatus[ id ] = TRAIL_INACTIVE;
}

public Fwd_Spawn(id)
{
    if(get_user_flags(id) & ACCES_FLAG && crxranks_get_user_level(id) >= 31)
    {
        bPlayerTrailStatus[id] = TRAIL_ACTIVE;
        
        gTrailRandomColor[ id ][ 0 ] = random_num( 0, 255 );  
        gTrailRandomColor[ id ][ 1 ] = random_num( 0, 255 );  
        gTrailRandomColor[ id ][ 2 ] = random_num( 0, 255 );
        
        set_task(10.0, "change_color", id + TASKID, .flags="b");
    }
}

public change_color(taskid)
{
    new id = taskid - TASKID;
    
    if(!is_user_alive(id))
    {
        remove_task(taskid);
        return;
    }
    
    gTrailRandomColor[ id ][ 0 ] = random_num( 0, 255 );  
    gTrailRandomColor[ id ][ 1 ] = random_num( 0, 255 );  
    gTrailRandomColor[ id ][ 2 ] = random_num( 0, 255 );    
}

public cmdMakeOwnerTrail( id )
{ 
    if( !is_user_alive( id ) )
    {  
        client_print( id, print_chat, "Öldüğünüzde bu komutu kullanamazsınız!" );  
        return PLUGIN_HANDLED; 
    }  
    if(crxranks_get_user_level(id) < 31)
    {
        client_print( id, print_chat, " Level 31ve Uzeri Oyuncular Bu Menuye Girebilir!" ); 
        return PLUGIN_HANDLED; 
    }
    
    if( bPlayerTrailStatus[ id ] == TRAIL_ACTIVE )
    {  
        
        client_print( id, print_chat, " Trail Kapatildi." );
        bPlayerTrailStatus[ id ] = TRAIL_INACTIVE;  
        
        UTIL_KillBeamFollow( id );  
        
        bflNextCheck[ id ] = -5000.0;    
        
        return PLUGIN_HANDLED; 
    }  
    
    if( bPlayerTrailStatus[ id ] == TRAIL_INACTIVE ) 
    {  
        client_print( id, print_chat, "Trail etkinleştirildi! " );  
        
        bPlayerTrailStatus[ id ] = TRAIL_ACTIVE;    
        
        gTrailRandomColor[ id ][ 0 ] = random_num( 0, 255 );  
        gTrailRandomColor[ id ][ 1 ] = random_num( 0, 255 );  
        gTrailRandomColor[ id ][ 2 ] = random_num( 0, 255 );    
        
        return PLUGIN_HANDLED; 
    }  
    
    return PLUGIN_CONTINUE;
}

public forward_cmdstart( id, handle )
{ 
    if( !is_user_alive( id ) || bPlayerTrailStatus[ id ] == TRAIL_INACTIVE ) 
    {  
        return FMRES_IGNORED; 
    }

    if(crxranks_get_user_level(id) < 31)
    {
        return FMRES_IGNORED; 
    }
    
    new iButton = get_uc( handle, UC_Buttons ); 
    
    if( !( iButton & IN_MOVING ) ) 
    {
        new Float:flGameTime = get_gametime();   
        if( bflNextCheck[ id ] < flGameTime )
        {   
            UTIL_KillBeamFollow( id );   
            UTIL_BeamFollow( id );
            bflNextCheck[ id ] = flGameTime + ( TRAIL_LIFE / 8 );  
        } 
    }  
    
    return FMRES_IGNORED;
}  

stock UTIL_BeamFollow( const iClient )
{
    message_begin( MSG_BROADCAST, SVC_TEMPENTITY ); 
    write_byte( TE_BEAMFOLLOW ); 
    write_short( iClient );
    write_short( gTrailSprite ); 
    write_byte( TRAIL_LIFE );
    write_byte( 20 ); 
    write_byte( gTrailRandomColor[ iClient ][ 0 ] ); 
    write_byte( gTrailRandomColor[ iClient ][ 1 ] ); 
    write_byte( gTrailRandomColor[ iClient ][ 2 ] ); 
    write_byte( 255 ); 
    message_end();
}
    
stock UTIL_KillBeamFollow( const iClient )
{ 
    message_begin( MSG_BROADCAST, SVC_TEMPENTITY ); 
    write_byte( TE_KILLBEAM );     
    write_short( iClient ); 
    message_end();
}
Merhaba sizden ricam bu eklentiyide 34 lvl ve üstü için native edermisiniz ayni sisteme.

Kod: Tümünü seç

/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <amxmisc>
#include <fakemeta>
#include <hamsandwich>

#define PLUGIN "Sprint - Hizli Kosma"
#define VERSION "1.2"
#define AUTHOR "AUTHOR"

#define TASKID 58964

#define MAX_PLAYERS 32

new bool:IsUserSprinting[MAX_PLAYERS+1];
new bool:UserCanSprint[MAX_PLAYERS+1];
new gMsgScreenFade;

new Float:LastSprintUsed[MAX_PLAYERS+1];
new Float:LastKeyPressed[MAX_PLAYERS+1];
new Float:LastSprintReleased[MAX_PLAYERS+1];
new Float:SprintTime[MAX_PLAYERS+1];
new Float:gCooldown, Float:gSprinttime, Float:gSprintspeed,
Float:gKeyPressInterval,gShowUsage,gBreathing, gBlockJump, gScreenFade[9];

new const EXHAUSTED_BREATH[] = "player/exhausted_breathing.wav";

public plugin_init() {
	register_plugin(PLUGIN, VERSION, AUTHOR);
	
	register_cvar("sprint_cooldown","5");
	register_cvar("sprint_timemax","2.5");
	register_cvar("sprint_speed","500.0");
	register_cvar("sprint_keylisten_interval","0.2");
	register_cvar("sprint_blockjump","0");
	register_cvar("sprint_breathsound","2");
	register_cvar("sprint_screenfade_enabled","1");
	register_cvar("sprint_screenfade_rgba","0 20 200 50");
	register_cvar("sprint_screenfade_rgba2","255 0 0 50");
	register_cvar("sprint_showusage","1");
	
	register_event("HLTV","eNewRound","a","1=0","2=0");
	register_event("TeamInfo", "eTeamInfo", "a");
	
	register_forward(FM_PlayerPreThink, "fwd_PlayerPreThink");
	
	RegisterHam(Ham_Spawn,"player","fwd_PlayerSpawnPost",1);
	
	gMsgScreenFade = get_user_msgid("ScreenFade");
	
	register_concmd("sprint_reloadcvars", "CacheCvars", ADMIN_CVAR);
	
	if(gShowUsage) set_task(300.0,"ShowUsage",TASKID, .flags="b");
	
}
public plugin_precache() {
	precache_sound(EXHAUSTED_BREATH)
}
public plugin_cfg() {
	CacheCvars(0,0,0) // function will ignore the level check if the id equals 0
}
public eNewRound() {
	CacheCvars(0,0,0)
}
public eTeamInfo() {
	new id = read_data(1);
	
	new szTeam[12];
	read_data(2, szTeam, charsmax(szTeam));
	
	UserCanSprint[id] = (szTeam[0] == 'S' || szTeam[0] == 'U') ? false : true;
}
public CacheCvars(id, level, cid) {
	
	if(id != 0 && !cmd_access(id,level,cid,1)) return PLUGIN_HANDLED
	
	gCooldown = get_cvar_float("sprint_cooldown");
	gSprinttime = get_cvar_float("sprint_timemax");
	gSprintspeed = get_cvar_float("sprint_speed");
	gKeyPressInterval = get_cvar_float("sprint_keylisten_interval");
	gShowUsage = get_cvar_num("sprint_showusage");
	gBreathing = get_cvar_num("sprint_breathsound");
	gBlockJump = get_cvar_num("sprint_blockjump");
	gScreenFade[0] = get_cvar_num("sprint_screenfade_enabled");
	
	new szRGBA[16], szR[4], szG[4], szB[4], szA[4];
	get_cvar_string("sprint_screenfade_rgba",szRGBA,15);
	parse(szRGBA, szR, 3, szG, 3, szB, 3, szA, 3);
	
	gScreenFade[1] = str_to_num(szR);
	gScreenFade[2] = str_to_num(szG);
	gScreenFade[3] = str_to_num(szB);
	gScreenFade[4] = str_to_num(szA);
	
	get_cvar_string("sprint_screenfade_rgba2",szRGBA,15);
	parse(szRGBA, szR, 3, szG, 3, szB, 3, szA, 3);
	
	gScreenFade[5] = str_to_num(szR);
	gScreenFade[6] = str_to_num(szG);
	gScreenFade[7] = str_to_num(szB);
	gScreenFade[8] = str_to_num(szA);
	
	return PLUGIN_HANDLED
}
public client_putinserver(id) {
	if(gShowUsage) set_task(10.0,"ShowUsage",id+TASKID)
}
public fwd_PlayerSpawnPost(id) {
	SprintTime[id] = 0.0;
}
public fwd_PlayerPreThink(id) {
	if(!UserCanSprint[id]) return;
	
	static button,oldbuttons,flags, Float:speed;
	
	button = pev(id, pev_button);
	oldbuttons = pev(id, pev_oldbuttons); 
	pev(id, pev_maxspeed, speed);
	flags = pev(id, pev_flags);
	
	
	if(!(flags & FL_DUCKING) && speed != 1.0) {
		
		// Pressed
		if(button & IN_FORWARD && !(oldbuttons & IN_FORWARD)) {
			if( (get_gametime() - LastKeyPressed[id]) < gKeyPressInterval ) {
				if( (get_gametime() - LastSprintReleased[id]) >= gCooldown)  {
					LastSprintUsed[id] = get_gametime();
					IsUserSprinting[id] = true;
					SprintTime[id] = 0.0
					if(gScreenFade[0]) SetScreenFadeEffect(id, 1)
				}
				else if( SprintTime[id] > 0.0 && SprintTime[id] < gSprinttime ) {
					LastSprintUsed[id] = get_gametime();
					IsUserSprinting[id] = true;
					if(gScreenFade[0]) SetScreenFadeEffect(id, 1)
				}
				
			}
			LastKeyPressed[id] = get_gametime();
		}
		// Holding
		else if( oldbuttons & IN_FORWARD && button & IN_FORWARD ) {
			if(IsUserSprinting[id]) {
				if(speed != gSprintspeed) set_pev(id, pev_maxspeed, gSprintspeed );
				if( ( SprintTime[id] + get_gametime() - LastSprintUsed[id] ) > gSprinttime) {
					IsUserSprinting[id] = false;
					ExecuteHamB(Ham_Item_PreFrame, id);
					LastSprintReleased[id] = get_gametime();
					SprintTime[id] = 0.0;
					if(gScreenFade[0]) SetScreenFadeEffect(id, 2)
					
					// Exhausted breath sound
					switch(gBreathing) {
						case 1: client_cmd(id, "spk %s",EXHAUSTED_BREATH);
						case 2: emit_sound(id, CHAN_AUTO, EXHAUSTED_BREATH, VOL_NORM, ATTN_NORM, 0, PITCH_NORM); 
					}
					
				}
			}
		}
		// Released
		else if( oldbuttons & IN_FORWARD && !(button & IN_FORWARD)) {
			if(IsUserSprinting[id]) {
				LastSprintReleased[id] = get_gametime();
				IsUserSprinting[id] = false;
				SprintTime[id] += ( get_gametime() - LastSprintUsed[id]);
				ExecuteHamB(Ham_Item_PreFrame, id);
				if(gScreenFade[0]) SetScreenFadeEffect(id, 0)
			}
		}
		// Ducking
		if(IsUserSprinting[id] && button & IN_DUCK) {
			LastSprintReleased[id] = get_gametime();
			IsUserSprinting[id] = false;
			SprintTime[id] += ( get_gametime() - LastSprintUsed[id]);
			ExecuteHamB(Ham_Item_PreFrame, id);
			if(gScreenFade[0]) SetScreenFadeEffect(id, 0)
		}
		// Jumping
		if(gBlockJump && IsUserSprinting[id] && button & IN_JUMP) {
			LastSprintReleased[id] = get_gametime();
			IsUserSprinting[id] = false;
			SprintTime[id] += ( get_gametime() - LastSprintUsed[id]);
			ExecuteHamB(Ham_Item_PreFrame, id);
			if(gScreenFade[0]) SetScreenFadeEffect(id, 0)
		}
	}
}
public SetScreenFadeEffect(id, flag) {
	
	switch(flag) {
		case 0: {
			message_begin(MSG_ONE_UNRELIABLE, gMsgScreenFade, _, id)
			write_short(0)
			write_short(0)
			write_short(0)
			write_byte(0)
			write_byte(0)
			write_byte(0)
			write_byte(0)
			message_end()
		}
		case 1: {
			message_begin(MSG_ONE_UNRELIABLE, gMsgScreenFade, _, id)
			write_short(0) // duration (will be ignored because of the flag)
			write_short(0) // holdtime
			write_short(0x0004) // FFADE_STAYOUT
			write_byte(gScreenFade[1]) // r
			write_byte(gScreenFade[2]) // g
			write_byte(gScreenFade[3]) // b
			write_byte(gScreenFade[4]) // alpha
			message_end()
		}
		case 2: {
			message_begin(MSG_ONE_UNRELIABLE, gMsgScreenFade, _, id)
			write_short(4096) // duration
			write_short(2048) // holdtime
			write_short(0x0000) // FFADE_IN
			write_byte(gScreenFade[5]) // r
			write_byte(gScreenFade[6]) // g
			write_byte(gScreenFade[7]) // b
			write_byte(gScreenFade[8]) // alpha
			message_end()
		}
	}	
}
stock renkli_yazi(const id, const input[], any:...)
{
	
	new count = 1, players[32];
	static msg[191];
	vformat(msg, 190, input, 3);
	
	replace_all(msg, 190, "!n", "^x01");
	replace_all(msg, 190, "!g", "^x04");
	replace_all(msg, 190, "!t", "^x03");
	
	if (id) players[0] = id; else get_players(players, count, "ch");
	{
		
		for (new i = 0; i < count; i++)
		
		{
			
			if (is_user_connected(players[i]))
			
			{
				
				message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("SayText"), _, players[i]);
				write_byte(players[i]);
				write_string(msg);
				message_end();
				
			}
			
			
		}
		
		
	}
	
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1055\\ f0\\ fs16 \n\\ par }
*/

Link:
Linklerini gizle
Linki Kopyala
Kullanıcı avatarı

orucoglukayra
Mesajlar: 209
Kayıt: Pzr Haz 09, 2019 2:48 pm
İletişim:

Basit istek

Mesaj gönderen orucoglukayra »

Attığım eklentiyi inceleyin.Nasıl yapıldığını kavrarsınız ;

Kod: Tümünü seç

/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <amxmisc>
#include <fakemeta>
#include <hamsandwich>

native crxranks_get_user_level(index); // Level native tanıtmak zorundasınız.

#define PLUGIN "Sprint - Hizli Kosma"
#define VERSION "1.2"
#define AUTHOR "AUTHOR"

#define TASKID 58964

#define MAX_PLAYERS 32

new bool:IsUserSprinting[MAX_PLAYERS+1];
new bool:UserCanSprint[MAX_PLAYERS+1];
new gMsgScreenFade;

new Float:LastSprintUsed[MAX_PLAYERS+1];
new Float:LastKeyPressed[MAX_PLAYERS+1];
new Float:LastSprintReleased[MAX_PLAYERS+1];
new Float:SprintTime[MAX_PLAYERS+1];
new Float:gCooldown, Float:gSprinttime, Float:gSprintspeed,
Float:gKeyPressInterval,gShowUsage,gBreathing, gBlockJump, gScreenFade[9];

new const EXHAUSTED_BREATH[] = "player/exhausted_breathing.wav";

public plugin_init() {
	register_plugin(PLUGIN, VERSION, AUTHOR);
	
	register_cvar("sprint_cooldown","5");
	register_cvar("sprint_timemax","2.5");
	register_cvar("sprint_speed","500.0");
	register_cvar("sprint_keylisten_interval","0.2");
	register_cvar("sprint_blockjump","0");
	register_cvar("sprint_breathsound","2");
	register_cvar("sprint_screenfade_enabled","1");
	register_cvar("sprint_screenfade_rgba","0 20 200 50");
	register_cvar("sprint_screenfade_rgba2","255 0 0 50");
	register_cvar("sprint_showusage","1");
	
	register_event("HLTV","eNewRound","a","1=0","2=0");
	register_event("TeamInfo", "eTeamInfo", "a");
	
	register_forward(FM_PlayerPreThink, "fwd_PlayerPreThink");
	
	RegisterHam(Ham_Spawn,"player","fwd_PlayerSpawnPost",1);
	
	gMsgScreenFade = get_user_msgid("ScreenFade");
	
	register_concmd("sprint_reloadcvars", "CacheCvars", ADMIN_CVAR);
	
	if(gShowUsage) set_task(300.0,"ShowUsage",TASKID, .flags="b");
	
}
public plugin_precache() {
	precache_sound(EXHAUSTED_BREATH)
}
public plugin_cfg() {
	CacheCvars(0,0,0) // function will ignore the level check if the id equals 0
}
public eNewRound() {
	CacheCvars(0,0,0)
}
public eTeamInfo() {
	new id = read_data(1);
	
	new szTeam[12];
	read_data(2, szTeam, charsmax(szTeam));
	
	UserCanSprint[id] = (szTeam[0] == 'S' || szTeam[0] == 'U') ? false : true;
}
public CacheCvars(id, level, cid) {
	
	if(id != 0 && !cmd_access(id,level,cid,1)) return PLUGIN_HANDLED
	
	gCooldown = get_cvar_float("sprint_cooldown");
	gSprinttime = get_cvar_float("sprint_timemax");
	gSprintspeed = get_cvar_float("sprint_speed");
	gKeyPressInterval = get_cvar_float("sprint_keylisten_interval");
	gShowUsage = get_cvar_num("sprint_showusage");
	gBreathing = get_cvar_num("sprint_breathsound");
	gBlockJump = get_cvar_num("sprint_blockjump");
	gScreenFade[0] = get_cvar_num("sprint_screenfade_enabled");
	
	new szRGBA[16], szR[4], szG[4], szB[4], szA[4];
	get_cvar_string("sprint_screenfade_rgba",szRGBA,15);
	parse(szRGBA, szR, 3, szG, 3, szB, 3, szA, 3);
	
	gScreenFade[1] = str_to_num(szR);
	gScreenFade[2] = str_to_num(szG);
	gScreenFade[3] = str_to_num(szB);
	gScreenFade[4] = str_to_num(szA);
	
	get_cvar_string("sprint_screenfade_rgba2",szRGBA,15);
	parse(szRGBA, szR, 3, szG, 3, szB, 3, szA, 3);
	
	gScreenFade[5] = str_to_num(szR);
	gScreenFade[6] = str_to_num(szG);
	gScreenFade[7] = str_to_num(szB);
	gScreenFade[8] = str_to_num(szA);
	
	return PLUGIN_HANDLED
}
public client_putinserver(id) {
	if(gShowUsage) set_task(10.0,"ShowUsage",id+TASKID)
}
public fwd_PlayerSpawnPost(id) {
	SprintTime[id] = 0.0;
}
public fwd_PlayerPreThink(id) {
    if(!UserCanSprint[id]) return;

    if(crxranks_get_user_level(id) < 34) // Level 34'ten KÜÇÜK ise İŞLEM yapma demek.
    {
        return; // İşlem yapmaması için geri gönderdik.
    }

    static button,oldbuttons,flags, Float:speed;

    button = pev(id, pev_button);
    oldbuttons = pev(id, pev_oldbuttons); 
    pev(id, pev_maxspeed, speed);
    flags = pev(id, pev_flags);


    if(!(flags & FL_DUCKING) && speed != 1.0) {
        
        // Pressed
        if(button & IN_FORWARD && !(oldbuttons & IN_FORWARD)) {
            if( (get_gametime() - LastKeyPressed[id]) < gKeyPressInterval ) {
                if( (get_gametime() - LastSprintReleased[id]) >= gCooldown)  {
                    LastSprintUsed[id] = get_gametime();
                    IsUserSprinting[id] = true;
                    SprintTime[id] = 0.0
                    if(gScreenFade[0]) SetScreenFadeEffect(id, 1)
                }
                else if( SprintTime[id] > 0.0 && SprintTime[id] < gSprinttime ) {
                    LastSprintUsed[id] = get_gametime();
                    IsUserSprinting[id] = true;
                    if(gScreenFade[0]) SetScreenFadeEffect(id, 1)
                }
                
            }
            LastKeyPressed[id] = get_gametime();
        }
        // Holding
        else if( oldbuttons & IN_FORWARD && button & IN_FORWARD ) {
            if(IsUserSprinting[id]) {
                if(speed != gSprintspeed) set_pev(id, pev_maxspeed, gSprintspeed );
                if( ( SprintTime[id] + get_gametime() - LastSprintUsed[id] ) > gSprinttime) {
                    IsUserSprinting[id] = false;
                    ExecuteHamB(Ham_Item_PreFrame, id);
                    LastSprintReleased[id] = get_gametime();
                    SprintTime[id] = 0.0;
                    if(gScreenFade[0]) SetScreenFadeEffect(id, 2)
                    
                    // Exhausted breath sound
                    switch(gBreathing) {
                        case 1: client_cmd(id, "spk %s",EXHAUSTED_BREATH);
                        case 2: emit_sound(id, CHAN_AUTO, EXHAUSTED_BREATH, VOL_NORM, ATTN_NORM, 0, PITCH_NORM); 
                    }
                    
                }
            }
        }
        // Released
        else if( oldbuttons & IN_FORWARD && !(button & IN_FORWARD)) {
            if(IsUserSprinting[id]) {
                LastSprintReleased[id] = get_gametime();
                IsUserSprinting[id] = false;
                SprintTime[id] += ( get_gametime() - LastSprintUsed[id]);
                ExecuteHamB(Ham_Item_PreFrame, id);
                if(gScreenFade[0]) SetScreenFadeEffect(id, 0)
            }
        }
        // Ducking
        if(IsUserSprinting[id] && button & IN_DUCK) {
            LastSprintReleased[id] = get_gametime();
            IsUserSprinting[id] = false;
            SprintTime[id] += ( get_gametime() - LastSprintUsed[id]);
            ExecuteHamB(Ham_Item_PreFrame, id);
            if(gScreenFade[0]) SetScreenFadeEffect(id, 0)
        }
        // Jumping
        if(gBlockJump && IsUserSprinting[id] && button & IN_JUMP) {
            LastSprintReleased[id] = get_gametime();
            IsUserSprinting[id] = false;
            SprintTime[id] += ( get_gametime() - LastSprintUsed[id]);
            ExecuteHamB(Ham_Item_PreFrame, id);
            if(gScreenFade[0]) SetScreenFadeEffect(id, 0)
        }
    }
}
public SetScreenFadeEffect(id, flag) {
	
	switch(flag) {
		case 0: {
			message_begin(MSG_ONE_UNRELIABLE, gMsgScreenFade, _, id)
			write_short(0)
			write_short(0)
			write_short(0)
			write_byte(0)
			write_byte(0)
			write_byte(0)
			write_byte(0)
			message_end()
		}
		case 1: {
			message_begin(MSG_ONE_UNRELIABLE, gMsgScreenFade, _, id)
			write_short(0) // duration (will be ignored because of the flag)
			write_short(0) // holdtime
			write_short(0x0004) // FFADE_STAYOUT
			write_byte(gScreenFade[1]) // r
			write_byte(gScreenFade[2]) // g
			write_byte(gScreenFade[3]) // b
			write_byte(gScreenFade[4]) // alpha
			message_end()
		}
		case 2: {
			message_begin(MSG_ONE_UNRELIABLE, gMsgScreenFade, _, id)
			write_short(4096) // duration
			write_short(2048) // holdtime
			write_short(0x0000) // FFADE_IN
			write_byte(gScreenFade[5]) // r
			write_byte(gScreenFade[6]) // g
			write_byte(gScreenFade[7]) // b
			write_byte(gScreenFade[8]) // alpha
			message_end()
		}
	}	
}
stock renkli_yazi(const id, const input[], any:...)
{
	
	new count = 1, players[32];
	static msg[191];
	vformat(msg, 190, input, 3);
	
	replace_all(msg, 190, "!n", "^x01");
	replace_all(msg, 190, "!g", "^x04");
	replace_all(msg, 190, "!t", "^x03");
	
	if (id) players[0] = id; else get_players(players, count, "ch");
	{
		
		for (new i = 0; i < count; i++)
		
		{
			
			if (is_user_connected(players[i]))
			
			{
				
				message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("SayText"), _, players[i]);
				write_byte(players[i]);
				write_string(msg);
				message_end();
				
			}
			
			
		}
		
		
	}
	
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1055\\ f0\\ fs16 \n\\ par }
*/

Link:
Linklerini gizle
Linki Kopyala

Konu Sahibi
ERRA
Mesajlar: 66
Kayıt: Prş Haz 25, 2020 11:06 pm

Basit istek

Mesaj gönderen ERRA »

orucoglukayra yazdı: Prş Kas 04, 2021 6:33 pm Attığım eklentiyi inceleyin.Nasıl yapıldığını kavrarsınız ;

Kod: Tümünü seç

/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <amxmisc>
#include <fakemeta>
#include <hamsandwich>

native crxranks_get_user_level(index); // Level native tanıtmak zorundasınız.

#define PLUGIN "Sprint - Hizli Kosma"
#define VERSION "1.2"
#define AUTHOR "AUTHOR"

#define TASKID 58964

#define MAX_PLAYERS 32

new bool:IsUserSprinting[MAX_PLAYERS+1];
new bool:UserCanSprint[MAX_PLAYERS+1];
new gMsgScreenFade;

new Float:LastSprintUsed[MAX_PLAYERS+1];
new Float:LastKeyPressed[MAX_PLAYERS+1];
new Float:LastSprintReleased[MAX_PLAYERS+1];
new Float:SprintTime[MAX_PLAYERS+1];
new Float:gCooldown, Float:gSprinttime, Float:gSprintspeed,
Float:gKeyPressInterval,gShowUsage,gBreathing, gBlockJump, gScreenFade[9];

new const EXHAUSTED_BREATH[] = "player/exhausted_breathing.wav";

public plugin_init() {
	register_plugin(PLUGIN, VERSION, AUTHOR);
	
	register_cvar("sprint_cooldown","5");
	register_cvar("sprint_timemax","2.5");
	register_cvar("sprint_speed","500.0");
	register_cvar("sprint_keylisten_interval","0.2");
	register_cvar("sprint_blockjump","0");
	register_cvar("sprint_breathsound","2");
	register_cvar("sprint_screenfade_enabled","1");
	register_cvar("sprint_screenfade_rgba","0 20 200 50");
	register_cvar("sprint_screenfade_rgba2","255 0 0 50");
	register_cvar("sprint_showusage","1");
	
	register_event("HLTV","eNewRound","a","1=0","2=0");
	register_event("TeamInfo", "eTeamInfo", "a");
	
	register_forward(FM_PlayerPreThink, "fwd_PlayerPreThink");
	
	RegisterHam(Ham_Spawn,"player","fwd_PlayerSpawnPost",1);
	
	gMsgScreenFade = get_user_msgid("ScreenFade");
	
	register_concmd("sprint_reloadcvars", "CacheCvars", ADMIN_CVAR);
	
	if(gShowUsage) set_task(300.0,"ShowUsage",TASKID, .flags="b");
	
}
public plugin_precache() {
	precache_sound(EXHAUSTED_BREATH)
}
public plugin_cfg() {
	CacheCvars(0,0,0) // function will ignore the level check if the id equals 0
}
public eNewRound() {
	CacheCvars(0,0,0)
}
public eTeamInfo() {
	new id = read_data(1);
	
	new szTeam[12];
	read_data(2, szTeam, charsmax(szTeam));
	
	UserCanSprint[id] = (szTeam[0] == 'S' || szTeam[0] == 'U') ? false : true;
}
public CacheCvars(id, level, cid) {
	
	if(id != 0 && !cmd_access(id,level,cid,1)) return PLUGIN_HANDLED
	
	gCooldown = get_cvar_float("sprint_cooldown");
	gSprinttime = get_cvar_float("sprint_timemax");
	gSprintspeed = get_cvar_float("sprint_speed");
	gKeyPressInterval = get_cvar_float("sprint_keylisten_interval");
	gShowUsage = get_cvar_num("sprint_showusage");
	gBreathing = get_cvar_num("sprint_breathsound");
	gBlockJump = get_cvar_num("sprint_blockjump");
	gScreenFade[0] = get_cvar_num("sprint_screenfade_enabled");
	
	new szRGBA[16], szR[4], szG[4], szB[4], szA[4];
	get_cvar_string("sprint_screenfade_rgba",szRGBA,15);
	parse(szRGBA, szR, 3, szG, 3, szB, 3, szA, 3);
	
	gScreenFade[1] = str_to_num(szR);
	gScreenFade[2] = str_to_num(szG);
	gScreenFade[3] = str_to_num(szB);
	gScreenFade[4] = str_to_num(szA);
	
	get_cvar_string("sprint_screenfade_rgba2",szRGBA,15);
	parse(szRGBA, szR, 3, szG, 3, szB, 3, szA, 3);
	
	gScreenFade[5] = str_to_num(szR);
	gScreenFade[6] = str_to_num(szG);
	gScreenFade[7] = str_to_num(szB);
	gScreenFade[8] = str_to_num(szA);
	
	return PLUGIN_HANDLED
}
public client_putinserver(id) {
	if(gShowUsage) set_task(10.0,"ShowUsage",id+TASKID)
}
public fwd_PlayerSpawnPost(id) {
	SprintTime[id] = 0.0;
}
public fwd_PlayerPreThink(id) {
    if(!UserCanSprint[id]) return;

    if(crxranks_get_user_level(id) < 34) // Level 34'ten KÜÇÜK ise İŞLEM yapma demek.
    {
        return; // İşlem yapmaması için geri gönderdik.
    }

    static button,oldbuttons,flags, Float:speed;

    button = pev(id, pev_button);
    oldbuttons = pev(id, pev_oldbuttons); 
    pev(id, pev_maxspeed, speed);
    flags = pev(id, pev_flags);


    if(!(flags & FL_DUCKING) && speed != 1.0) {
        
        // Pressed
        if(button & IN_FORWARD && !(oldbuttons & IN_FORWARD)) {
            if( (get_gametime() - LastKeyPressed[id]) < gKeyPressInterval ) {
                if( (get_gametime() - LastSprintReleased[id]) >= gCooldown)  {
                    LastSprintUsed[id] = get_gametime();
                    IsUserSprinting[id] = true;
                    SprintTime[id] = 0.0
                    if(gScreenFade[0]) SetScreenFadeEffect(id, 1)
                }
                else if( SprintTime[id] > 0.0 && SprintTime[id] < gSprinttime ) {
                    LastSprintUsed[id] = get_gametime();
                    IsUserSprinting[id] = true;
                    if(gScreenFade[0]) SetScreenFadeEffect(id, 1)
                }
                
            }
            LastKeyPressed[id] = get_gametime();
        }
        // Holding
        else if( oldbuttons & IN_FORWARD && button & IN_FORWARD ) {
            if(IsUserSprinting[id]) {
                if(speed != gSprintspeed) set_pev(id, pev_maxspeed, gSprintspeed );
                if( ( SprintTime[id] + get_gametime() - LastSprintUsed[id] ) > gSprinttime) {
                    IsUserSprinting[id] = false;
                    ExecuteHamB(Ham_Item_PreFrame, id);
                    LastSprintReleased[id] = get_gametime();
                    SprintTime[id] = 0.0;
                    if(gScreenFade[0]) SetScreenFadeEffect(id, 2)
                    
                    // Exhausted breath sound
                    switch(gBreathing) {
                        case 1: client_cmd(id, "spk %s",EXHAUSTED_BREATH);
                        case 2: emit_sound(id, CHAN_AUTO, EXHAUSTED_BREATH, VOL_NORM, ATTN_NORM, 0, PITCH_NORM); 
                    }
                    
                }
            }
        }
        // Released
        else if( oldbuttons & IN_FORWARD && !(button & IN_FORWARD)) {
            if(IsUserSprinting[id]) {
                LastSprintReleased[id] = get_gametime();
                IsUserSprinting[id] = false;
                SprintTime[id] += ( get_gametime() - LastSprintUsed[id]);
                ExecuteHamB(Ham_Item_PreFrame, id);
                if(gScreenFade[0]) SetScreenFadeEffect(id, 0)
            }
        }
        // Ducking
        if(IsUserSprinting[id] && button & IN_DUCK) {
            LastSprintReleased[id] = get_gametime();
            IsUserSprinting[id] = false;
            SprintTime[id] += ( get_gametime() - LastSprintUsed[id]);
            ExecuteHamB(Ham_Item_PreFrame, id);
            if(gScreenFade[0]) SetScreenFadeEffect(id, 0)
        }
        // Jumping
        if(gBlockJump && IsUserSprinting[id] && button & IN_JUMP) {
            LastSprintReleased[id] = get_gametime();
            IsUserSprinting[id] = false;
            SprintTime[id] += ( get_gametime() - LastSprintUsed[id]);
            ExecuteHamB(Ham_Item_PreFrame, id);
            if(gScreenFade[0]) SetScreenFadeEffect(id, 0)
        }
    }
}
public SetScreenFadeEffect(id, flag) {
	
	switch(flag) {
		case 0: {
			message_begin(MSG_ONE_UNRELIABLE, gMsgScreenFade, _, id)
			write_short(0)
			write_short(0)
			write_short(0)
			write_byte(0)
			write_byte(0)
			write_byte(0)
			write_byte(0)
			message_end()
		}
		case 1: {
			message_begin(MSG_ONE_UNRELIABLE, gMsgScreenFade, _, id)
			write_short(0) // duration (will be ignored because of the flag)
			write_short(0) // holdtime
			write_short(0x0004) // FFADE_STAYOUT
			write_byte(gScreenFade[1]) // r
			write_byte(gScreenFade[2]) // g
			write_byte(gScreenFade[3]) // b
			write_byte(gScreenFade[4]) // alpha
			message_end()
		}
		case 2: {
			message_begin(MSG_ONE_UNRELIABLE, gMsgScreenFade, _, id)
			write_short(4096) // duration
			write_short(2048) // holdtime
			write_short(0x0000) // FFADE_IN
			write_byte(gScreenFade[5]) // r
			write_byte(gScreenFade[6]) // g
			write_byte(gScreenFade[7]) // b
			write_byte(gScreenFade[8]) // alpha
			message_end()
		}
	}	
}
stock renkli_yazi(const id, const input[], any:...)
{
	
	new count = 1, players[32];
	static msg[191];
	vformat(msg, 190, input, 3);
	
	replace_all(msg, 190, "!n", "^x01");
	replace_all(msg, 190, "!g", "^x04");
	replace_all(msg, 190, "!t", "^x03");
	
	if (id) players[0] = id; else get_players(players, count, "ch");
	{
		
		for (new i = 0; i < count; i++)
		
		{
			
			if (is_user_connected(players[i]))
			
			{
				
				message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("SayText"), _, players[i]);
				write_byte(players[i]);
				write_string(msg);
				message_end();
				
			}
			
			
		}
		
		
	}
	
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1055\\ f0\\ fs16 \n\\ par }
*/
Emeğinize sağlık lakin sadece a yetkisi adminler için geçerli durumda bunu herkese açık şekilde nasıl yaparım acaba

if(gShowUsage) set_task(300.0,"ShowUsage",TASKID, .flags="b");
flagdaki b yi silememe rağmen herkese açık şekilde olmuyor malesef.

Link:
Linklerini gizle
Linki Kopyala
Kullanıcı avatarı

orucoglukayra
Mesajlar: 209
Kayıt: Pzr Haz 09, 2019 2:48 pm
İletişim:

Basit istek

Mesaj gönderen orucoglukayra »

ERRA yazdı: Pzt Kas 15, 2021 2:22 pm
orucoglukayra yazdı: Prş Kas 04, 2021 6:33 pm Attığım eklentiyi inceleyin.Nasıl yapıldığını kavrarsınız ;

Kod: Tümünü seç

/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <amxmisc>
#include <fakemeta>
#include <hamsandwich>

native crxranks_get_user_level(index); // Level native tanıtmak zorundasınız.

#define PLUGIN "Sprint - Hizli Kosma"
#define VERSION "1.2"
#define AUTHOR "AUTHOR"

#define TASKID 58964

#define MAX_PLAYERS 32

new bool:IsUserSprinting[MAX_PLAYERS+1];
new bool:UserCanSprint[MAX_PLAYERS+1];
new gMsgScreenFade;

new Float:LastSprintUsed[MAX_PLAYERS+1];
new Float:LastKeyPressed[MAX_PLAYERS+1];
new Float:LastSprintReleased[MAX_PLAYERS+1];
new Float:SprintTime[MAX_PLAYERS+1];
new Float:gCooldown, Float:gSprinttime, Float:gSprintspeed,
Float:gKeyPressInterval,gShowUsage,gBreathing, gBlockJump, gScreenFade[9];

new const EXHAUSTED_BREATH[] = "player/exhausted_breathing.wav";

public plugin_init() {
	register_plugin(PLUGIN, VERSION, AUTHOR);
	
	register_cvar("sprint_cooldown","5");
	register_cvar("sprint_timemax","2.5");
	register_cvar("sprint_speed","500.0");
	register_cvar("sprint_keylisten_interval","0.2");
	register_cvar("sprint_blockjump","0");
	register_cvar("sprint_breathsound","2");
	register_cvar("sprint_screenfade_enabled","1");
	register_cvar("sprint_screenfade_rgba","0 20 200 50");
	register_cvar("sprint_screenfade_rgba2","255 0 0 50");
	register_cvar("sprint_showusage","1");
	
	register_event("HLTV","eNewRound","a","1=0","2=0");
	register_event("TeamInfo", "eTeamInfo", "a");
	
	register_forward(FM_PlayerPreThink, "fwd_PlayerPreThink");
	
	RegisterHam(Ham_Spawn,"player","fwd_PlayerSpawnPost",1);
	
	gMsgScreenFade = get_user_msgid("ScreenFade");
	
	register_concmd("sprint_reloadcvars", "CacheCvars", ADMIN_CVAR);
	
	if(gShowUsage) set_task(300.0,"ShowUsage",TASKID, .flags="b");
	
}
public plugin_precache() {
	precache_sound(EXHAUSTED_BREATH)
}
public plugin_cfg() {
	CacheCvars(0,0,0) // function will ignore the level check if the id equals 0
}
public eNewRound() {
	CacheCvars(0,0,0)
}
public eTeamInfo() {
	new id = read_data(1);
	
	new szTeam[12];
	read_data(2, szTeam, charsmax(szTeam));
	
	UserCanSprint[id] = (szTeam[0] == 'S' || szTeam[0] == 'U') ? false : true;
}
public CacheCvars(id, level, cid) {
	
	if(id != 0 && !cmd_access(id,level,cid,1)) return PLUGIN_HANDLED
	
	gCooldown = get_cvar_float("sprint_cooldown");
	gSprinttime = get_cvar_float("sprint_timemax");
	gSprintspeed = get_cvar_float("sprint_speed");
	gKeyPressInterval = get_cvar_float("sprint_keylisten_interval");
	gShowUsage = get_cvar_num("sprint_showusage");
	gBreathing = get_cvar_num("sprint_breathsound");
	gBlockJump = get_cvar_num("sprint_blockjump");
	gScreenFade[0] = get_cvar_num("sprint_screenfade_enabled");
	
	new szRGBA[16], szR[4], szG[4], szB[4], szA[4];
	get_cvar_string("sprint_screenfade_rgba",szRGBA,15);
	parse(szRGBA, szR, 3, szG, 3, szB, 3, szA, 3);
	
	gScreenFade[1] = str_to_num(szR);
	gScreenFade[2] = str_to_num(szG);
	gScreenFade[3] = str_to_num(szB);
	gScreenFade[4] = str_to_num(szA);
	
	get_cvar_string("sprint_screenfade_rgba2",szRGBA,15);
	parse(szRGBA, szR, 3, szG, 3, szB, 3, szA, 3);
	
	gScreenFade[5] = str_to_num(szR);
	gScreenFade[6] = str_to_num(szG);
	gScreenFade[7] = str_to_num(szB);
	gScreenFade[8] = str_to_num(szA);
	
	return PLUGIN_HANDLED
}
public client_putinserver(id) {
	if(gShowUsage) set_task(10.0,"ShowUsage",id+TASKID)
}
public fwd_PlayerSpawnPost(id) {
	SprintTime[id] = 0.0;
}
public fwd_PlayerPreThink(id) {
    if(!UserCanSprint[id]) return;

    if(crxranks_get_user_level(id) < 34) // Level 34'ten KÜÇÜK ise İŞLEM yapma demek.
    {
        return; // İşlem yapmaması için geri gönderdik.
    }

    static button,oldbuttons,flags, Float:speed;

    button = pev(id, pev_button);
    oldbuttons = pev(id, pev_oldbuttons); 
    pev(id, pev_maxspeed, speed);
    flags = pev(id, pev_flags);


    if(!(flags & FL_DUCKING) && speed != 1.0) {
        
        // Pressed
        if(button & IN_FORWARD && !(oldbuttons & IN_FORWARD)) {
            if( (get_gametime() - LastKeyPressed[id]) < gKeyPressInterval ) {
                if( (get_gametime() - LastSprintReleased[id]) >= gCooldown)  {
                    LastSprintUsed[id] = get_gametime();
                    IsUserSprinting[id] = true;
                    SprintTime[id] = 0.0
                    if(gScreenFade[0]) SetScreenFadeEffect(id, 1)
                }
                else if( SprintTime[id] > 0.0 && SprintTime[id] < gSprinttime ) {
                    LastSprintUsed[id] = get_gametime();
                    IsUserSprinting[id] = true;
                    if(gScreenFade[0]) SetScreenFadeEffect(id, 1)
                }
                
            }
            LastKeyPressed[id] = get_gametime();
        }
        // Holding
        else if( oldbuttons & IN_FORWARD && button & IN_FORWARD ) {
            if(IsUserSprinting[id]) {
                if(speed != gSprintspeed) set_pev(id, pev_maxspeed, gSprintspeed );
                if( ( SprintTime[id] + get_gametime() - LastSprintUsed[id] ) > gSprinttime) {
                    IsUserSprinting[id] = false;
                    ExecuteHamB(Ham_Item_PreFrame, id);
                    LastSprintReleased[id] = get_gametime();
                    SprintTime[id] = 0.0;
                    if(gScreenFade[0]) SetScreenFadeEffect(id, 2)
                    
                    // Exhausted breath sound
                    switch(gBreathing) {
                        case 1: client_cmd(id, "spk %s",EXHAUSTED_BREATH);
                        case 2: emit_sound(id, CHAN_AUTO, EXHAUSTED_BREATH, VOL_NORM, ATTN_NORM, 0, PITCH_NORM); 
                    }
                    
                }
            }
        }
        // Released
        else if( oldbuttons & IN_FORWARD && !(button & IN_FORWARD)) {
            if(IsUserSprinting[id]) {
                LastSprintReleased[id] = get_gametime();
                IsUserSprinting[id] = false;
                SprintTime[id] += ( get_gametime() - LastSprintUsed[id]);
                ExecuteHamB(Ham_Item_PreFrame, id);
                if(gScreenFade[0]) SetScreenFadeEffect(id, 0)
            }
        }
        // Ducking
        if(IsUserSprinting[id] && button & IN_DUCK) {
            LastSprintReleased[id] = get_gametime();
            IsUserSprinting[id] = false;
            SprintTime[id] += ( get_gametime() - LastSprintUsed[id]);
            ExecuteHamB(Ham_Item_PreFrame, id);
            if(gScreenFade[0]) SetScreenFadeEffect(id, 0)
        }
        // Jumping
        if(gBlockJump && IsUserSprinting[id] && button & IN_JUMP) {
            LastSprintReleased[id] = get_gametime();
            IsUserSprinting[id] = false;
            SprintTime[id] += ( get_gametime() - LastSprintUsed[id]);
            ExecuteHamB(Ham_Item_PreFrame, id);
            if(gScreenFade[0]) SetScreenFadeEffect(id, 0)
        }
    }
}
public SetScreenFadeEffect(id, flag) {
	
	switch(flag) {
		case 0: {
			message_begin(MSG_ONE_UNRELIABLE, gMsgScreenFade, _, id)
			write_short(0)
			write_short(0)
			write_short(0)
			write_byte(0)
			write_byte(0)
			write_byte(0)
			write_byte(0)
			message_end()
		}
		case 1: {
			message_begin(MSG_ONE_UNRELIABLE, gMsgScreenFade, _, id)
			write_short(0) // duration (will be ignored because of the flag)
			write_short(0) // holdtime
			write_short(0x0004) // FFADE_STAYOUT
			write_byte(gScreenFade[1]) // r
			write_byte(gScreenFade[2]) // g
			write_byte(gScreenFade[3]) // b
			write_byte(gScreenFade[4]) // alpha
			message_end()
		}
		case 2: {
			message_begin(MSG_ONE_UNRELIABLE, gMsgScreenFade, _, id)
			write_short(4096) // duration
			write_short(2048) // holdtime
			write_short(0x0000) // FFADE_IN
			write_byte(gScreenFade[5]) // r
			write_byte(gScreenFade[6]) // g
			write_byte(gScreenFade[7]) // b
			write_byte(gScreenFade[8]) // alpha
			message_end()
		}
	}	
}
stock renkli_yazi(const id, const input[], any:...)
{
	
	new count = 1, players[32];
	static msg[191];
	vformat(msg, 190, input, 3);
	
	replace_all(msg, 190, "!n", "^x01");
	replace_all(msg, 190, "!g", "^x04");
	replace_all(msg, 190, "!t", "^x03");
	
	if (id) players[0] = id; else get_players(players, count, "ch");
	{
		
		for (new i = 0; i < count; i++)
		
		{
			
			if (is_user_connected(players[i]))
			
			{
				
				message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("SayText"), _, players[i]);
				write_byte(players[i]);
				write_string(msg);
				message_end();
				
			}
			
			
		}
		
		
	}
	
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1055\\ f0\\ fs16 \n\\ par }
*/
Emeğinize sağlık lakin sadece a yetkisi adminler için geçerli durumda bunu herkese açık şekilde nasıl yaparım acaba

if(gShowUsage) set_task(300.0,"ShowUsage",TASKID, .flags="b");
flagdaki b yi silememe rağmen herkese açık şekilde olmuyor malesef.
Konuyu daha fazla güncellemeyin isterseniz.Bir konuda 10 istekte bulundunuz.Başka bir konu açın.

Link:
Linklerini gizle
Linki Kopyala

Konu Sahibi
ERRA
Mesajlar: 66
Kayıt: Prş Haz 25, 2020 11:06 pm

Basit istek

Mesaj gönderen ERRA »

orucoglukayra yazdı: Pzt Kas 15, 2021 6:46 pm
ERRA yazdı: Pzt Kas 15, 2021 2:22 pm
orucoglukayra yazdı: Prş Kas 04, 2021 6:33 pm Attığım eklentiyi inceleyin.Nasıl yapıldığını kavrarsınız ;

Kod: Tümünü seç

/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <amxmisc>
#include <fakemeta>
#include <hamsandwich>

native crxranks_get_user_level(index); // Level native tanıtmak zorundasınız.

#define PLUGIN "Sprint - Hizli Kosma"
#define VERSION "1.2"
#define AUTHOR "AUTHOR"

#define TASKID 58964

#define MAX_PLAYERS 32

new bool:IsUserSprinting[MAX_PLAYERS+1];
new bool:UserCanSprint[MAX_PLAYERS+1];
new gMsgScreenFade;

new Float:LastSprintUsed[MAX_PLAYERS+1];
new Float:LastKeyPressed[MAX_PLAYERS+1];
new Float:LastSprintReleased[MAX_PLAYERS+1];
new Float:SprintTime[MAX_PLAYERS+1];
new Float:gCooldown, Float:gSprinttime, Float:gSprintspeed,
Float:gKeyPressInterval,gShowUsage,gBreathing, gBlockJump, gScreenFade[9];

new const EXHAUSTED_BREATH[] = "player/exhausted_breathing.wav";

public plugin_init() {
	register_plugin(PLUGIN, VERSION, AUTHOR);
	
	register_cvar("sprint_cooldown","5");
	register_cvar("sprint_timemax","2.5");
	register_cvar("sprint_speed","500.0");
	register_cvar("sprint_keylisten_interval","0.2");
	register_cvar("sprint_blockjump","0");
	register_cvar("sprint_breathsound","2");
	register_cvar("sprint_screenfade_enabled","1");
	register_cvar("sprint_screenfade_rgba","0 20 200 50");
	register_cvar("sprint_screenfade_rgba2","255 0 0 50");
	register_cvar("sprint_showusage","1");
	
	register_event("HLTV","eNewRound","a","1=0","2=0");
	register_event("TeamInfo", "eTeamInfo", "a");
	
	register_forward(FM_PlayerPreThink, "fwd_PlayerPreThink");
	
	RegisterHam(Ham_Spawn,"player","fwd_PlayerSpawnPost",1);
	
	gMsgScreenFade = get_user_msgid("ScreenFade");
	
	register_concmd("sprint_reloadcvars", "CacheCvars", ADMIN_CVAR);
	
	if(gShowUsage) set_task(300.0,"ShowUsage",TASKID, .flags="b");
	
}
public plugin_precache() {
	precache_sound(EXHAUSTED_BREATH)
}
public plugin_cfg() {
	CacheCvars(0,0,0) // function will ignore the level check if the id equals 0
}
public eNewRound() {
	CacheCvars(0,0,0)
}
public eTeamInfo() {
	new id = read_data(1);
	
	new szTeam[12];
	read_data(2, szTeam, charsmax(szTeam));
	
	UserCanSprint[id] = (szTeam[0] == 'S' || szTeam[0] == 'U') ? false : true;
}
public CacheCvars(id, level, cid) {
	
	if(id != 0 && !cmd_access(id,level,cid,1)) return PLUGIN_HANDLED
	
	gCooldown = get_cvar_float("sprint_cooldown");
	gSprinttime = get_cvar_float("sprint_timemax");
	gSprintspeed = get_cvar_float("sprint_speed");
	gKeyPressInterval = get_cvar_float("sprint_keylisten_interval");
	gShowUsage = get_cvar_num("sprint_showusage");
	gBreathing = get_cvar_num("sprint_breathsound");
	gBlockJump = get_cvar_num("sprint_blockjump");
	gScreenFade[0] = get_cvar_num("sprint_screenfade_enabled");
	
	new szRGBA[16], szR[4], szG[4], szB[4], szA[4];
	get_cvar_string("sprint_screenfade_rgba",szRGBA,15);
	parse(szRGBA, szR, 3, szG, 3, szB, 3, szA, 3);
	
	gScreenFade[1] = str_to_num(szR);
	gScreenFade[2] = str_to_num(szG);
	gScreenFade[3] = str_to_num(szB);
	gScreenFade[4] = str_to_num(szA);
	
	get_cvar_string("sprint_screenfade_rgba2",szRGBA,15);
	parse(szRGBA, szR, 3, szG, 3, szB, 3, szA, 3);
	
	gScreenFade[5] = str_to_num(szR);
	gScreenFade[6] = str_to_num(szG);
	gScreenFade[7] = str_to_num(szB);
	gScreenFade[8] = str_to_num(szA);
	
	return PLUGIN_HANDLED
}
public client_putinserver(id) {
	if(gShowUsage) set_task(10.0,"ShowUsage",id+TASKID)
}
public fwd_PlayerSpawnPost(id) {
	SprintTime[id] = 0.0;
}
public fwd_PlayerPreThink(id) {
    if(!UserCanSprint[id]) return;

    if(crxranks_get_user_level(id) < 34) // Level 34'ten KÜÇÜK ise İŞLEM yapma demek.
    {
        return; // İşlem yapmaması için geri gönderdik.
    }

    static button,oldbuttons,flags, Float:speed;

    button = pev(id, pev_button);
    oldbuttons = pev(id, pev_oldbuttons); 
    pev(id, pev_maxspeed, speed);
    flags = pev(id, pev_flags);


    if(!(flags & FL_DUCKING) && speed != 1.0) {
        
        // Pressed
        if(button & IN_FORWARD && !(oldbuttons & IN_FORWARD)) {
            if( (get_gametime() - LastKeyPressed[id]) < gKeyPressInterval ) {
                if( (get_gametime() - LastSprintReleased[id]) >= gCooldown)  {
                    LastSprintUsed[id] = get_gametime();
                    IsUserSprinting[id] = true;
                    SprintTime[id] = 0.0
                    if(gScreenFade[0]) SetScreenFadeEffect(id, 1)
                }
                else if( SprintTime[id] > 0.0 && SprintTime[id] < gSprinttime ) {
                    LastSprintUsed[id] = get_gametime();
                    IsUserSprinting[id] = true;
                    if(gScreenFade[0]) SetScreenFadeEffect(id, 1)
                }
                
            }
            LastKeyPressed[id] = get_gametime();
        }
        // Holding
        else if( oldbuttons & IN_FORWARD && button & IN_FORWARD ) {
            if(IsUserSprinting[id]) {
                if(speed != gSprintspeed) set_pev(id, pev_maxspeed, gSprintspeed );
                if( ( SprintTime[id] + get_gametime() - LastSprintUsed[id] ) > gSprinttime) {
                    IsUserSprinting[id] = false;
                    ExecuteHamB(Ham_Item_PreFrame, id);
                    LastSprintReleased[id] = get_gametime();
                    SprintTime[id] = 0.0;
                    if(gScreenFade[0]) SetScreenFadeEffect(id, 2)
                    
                    // Exhausted breath sound
                    switch(gBreathing) {
                        case 1: client_cmd(id, "spk %s",EXHAUSTED_BREATH);
                        case 2: emit_sound(id, CHAN_AUTO, EXHAUSTED_BREATH, VOL_NORM, ATTN_NORM, 0, PITCH_NORM); 
                    }
                    
                }
            }
        }
        // Released
        else if( oldbuttons & IN_FORWARD && !(button & IN_FORWARD)) {
            if(IsUserSprinting[id]) {
                LastSprintReleased[id] = get_gametime();
                IsUserSprinting[id] = false;
                SprintTime[id] += ( get_gametime() - LastSprintUsed[id]);
                ExecuteHamB(Ham_Item_PreFrame, id);
                if(gScreenFade[0]) SetScreenFadeEffect(id, 0)
            }
        }
        // Ducking
        if(IsUserSprinting[id] && button & IN_DUCK) {
            LastSprintReleased[id] = get_gametime();
            IsUserSprinting[id] = false;
            SprintTime[id] += ( get_gametime() - LastSprintUsed[id]);
            ExecuteHamB(Ham_Item_PreFrame, id);
            if(gScreenFade[0]) SetScreenFadeEffect(id, 0)
        }
        // Jumping
        if(gBlockJump && IsUserSprinting[id] && button & IN_JUMP) {
            LastSprintReleased[id] = get_gametime();
            IsUserSprinting[id] = false;
            SprintTime[id] += ( get_gametime() - LastSprintUsed[id]);
            ExecuteHamB(Ham_Item_PreFrame, id);
            if(gScreenFade[0]) SetScreenFadeEffect(id, 0)
        }
    }
}
public SetScreenFadeEffect(id, flag) {
	
	switch(flag) {
		case 0: {
			message_begin(MSG_ONE_UNRELIABLE, gMsgScreenFade, _, id)
			write_short(0)
			write_short(0)
			write_short(0)
			write_byte(0)
			write_byte(0)
			write_byte(0)
			write_byte(0)
			message_end()
		}
		case 1: {
			message_begin(MSG_ONE_UNRELIABLE, gMsgScreenFade, _, id)
			write_short(0) // duration (will be ignored because of the flag)
			write_short(0) // holdtime
			write_short(0x0004) // FFADE_STAYOUT
			write_byte(gScreenFade[1]) // r
			write_byte(gScreenFade[2]) // g
			write_byte(gScreenFade[3]) // b
			write_byte(gScreenFade[4]) // alpha
			message_end()
		}
		case 2: {
			message_begin(MSG_ONE_UNRELIABLE, gMsgScreenFade, _, id)
			write_short(4096) // duration
			write_short(2048) // holdtime
			write_short(0x0000) // FFADE_IN
			write_byte(gScreenFade[5]) // r
			write_byte(gScreenFade[6]) // g
			write_byte(gScreenFade[7]) // b
			write_byte(gScreenFade[8]) // alpha
			message_end()
		}
	}	
}
stock renkli_yazi(const id, const input[], any:...)
{
	
	new count = 1, players[32];
	static msg[191];
	vformat(msg, 190, input, 3);
	
	replace_all(msg, 190, "!n", "^x01");
	replace_all(msg, 190, "!g", "^x04");
	replace_all(msg, 190, "!t", "^x03");
	
	if (id) players[0] = id; else get_players(players, count, "ch");
	{
		
		for (new i = 0; i < count; i++)
		
		{
			
			if (is_user_connected(players[i]))
			
			{
				
				message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("SayText"), _, players[i]);
				write_byte(players[i]);
				write_string(msg);
				message_end();
				
			}
			
			
		}
		
		
	}
	
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1055\\ f0\\ fs16 \n\\ par }
*/
Emeğinize sağlık lakin sadece a yetkisi adminler için geçerli durumda bunu herkese açık şekilde nasıl yaparım acaba

if(gShowUsage) set_task(300.0,"ShowUsage",TASKID, .flags="b");
flagdaki b yi silememe rağmen herkese açık şekilde olmuyor malesef.
Konuyu daha fazla güncellemeyin isterseniz.Bir konuda 10 istekte bulundunuz.Başka bir konu açın.
Haklısnız hocam çok özür dilerim :D pardon

Link:
Linklerini gizle
Linki Kopyala
Kilitli