Raised This Month: $ Target: $400
 0% 

Lead Plugin


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
NooTy
Member
Join Date: Sep 2019
Old 05-28-2020 , 07:06   Lead Plugin
Reply With Quote #1

Hi, I Have Alot Of Problems In My Code
Anyone Please help me
Code:
#include <amxmodx>
#include <fun>
#include <cstrike>
#include <hamsandwich>

new bool:IsLead[33];
new bool:LeadC[33];
new bool:LeadT[33];

#define PLUGIN "Lead"
#define VERSION "1.0"
#define AUTHOR "NooTy^^"


public plugin_init() {
	register_plugin(PLUGIN, VERSION, AUTHOR)
	
	register_logevent("logevent_round_start", 2, "1=Round_Start");
	register_logevent("logevent_round_end", 2, "1=Round_End");
	
	register_clcmd("say /lead","hi");
}
public plugin_cfg() {
	set_task(3.0, "Leade");
}
public plugin_precache() {
   precache_sound("jailbreak/kills/lead.wav");
   precache_sound("jailbreak/kills/out.wav");
}

public logevent_round_start(id) {
	LeadC[id]=false;
	LeadT[id]=false;
	IsLead[id]=false;
	set_task(1.0, "GetHighestScore");
}
public logevent_round_end(id) {
	if(IsLead[id]){
	client_cmd(id, "spk jailbreak/kills/out");
	ColorChat(0 , "!g[EgYpT-JB] !tYou Have Lost The Lead");
}
}
public GetHighestScore()
{
    new iPlayers[ 32 ] , iNum , id,T ,CT, iFrags,iFrags2, iTeam;
    new T_Frags[ 33 ][ 2 ]; 
    new CT_Frags[ 33 ][ 2 ]; 
    
    get_players( iPlayers , iNum );

    for ( new i = 0 ; i < iNum ; i++ )
    {
        id = iPlayers[ i ];
        iFrags = get_user_frags( id );
        iTeam = _:cs_get_user_team( id );
        
        switch ( iTeam )
        {
            case CS_TEAM_T: 
            {
                T_Frags[ id ][ 0 ] = T;
                T_Frags[ id ][ 1 ] = iFrags;
            }
            case CS_TEAM_CT:
            {
                CT_Frags[ id ][ 0 ] = CT;
                CT_Frags[ id ][ 1 ] = iFrags2;            
            }
        }    
    }
    
    SortCustom2D( T_Frags , 33 , "fn_StatsCompare" );
    SortCustom2D( CT_Frags , 33 , "fn_StatsCompare" );
    new szNameCT[ 33 ];
    new szNameT[ 33 ];
    for ( new p = 0 ; p < 15 ; p++ )
    {
        T = T_Frags[ p ][ 0 ];
        CT = CT_Frags[ p ][ 0 ];

        if (T){
	    LeadT[T] = true
	    IsLead[T] = true
            get_user_name( T , szNameT , 32 );
            ColorChat(0 , "!g[EgYpT-JB] !t%s !nIs The !tLead !nof !tT" , szNameT);
	   client_cmd(T, "spk jailbreak/kills/lead");
        }
	if(CT){
	    LeadC[CT] = true
	    IsLead[CT] = true
	   get_user_name( CT , szNameCT , 32 );
            ColorChat(0 , "!g[EgYpT-JB] !t%s !nIs The !tLead !nof !tCT" , szNameCT);
	   client_cmd(CT, "spk jailbreak/kills/lead");
	}
        else
        {
            break;
        }
    }
}
public Leade(id) {
	if (IsLead[id]){
		
	if(LeadC[id]){
	if (get_user_team( id ) == 2){
	if(get_user_health(id) <= 255){
	set_user_health(id, get_user_health(id)+1);
}
	}
}
	if(LeadT[id]){
	if (get_user_team( id ) == 1){
	if(get_user_health(id) <= 150){
	set_user_health(id, get_user_health(id)+1);
}
	}
}
	set_task(3.0, "Leade",id);
}
}
public fn_StatsCompare( elem1[] , elem2[] )
{
    if( elem1[1] > elem2[1] ) 
        return -1;
    else if( elem1[1] < elem2[1] )
        return 1;
    
    return 0;
}
public hi(id){
	if(IsLead[id]) {
		set_hudmessage(255, 170, 255, 0.32, 0.87, 0.0, 2.0, 2.0);
		show_hudmessage(id, "You Are A Lead");
	}
	else {
		set_hudmessage(255, 170, 255, 0.32, 0.87, 0.0, 2.0, 2.0);
		show_hudmessage(id, "You Are Not A Lead");
	}

	return PLUGIN_HANDLED;
}
stock ColorChat(const id, const input[], any:...) { 
    new count = 1, players[32]; 
    static msg[191]; 
    vformat(msg, 190, input, 3); 
     
    replace_all(msg, 190, "!g", "^4"); // Green Color 
    replace_all(msg, 190, "!n", "^1"); // Default Color 
    replace_all(msg, 190, "!t", "^3"); // Team Color
    replace_all(msg, 190, "!t2", "^0"); // Team2 Color 
     
    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(); 
            } 
        } 
    } 
}
NooTy is offline
 


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 17:06.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode