AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   help adding to this code (https://forums.alliedmods.net/showthread.php?t=29400)

cccpsmiley 06-05-2006 02:13

help adding to this code
 
Code:

#include <amxmodx>
#include <amxmisc>
#include <engine>
#include <dodx>

//////////////////////////////////////////////////////////////////////////////////
#define IMMUNITY_LEVEL ADMIN_KICK                //spec immunity level
//////////////////////////////////////////////////////////////////////////////////

new p_dod_jqs_msgs, p_immunity, p_join_msg, p_quit_msg, p_axis_msg, p_allies_msg, p_brit_msg, p_spec_msg
new p_join, p_quit, p_axis, p_allies, p_brits, p_spec

public plugin_init() {
        register_plugin("dod_joinquitswitch_msgs", "1.3", "AMXX DoD Team")
       
        register_message(get_user_msgid("TextMsg"), "block_message")
       
        p_dod_jqs_msgs = register_cvar("dod_jqs_msgs", "1")
        p_immunity = register_cvar("dod_jqs_immunity", "1")
       
        p_join_msg = register_cvar("dod_jqs_join_msg", "has joined the damn game...")
        p_join = register_cvar("dod_jqs_join", "1")
       
        p_quit_msg = register_cvar("dod_jqs_quit_msg", "is gay and left the game...")
        p_quit = register_cvar("dod_jqs_quit", "1")
       
        p_axis_msg = register_cvar("dod_jqs_axis_msg", "has joined the Nazis...")
        p_axis = register_cvar("dod_jqs_axis", "1")
       
        p_allies_msg = register_cvar("dod_jqs_allies_msg", "has joined the Americans...")
        p_allies = register_cvar("dod_jqs_allies", "1")
       
        p_brit_msg = register_cvar("dod_jqs_british_msg", "has joined the British...")
        p_brits = register_cvar("dod_jqs_british", "1")
       
        p_spec_msg = register_cvar("dod_jqs_spec_msg", "has joined Spectators...")
        p_spec = register_cvar("dod_jqs_spec", "1")
       
        register_event("TextMsg","join_axis","a","1=3","2=#game_joined_team","4=Axis")
        register_event("TextMsg","join_allies","a","1=3","2=#game_joined_team","4=Allies")
        register_event("TextMsg","join_spec","a","1=3","2=#game_joined_team","4=Spectators")
}

public block_message() {

        if(get_pcvar_num(p_dod_jqs_msgs) != 1)
                return PLUGIN_HANDLED
       
        if(get_msg_argtype(2) == ARG_STRING)
                {
                new value[64]
                get_msg_arg_string(2, value, 63)
               
                new spec_name[32]
                read_data(3,spec_name,31)
                new id = get_user_index(spec_name)
       
       
                if(equali(value, "#game_joined_game") && get_pcvar_num(p_join) == 1)
                        {
                        return PLUGIN_HANDLED
                        }
                       
                if(equali(value, "#game_disconnected") && get_pcvar_num(p_quit) == 1)
                        {
                        return PLUGIN_HANDLED
                        }
                       
                if(equali(value, "#game_joined_team"))
                        {
                        new team[16]
                        get_msg_arg_string(4, team, 15)
                       
                        if((get_pcvar_num(p_axis) == 1) && equali(team, "Axis"))
                                {
                                return PLUGIN_HANDLED
                                }
                        else if((get_pcvar_num(p_brits) == 1) && equali(team, "Allies") && dod_get_map_info(MI_ALLIES_TEAM) == 1)
                                {
                                return PLUGIN_HANDLED
                                }
                        else if((get_pcvar_num(p_allies) == 1) && equali(team, "Allies") && dod_get_map_info(MI_ALLIES_TEAM) == 0)
                                {
                                return PLUGIN_HANDLED
                                }
                        else if(((get_pcvar_num(p_spec) == 1) && equali(team, "Spectators")) || ((get_pcvar_num(p_immunity) == 1) && access(id, IMMUNITY_LEVEL)))
                                {
                                return PLUGIN_HANDLED
                                }
                        }
                }
        return PLUGIN_CONTINUE


public client_putinserver(id)

        if((get_pcvar_num(p_dod_jqs_msgs) != 1) || get_pcvar_num(p_join) != 1)
                return PLUGIN_HANDLED
               
        new putin_name[32]
        get_user_name(id, putin_name, 32)
        new join_cvar[64]
        get_pcvar_string(p_join_msg, join_cvar, 63)
        client_print(0, print_chat, "*  %s %s", putin_name, join_cvar)
       
        return PLUGIN_HANDLED
}

public client_disconnect(id)
{
        if((get_pcvar_num(p_dod_jqs_msgs) != 1) || get_pcvar_num(p_quit) != 1)
                return PLUGIN_HANDLED
               
        new leave_name[32]
        get_user_name(id, leave_name, 32)
        new quit_cvar[64]
        get_pcvar_string(p_quit_msg, quit_cvar, 63)
        client_print(0, print_chat, "*  %s %s", leave_name, quit_cvar)
       
        return PLUGIN_HANDLED
}

public join_axis(id)
{
        if((get_pcvar_num(p_dod_jqs_msgs) != 1) || get_pcvar_num(p_axis) != 1)
                return PLUGIN_HANDLED
               
        new axis_name[32]
        read_data(3,axis_name,31)
        new axis_cvar[64]
        get_pcvar_string(p_axis_msg, axis_cvar, 63)
        client_print(0, print_chat, "*  %s %s", axis_name, axis_cvar)
       
        return PLUGIN_CONTINUE
}

public join_allies()
{
        if(get_pcvar_num(p_dod_jqs_msgs) != 1)
                return PLUGIN_HANDLED
               
        new allies_name[32]
        read_data(3,allies_name,31)

        if ((dod_get_map_info(MI_ALLIES_TEAM) == 1) && get_pcvar_num(p_brits) == 1)
                {
                new brit_cvar[64]
                get_pcvar_string(p_brit_msg, brit_cvar, 63)
                client_print(0, print_chat, "*  %s %s", allies_name, brit_cvar)
                }
        else if ((dod_get_map_info(MI_ALLIES_TEAM) == 0) && get_pcvar_num(p_allies) == 1)
                {
                new allies_cvar[64]
                get_pcvar_string(p_allies_msg, allies_cvar, 63)
                client_print(0, print_chat, "*  %s %s", allies_name, allies_cvar)
                }
       
        return PLUGIN_CONTINUE
}

public join_spec()
{
        if((get_pcvar_num(p_dod_jqs_msgs) != 1) || get_pcvar_num(p_spec) != 1)
                return PLUGIN_HANDLED
               
        new spec_name[32]
        read_data(3,spec_name,31)
        new id = get_user_index(spec_name)

        if(get_pcvar_num(p_immunity) && access(id, IMMUNITY_LEVEL))
                return PLUGIN_HANDLED

        new spec_cvar[64]
        get_pcvar_string(p_spec_msg, spec_cvar, 63)
        client_print(0, print_chat, "*  %s %s", spec_name, spec_cvar)
       
        return PLUGIN_CONTINUE
}

the thing i cant figure out with this one is how to make every one of the messages same way as SPEC IMMUNITY where if immunity player joined spectators it wouldnt show.


All times are GMT -4. The time now is 16:33.

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