AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Does RoundEnd Event count while dead? (https://forums.alliedmods.net/showthread.php?t=127655)

NiQu 05-23-2010 11:44

Does RoundEnd Event count while dead?
 
Hi, im making a sub-plugin for a core-plugin.
The core is not open-source but the sub is so here we go:

I was developing a feature that gives *cash* every roundend to terrorists and here is what i got atm:

PHP Code:

#include <amxmodx>
#include <cstrike>
#include <cashmod>

#define PLUGIN "CM: RoundEnd Cash"
#define VERSION "0.0.5"
#define AUTHOR "ReCon"

new end_mode;

public 
plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
//Register Round End
    
register_logevent"eRound_end"2"1=Round_End" );
    
    
//Register A CVAR
    
end_mode register_cvar("cm_endmode""0");
}

public 
eRound_end()
{
    new 
mode get_pcvar_num(end_mode);
    new 
cash;
    
    if( !
EnoughPlayers() )
    {
        return 
PLUGIN_HANDLED;
    }
    
//Bunch of variables
    
new iPlayers[32], iNumiPidformat_text[128];
    
    
//Get all players
    
get_playersiPlayersiNum"a" );
    
    
//Browse through all players
    
for( new iiNumi++ )
    {
        
iPid iPlayers[i];
        new 
CsTeams:team cs_get_user_team(iPid);
        
        if( 
team == CS_TEAM_T )
        {
            switch( 
mode )
            {
                case 
0:
                {
                    if( 
is_user_alive(iPid) )
                    {
                        if( 
cm_get_user_admin(iPid) )
                        {
                            
cash 100;
                            
formatex(format_textsizeof(format_text) - 1"^x03You got 100 cash for surviving as a Terrorist!");
                        }
                        else
                        {
                            
cash 80;
                            
formatex(format_textsizeof(format_text) - 1"^x03You got 80 cash for surviving as a Terrorist!");
                        }
                    }
                }
                case 
1:
                {
                    if( 
is_user_alive(iPid) )
                    {
                        if( 
cm_get_user_admin(iPid) )
                        {
                            
cash 100;
                            
formatex(format_textsizeof(format_text) - 1"^x03You got 100 cash for surviving as a Terrorist!");
                        }
                        else
                        {
                            
cash 80;
                            
formatex(format_textsizeof(format_text) - 1"^x03You got 80 cash for surviving as a Terrorist!");
                        }
                    }
                    else
                    {
                        if( 
cm_get_user_admin(iPid) )
                        {
                            
cash 45;
                            
formatex(format_textsizeof(format_text) - 1"^x03You got 45 cash for being a Terrorist!");
                        }
                        else
                        {
                            
cash 25;
                            
formatex(format_textsizeof(format_text) - 1"^x03You got 25 cash for being a Terrorist!");
                        }
                    }
                }
                case 
2:
                {
                    
cash 0;
                    return 
PLUGIN_HANDLED;
                }
            }
            
cm_set_user_cash(iPidcm_get_user_cash(iPid) + cash);
            Print(
iPidformat_text);
        }
    }
    return 
PLUGIN_HANDLED;


My problem is that , when i have cm_endmode set to 1 and im dead when the roundend occours i dont get the message printed or the cash added.

However if i have cm_endmode set to 1 and i am alive at round end i do get cash, and if i have cm_endmode 2 i get nothing just like it should, but when im dead with cm_endmode 1 i dont get anything. Im suppose to get cash and there suppose to be a message to.

Why doesnt it print hte message and give the cash?

fysiks 05-23-2010 17:13

Re: Does RoundEnd Event count while dead?
 
FuncWiki is your friend.

NiQu 05-24-2010 04:56

Re: Does RoundEnd Event count while dead?
 
From now call me lazy.

Ill check it out.

Xellath 05-24-2010 15:45

Re: Does RoundEnd Event count while dead?
 
get_players( iPlayers, iNum, "a" );

:roll:

NiQu 05-24-2010 16:28

Re: Does RoundEnd Event count while dead?
 
Xellath i know that, i looked at the link that fysiks gave me , i might be lazy but im not dumb.

Xellath 05-25-2010 04:19

Re: Does RoundEnd Event count while dead?
 
Quote:

Originally Posted by NiQu (Post 1190075)
Xellath i know that, i looked at the link that fysiks gave me , i might be lazy but im not dumb.

Did I specifically point out that you were dumb?

NiQu 05-25-2010 11:33

Re: Does RoundEnd Event count while dead?
 
No, maybe im over-sensitive.

[sv]
Jag är ganska känslig, ex, det som du skrev kanske du inte menade något illa med, men jag kanske tog det på fel sätt.


All times are GMT -4. The time now is 05:18.

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