AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Suggestions / Requests (https://forums.alliedmods.net/forumdisplay.php?f=12)
-   -   /me to be auto executed on dead or if you don't die at round end (https://forums.alliedmods.net/showthread.php?t=191103)

yOou Know Me 07-26-2012 04:30

/me to be auto executed on dead or if you don't die at round end
 
Hello can anyone make the command "/me" to be automatically executed when you die and if you don't die this round and you are alive to be executed at the round end, when the server says "Terrorist's/Ct's Win!" I have two plugins maybe they will be of some help. And i'm using Statsx_shell not the normal statsx plugin for CS if you can edit that too.


This plugin will execute "/me" at the end of the round:
Code:

#include <amxmodx>

#define CALLFUNC_SUCCESS 1

public plugin_init()
{
register_plugin("Auto /me on round end","1.0","<VeCo>")

register_logevent("LogEvent_RoundEnd",2,"1=Round_End")
}

public LogEvent_RoundEnd()
{
static i_players[32],i_num, i,id
get_players(i_players,i_num,"a")

for(i=0;i<i_num;i++)
{
id = i_players[i]

if(callfunc_begin("cmdMe","statsx.amxx") != CALLFUNC_SUCCESS)
{
set_fail_state("StatsX isn't loaded! Plugin paused.")

break
}

callfunc_push_int(id)
callfunc_end()
}
}

This plugin will execute the "/me" plugin at death:
Code:

#include <amxmodx>

#define CALLFUNC_SUCCESS 1

public plugin_init()
{
register_plugin("Auto /me on death","1.0","<VeCo>")

register_event("DeathMsg","Event_DeathMsg","a")
}

public Event_DeathMsg()
{
static id
id = read_data(2)

if(callfunc_begin("cmdMe","statsx.amxx") != CALLFUNC_SUCCESS)
{
set_fail_state("StatsX isn't loaded! Plugin paused.")

return
}

callfunc_push_int(id)
callfunc_end()
}


ConnorMcLeod 07-26-2012 04:58

Re: /me to be auto executed on dead or if you don't die at round end
 
Edit the 2 first lines to fit your needs.

PHP Code:

#define PLUGIN_NAME_TO_CALL        "StatsX"
#define FUNCTION_TO_CALL                "cmdMe"

#include <amxmodx>

#define VERSION "0.0.1"
#define PLUGIN "Auto /me"

new g_iMaxPlayers
#define IsPlayer(%0)    ( 1 <= %0 <= g_iMaxPlayers )

new g_iStatsXPluginIdg_iStatsXcmdMeId

public plugin_init()
{
    
register_plugin(PLUGINVERSION"ConnorMcLeod")
}

public 
plugin_cfg()
{
    
g_iStatsXPluginId is_plugin_loadedPLUGIN_NAME_TO_CALL )
    if( 
g_iStatsXPluginId )
    {
        
g_iStatsXcmdMeId get_func_id(FUNCTION_TO_CALLg_iStatsXPluginId)

        
g_iMaxPlayers get_maxplayers()

        
register_event("DeathMsg""Event_DeathMsg""a")
        
register_logevent("Logevent_Round_End"2"1=Round_End")
    }
}

public 
Event_DeathMsg()
{
    new 
id read_data(2)
    if( 
IsPlayer(id) )
    {
        
callmeid )
    }
}

public 
Logevent_Round_End()
{
    new 
players[32], num
    get_players
(playersnum"ac")
    for(--
numnum>=0num--)
    {
        
callmeplayers[num] )
    }
}

callmeid )
{
    
callfunc_begin_i(g_iStatsXcmdMeIdg_iStatsXPluginId)
    
callfunc_push_int(id)
    
callfunc_end()


You can also use this :
PHP Code:

#include <amxmodx>

#define VERSION "0.0.1"
#define PLUGIN "Auto /me"

new g_iMaxPlayers
#define IsPlayer(%0)    ( 1 <= %0 <= g_iMaxPlayers )

public plugin_init()
{
    
register_plugin(PLUGINVERSION"ConnorMcLeod")

    
g_iMaxPlayers get_maxplayers()

    
register_event("DeathMsg""Event_DeathMsg""a")
    
register_logevent("Logevent_Round_End"2"1=Round_End")
}

public 
Event_DeathMsg()
{
    new 
id read_data(2)
    if( 
IsPlayer(id) )
    {
        
client_cmdid"say /me" )
    }
}

public 
Logevent_Round_End()
{
    new 
players[32], num
    get_players
(playersnum"ac")
    for(--
numnum>=0num--)
    {
        
client_cmdplayers[num], "say /me" )
    }



yOou Know Me 07-26-2012 05:50

Re: /me to be auto executed on dead or if you don't die at round end
 
There is one problem i have removed those two register_clcmd's so that the players can't call the function. I want it to be automatically called from the server and when i removed them your plugin stopped working.. so apparently your plugin is using them, can you make the plugin call the /me function by some other way i have used the second plugin that you gave me and he was working fine, there was just this problem..

register_clcmd("say /me", "cmdMe", 0, "- display current round stats (chat)")
register_clcmd("say_team /me", "cmdMe", 0, "- display current round stats (chat)")

ConnorMcLeod 07-26-2012 06:00

Re: /me to be auto executed on dead or if you don't die at round end
 
Use the 1st code then, not the 2nd one.

yOou Know Me 07-26-2012 07:35

Re: /me to be auto executed on dead or if you don't die at round end
 
I tried it but it's not working.. how must i change this i have tried without changing it and i tried changing it like this:

#define PLUGIN_NAME_TO_CALL "Statsx_shell"

but it doesn't work... ?

ConnorMcLeod 07-26-2012 10:08

Re: /me to be auto executed on dead or if you don't die at round end
 
You should put the name of the plugin as it is defined in register_plugin(

yOou Know Me 07-26-2012 13:16

Re: /me to be auto executed on dead or if you don't die at round end
 
Yes it's working now, but when you die you have those two options:
Killed by nick etc
you hit killer etc
(And i want the option to be here, but now it's over those two options, what is changed in this plugin ?)


All times are GMT -4. The time now is 00:25.

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