Raised This Month: $51 Target: $400
 12% 

API Scripting Help Aps Leader from 4.3 to 5.0


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
ESPADONGAMING
Senior Member
Join Date: Mar 2011
Location: In the Game [ro]
Old 11-07-2011 , 17:47   Aps Leader from 4.3 to 5.0
Reply With Quote #1

Aps Leader from 4.3 to 5.0
Can somebody convert some sort of aps leader from 4.3 to 5.0?

error
Code:
L 11/08/2011 - 00:46:11: [ZP] Invalid Player (0)
L 11/08/2011 - 00:46:11: [AMXX] Displaying debug trace (plugin "zp_aps_leader.amxx")
L 11/08/2011 - 00:46:11: [AMXX] Run time error 10: native error (native "zp_get_user_ammo_packs")
L 11/08/2011 - 00:46:11: [AMXX]    [0] zp_aps_leader.sma::Leader (line 63)
plugins
Code:
#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <zombieplague>

#define PLUGIN     "[ZP] Addon: APs Leader"
#define VERSION "1.2"
#define AUTHOR    "Kiske"

// Cvars
new leader_msj

// Others
new MaxPlayers, SayText

public plugin_init()
{
    register_plugin(PLUGIN, VERSION, AUTHOR)
    
    // Language Files
    register_dictionary("aps_leader.txt")
    
    // Cvars
    leader_msj = register_cvar("zp_leader_msj", "3")
    /*
    zp_leader_msj 0. Plugin Disable.
    zp_leader_msj 1. Message at RoundStart.
    zp_leader_msj 2. Message when you say or say_team "/leader".
    zp_leader_msj 3. Both.
    */
    
    // Client Commands
    register_clcmd("say /leader", "CheckLeader_Ammo")
    register_clcmd("say_team /leader", "CheckLeader_Ammo")
    
    // Event
    register_event("HLTV", "RoundStart", "a", "1=0", "2=0")
    
    // Others
    SayText = get_user_msgid("SayText")
    MaxPlayers = get_maxplayers()
}

public RoundStart()
{
    if ( get_pcvar_num(leader_msj) == 1 || get_pcvar_num(leader_msj) == 3 )
        set_task(1.6, "Leader") // I use this set_task to the message appears then of "welcome_msg"
}

public Leader()
{
    if ( get_pcvar_num(leader_msj) == 1 || get_pcvar_num(leader_msj) == 3 )
    {
        new iAmmoPacks
        new iLeader = GetLeader_Ammo(iAmmoPacks)
        new Players = UsersGetPlaying()
        new iPlayers[32], iNum, Others
        new szName[32]
        get_user_name( iLeader, szName, 31 )
        get_players( iPlayers, iNum, "ch" )
        
        for ( new i = 0; i < iNum; i++ )
            Others = zp_get_user_ammo_packs(i)
    
        if ( Players == 0 )
            ChatColor( 0, "%L", LANG_PLAYER, "NO_PLAYERS" )
        else if ( iAmmoPacks == Others )
            ChatColor( 0, "%L", LANG_PLAYER, "MORE_LEADERS_AMMO" )
        else
            ChatColor( 0, "%L", LANG_PLAYER, "LEADER_AMMO", szName, iAmmoPacks )
    }
    set_task(0.1, "Leader_Frags")
}

public Leader_Frags()
{
    if ( get_pcvar_num(leader_msj) == 1 || get_pcvar_num(leader_msj) == 3 )
    {
        new iFrags
        new iLeader = GetLeader_Frags(iFrags)
        new Players = UsersGetPlaying()
        new iPlayers[32], iNum, Others
        new szName[32]
        get_user_name( iLeader, szName, 31 )
        get_players( iPlayers, iNum, "ch" )
        
        for ( new i = 0; i < iNum; i++ )
            Others = get_user_frags(i)
    
        if ( Players == 0 )
            ChatColor( 0, "%L", LANG_PLAYER, "NO_PLAYERS" )
        else if ( iFrags == Others )
            ChatColor( 0, "%L", LANG_PLAYER, "MORE_LEADERS_FRAGS" )
        else
            ChatColor( 0, "%L", LANG_PLAYER, "LEADER_FRAGS", szName, iFrags )
    }
}

// Check Leader
public CheckLeader_Ammo(id)
{
    if ( get_pcvar_num(leader_msj) == 2 || get_pcvar_num(leader_msj) == 3 )
    {
        new iAmmoPacks, iFrags
        new iLeader_Ammo = GetLeader_Ammo(iAmmoPacks)
        new iLeader_Frags = GetLeader_Frags(iFrags)
        new Players = UsersGetPlaying()
        new iPlayers[32], iNum, Others, Altii
        new Name_Frags[32], Name_Ammo[32]
        get_user_name( iLeader_Frags, Name_Frags, 31 )
        get_user_name( iLeader_Ammo, Name_Ammo, 31 )
        get_players( iPlayers, iNum, "ch" )
        
        for ( new i = 0; i < iNum; i++ )
            Others = zp_get_user_ammo_packs(i)

        for ( new j = 0; j < iNum; j++ )
            Altii = get_user_frags(j)
            
        if ( Players == 0 )
            ChatColor( id, "%L", LANG_PLAYER, "NO_PLAYERS" )
        else if ( iFrags == Altii )
            ChatColor( id, "%L", LANG_PLAYER, "MORE_LEADERS_FRAGS" )
        else if ( iAmmoPacks == Others )
            ChatColor( id, "%L", LANG_PLAYER, "MORE_LEADERS_AMMO" )
        else
            ChatColor( id, "%L", LANG_PLAYER, "LEADER_FRAFS", Name_Frags, iFrags )
            ChatColor( id, "%L", LANG_PLAYER, "LEADER_AMMO", Name_Ammo, iAmmoPacks )
    }
    
    return PLUGIN_HANDLED;
}

GetLeader_Ammo( &iAmmoPacks )
{
    new iPlayers[32], iNum, id, i, iLeader, iPacks
    get_players( iPlayers, iNum, "ch" )
    
    for ( i = 0; i < iNum; i++ )
    {
        id = iPlayers[i]
        iPacks = zp_get_user_ammo_packs(id)
        
        if ( iPacks > iAmmoPacks )
        {
            iAmmoPacks = iPacks
            iLeader = id
        }
    }
    return iLeader;
}

GetLeader_Frags( &iFrags )
{
    new iPlayers[32], iNum, id, i, iLeader, iFrag
    get_players( iPlayers, iNum, "ch" )
    
    for ( i = 0; i < iNum; i++ )
    {
        id = iPlayers[i]
        iFrag = get_user_frags(id)
        
        if ( iFrag > iFrags )
        {
            iFrags = iFrag
            iLeader = id
        }
    }
    return iLeader;
}

// ChatColor!
stock ChatColor(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, "!y", "^1") // Default Color
    replace_all(msg, 190, "!t", "^3") // Team 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, SayText, _, players[i])
                write_byte(players[i]);
                write_string(msg);
                message_end();
            }
        }
    }
}

// Users Get Playing (Stock from the ZP)
UsersGetPlaying()
{
    static iPlaying, id
    iPlaying = 0
    
    for ( id = 1; id <= MaxPlayers; id++ )
    {
        if ( is_user_connected(id) )
        {
            if ( get_user_team(id) == 1 || get_user_team(id) == 2 )
                iPlaying++
        }
    }
    
    return iPlaying;
}
ESPADONGAMING is offline
Send a message via MSN to ESPADONGAMING Send a message via Yahoo to ESPADONGAMING Send a message via Skype™ to ESPADONGAMING
ESPADONGAMING
Senior Member
Join Date: Mar 2011
Location: In the Game [ro]
Old 11-09-2011 , 15:20   Re: Aps Leader from 4.3 to 5.0
Reply With Quote #2

help plz... ?
ESPADONGAMING is offline
Send a message via MSN to ESPADONGAMING Send a message via Yahoo to ESPADONGAMING Send a message via Skype™ to ESPADONGAMING
JoKeR LauGh
Veteran Member
Join Date: May 2011
Location: Malaysia
Old 11-10-2011 , 01:59   Re: Aps Leader from 4.3 to 5.0
Reply With Quote #3

Code:
#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <zombieplague>

#define PLUGIN     "[ZP] Addon: APs Leader"
#define VERSION "1.2"
#define AUTHOR    "Kiske"

// Cvars
new leader_msj

// Others
new MaxPlayers, SayText

public plugin_init()
{
    register_plugin(PLUGIN, VERSION, AUTHOR)
    
    // Language Files
    register_dictionary("aps_leader.txt")
    
    // Cvars
    leader_msj = register_cvar("zp_leader_msj", "3")
    /*
    zp_leader_msj 0. Plugin Disable.
    zp_leader_msj 1. Message at RoundStart.
    zp_leader_msj 2. Message when you say or say_team "/leader".
    zp_leader_msj 3. Both.
    */
    
    // Client Commands
    register_clcmd("say /leader", "CheckLeader_Ammo")
    register_clcmd("say_team /leader", "CheckLeader_Ammo")
    
    // Event
    register_event("HLTV", "RoundStart", "a", "1=0", "2=0")
    
    // Others
    SayText = get_user_msgid("SayText")
    MaxPlayers = get_maxplayers()
}

public RoundStart()
{
    if ( get_pcvar_num(leader_msj) == 1 || get_pcvar_num(leader_msj) == 3 )
        set_task(1.6, "Leader") // I use this set_task to the message appears then of "welcome_msg"
}

public Leader()
{
    if ( get_pcvar_num(leader_msj) == 1 || get_pcvar_num(leader_msj) == 3 )
    {
        new iAmmoPacks
        new iLeader = GetLeader_Ammo(iAmmoPacks)
        new Players = UsersGetPlaying()
        new iPlayers[32], iNum, Others
        new szName[32]
        get_user_name( iLeader, szName, 31 )
        get_players( iPlayers, iNum, "ch" )
        
        for ( new i = id )
            Others = zp_get_user_ammo_packs(i)
    
        if ( Players == 0 )
            ChatColor( 0, "%L", LANG_PLAYER, "NO_PLAYERS" )
        else if ( iAmmoPacks == Others )
            ChatColor( 0, "%L", LANG_PLAYER, "MORE_LEADERS_AMMO" )
        else
            ChatColor( 0, "%L", LANG_PLAYER, "LEADER_AMMO", szName, iAmmoPacks )
    }
    set_task(0.1, "Leader_Frags")
}

public Leader_Frags()
{
    if ( get_pcvar_num(leader_msj) == 1 || get_pcvar_num(leader_msj) == 3 )
    {
        new iFrags
        new iLeader = GetLeader_Frags(iFrags)
        new Players = UsersGetPlaying()
        new iPlayers[32], iNum, Others
        new szName[32]
        get_user_name( iLeader, szName, 31 )
        get_players( iPlayers, iNum, "ch" )
        
        for ( new i = 0; i < iNum; i++ )
            Others = get_user_frags(i)
    
        if ( Players == 0 )
            ChatColor( 0, "%L", LANG_PLAYER, "NO_PLAYERS" )
        else if ( iFrags == Others )
            ChatColor( 0, "%L", LANG_PLAYER, "MORE_LEADERS_FRAGS" )
        else
            ChatColor( 0, "%L", LANG_PLAYER, "LEADER_FRAGS", szName, iFrags )
    }
}

// Check Leader
public CheckLeader_Ammo(id)
{
    if ( get_pcvar_num(leader_msj) == 2 || get_pcvar_num(leader_msj) == 3 )
    {
        new iAmmoPacks, iFrags
        new iLeader_Ammo = GetLeader_Ammo(iAmmoPacks)
        new iLeader_Frags = GetLeader_Frags(iFrags)
        new Players = UsersGetPlaying()
        new iPlayers[32], iNum, Others, Altii
        new Name_Frags[32], Name_Ammo[32]
        get_user_name( iLeader_Frags, Name_Frags, 31 )
        get_user_name( iLeader_Ammo, Name_Ammo, 31 )
        get_players( iPlayers, iNum, "ch" )
        
        for ( new i = 0; i < iNum; i++ )
            Others = zp_get_user_ammo_packs(i)

        for ( new j = 0; j < iNum; j++ )
            Altii = get_user_frags(j)
            
        if ( Players == 0 )
            ChatColor( id, "%L", LANG_PLAYER, "NO_PLAYERS" )
        else if ( iFrags == Altii )
            ChatColor( id, "%L", LANG_PLAYER, "MORE_LEADERS_FRAGS" )
        else if ( iAmmoPacks == Others )
            ChatColor( id, "%L", LANG_PLAYER, "MORE_LEADERS_AMMO" )
        else
            ChatColor( id, "%L", LANG_PLAYER, "LEADER_FRAFS", Name_Frags, iFrags )
            ChatColor( id, "%L", LANG_PLAYER, "LEADER_AMMO", Name_Ammo, iAmmoPacks )
    }
    
    return PLUGIN_HANDLED;
}

GetLeader_Ammo( &iAmmoPacks )
{
    new iPlayers[32], iNum, id, i, iLeader, iPacks
    get_players( iPlayers, iNum, "ch" )
    
    for ( i = 0; i < iNum; i++ )
    {
        id = iPlayers[i]
        iPacks = zp_get_user_ammo_packs(id)
        
        if ( iPacks > iAmmoPacks )
        {
            iAmmoPacks = iPacks
            iLeader = id
        }
    }
    return iLeader;
}

GetLeader_Frags( &iFrags )
{
    new iPlayers[32], iNum, id, i, iLeader, iFrag
    get_players( iPlayers, iNum, "ch" )
    
    for ( i = 0; i < iNum; i++ )
    {
        id = iPlayers[i]
        iFrag = get_user_frags(id)
        
        if ( iFrag > iFrags )
        {
            iFrags = iFrag
            iLeader = id
        }
    }
    return iLeader;
}

// ChatColor!
stock ChatColor(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, "!y", "^1") // Default Color
    replace_all(msg, 190, "!t", "^3") // Team 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, SayText, _, players[i])
                write_byte(players[i]);
                write_string(msg);
                message_end();
            }
        }
    }
}

// Users Get Playing (Stock from the ZP)
UsersGetPlaying()
{
    static iPlaying, id
    iPlaying = 0
    
    for ( id = 1; id <= MaxPlayers; id++ )
    {
        if ( is_user_connected(id) )
        {
            if ( get_user_team(id) == 1 || get_user_team(id) == 2 )
                iPlaying++
        }
    }
    
    return iPlaying;
}
JoKeR LauGh is offline
ESPADONGAMING
Senior Member
Join Date: Mar 2011
Location: In the Game [ro]
Old 11-10-2011 , 11:10   Re: Aps Leader from 4.3 to 5.0
Reply With Quote #4

Copile error

Code:
Error: Undefined symbol "id" on line 62
Error: Expected token ")", but fdound "if" on line 65
Warning: Lose intendation on line 128
ESPADONGAMING is offline
Send a message via MSN to ESPADONGAMING Send a message via Yahoo to ESPADONGAMING Send a message via Skype™ to ESPADONGAMING
H.RED.ZONE
Veteran Member
Join Date: Sep 2011
Location: Serbia, Belgrade
Old 11-10-2011 , 11:33   Re: Aps Leader from 4.3 to 5.0
Reply With Quote #5

Try this one here
__________________
H.RED.ZONE is offline
Reply



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 05:32.


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