AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   editing statsx.sma and /me command (https://forums.alliedmods.net/showthread.php?t=129771)

ghostofmybrain 06-16-2010 16:46

editing statsx.sma and /me command
 
I'm interested in editting the statsx.sma file to make it so that if you say /me while alive, it returns "You must be dead to use this function", and if you say /me while dead it behaves normally.

I have absolutely no experience with this, but I think it would involve editting the public cmdMe (id) line to involve some sort of if alive, then this; if dead, then this. But I don't have the knowledge to actually add that myself.

Is anybody willing to help out?

tm. 06-16-2010 17:13

Re: editing statsx.sma and /me command
 
Replace :arrow:
PHP Code:

public cmdMe(id)
{
    if (!
SayMe)
    {
        
client_print(idprint_chat"%L"id"DISABLED_MSG")
        return 
PLUGIN_HANDLED
    
}
    
    
format_kill_vinfo(id0g_sBuffer)
    
client_print(idprint_chat"* %s"g_sBuffer)
    
    return 
PLUGIN_CONTINUE


with :arrow:
PHP Code:

public cmdMe(id)
{
    if (!
SayMe)
    {
        
client_print(idprint_chat"%L"id"DISABLED_MSG")
        return 
PLUGIN_HANDLED
    
}

    if (
is_user_alive(id))
    {
        
client_print(idprint_chat"You must be dead to use this function")
        return 
PLUGIN_HANDLED
    
}

    
format_kill_vinfo(id0g_sBuffer)
    
client_print(idprint_chat"* %s"g_sBuffer)
    
    return 
PLUGIN_CONTINUE


Or, if you wish to use the dictionary for multilingual and to keep the plugin's format:
PHP Code:

public cmdMe(id)
{
    if (!
SayMe)
    {
        
client_print(idprint_chat"%L"id"DISABLED_MSG")
        return 
PLUGIN_HANDLED
    
}

    if (
is_user_alive(id))
    {
        
client_print(idprint_chat"%L"id"ONLY_DEATH_ME")
        return 
PLUGIN_HANDLED
    
}

    
format_kill_vinfo(id0g_sBuffer)
    
client_print(idprint_chat"* %s"g_sBuffer)
    
    return 
PLUGIN_CONTINUE


afterwards add in data/lang/statsx.txt
Code:

ONLY_DEATH_ME = You must be dead to use this function

ghostofmybrain 06-16-2010 17:21

Re: editing statsx.sma and /me command
 
Ohhh, ok, that's pretty simple actually. I understood everything you did. :D Thanks!

EDIT: I just tried that out, and it works perfectly. Thanks again!


All times are GMT -4. The time now is 14:53.

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