Raised This Month: $ Target: $400
 0% 

Does RoundEnd Event count while dead?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
NiQu
Veteran Member
Join Date: Nov 2009
Old 05-23-2010 , 11:44   Does RoundEnd Event count while dead?
Reply With Quote #1

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?
__________________
My Projects
  • RoTAPI V0.0.1 ------- Private
    • Progress - [||||||||||]
  • CashMod V0.0.6 ----- Public
    • Progress - [||||||||||]
  • CashMod V0.0.7 ----- Public
    • Progress - [||||||||||]
NiQu is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 05-23-2010 , 17:13   Re: Does RoundEnd Event count while dead?
Reply With Quote #2

FuncWiki is your friend.
__________________
fysiks is offline
NiQu
Veteran Member
Join Date: Nov 2009
Old 05-24-2010 , 04:56   Re: Does RoundEnd Event count while dead?
Reply With Quote #3

From now call me lazy.

Ill check it out.
__________________
My Projects
  • RoTAPI V0.0.1 ------- Private
    • Progress - [||||||||||]
  • CashMod V0.0.6 ----- Public
    • Progress - [||||||||||]
  • CashMod V0.0.7 ----- Public
    • Progress - [||||||||||]
NiQu is offline
Xellath
Veteran Member
Join Date: Dec 2007
Location: Sweden
Old 05-24-2010 , 15:45   Re: Does RoundEnd Event count while dead?
Reply With Quote #4

get_players( iPlayers, iNum, "a" );

__________________
Achievements API - a simple way for you to create your OWN custom achievements!
Xellath is offline
NiQu
Veteran Member
Join Date: Nov 2009
Old 05-24-2010 , 16:28   Re: Does RoundEnd Event count while dead?
Reply With Quote #5

Xellath i know that, i looked at the link that fysiks gave me , i might be lazy but im not dumb.
__________________
My Projects
  • RoTAPI V0.0.1 ------- Private
    • Progress - [||||||||||]
  • CashMod V0.0.6 ----- Public
    • Progress - [||||||||||]
  • CashMod V0.0.7 ----- Public
    • Progress - [||||||||||]
NiQu is offline
Xellath
Veteran Member
Join Date: Dec 2007
Location: Sweden
Old 05-25-2010 , 04:19   Re: Does RoundEnd Event count while dead?
Reply With Quote #6

Quote:
Originally Posted by NiQu View Post
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?
__________________
Achievements API - a simple way for you to create your OWN custom achievements!
Xellath is offline
NiQu
Veteran Member
Join Date: Nov 2009
Old 05-25-2010 , 11:33   Re: Does RoundEnd Event count while dead?
Reply With Quote #7

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.
__________________
My Projects
  • RoTAPI V0.0.1 ------- Private
    • Progress - [||||||||||]
  • CashMod V0.0.6 ----- Public
    • Progress - [||||||||||]
  • CashMod V0.0.7 ----- Public
    • Progress - [||||||||||]

Last edited by NiQu; 05-25-2010 at 11:38.
NiQu 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:18.


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