Raised This Month: $51 Target: $400
 12% 

Check if a team member has spesific conditions


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
egbertjan
Senior Member
Join Date: Mar 2007
Location: The Netherlands
Old 04-29-2014 , 16:05   Check if a team member has spesific conditions
Reply With Quote #1

I'm fairly new to pawn and I would like to know if there is a way to check if your team members have the correct conditions when you're dead. I'm asking this because I am trying to make a team member respawner in case if somebody is alive with a spesific class (I'm using this for a mod).

Basicly I want something like:

Code:
if (get_user_team(vid) &&  ?? teammember ?? player_class[id] == Necromancer && NecroRevive[id] == True) {
     ExecuteHamB(Ham_CS_RoundRespawn, vid)
}
I would really appreciate the help I could get

Last edited by egbertjan; 04-29-2014 at 16:05.
egbertjan is offline
NikKOo31
Senior Member
Join Date: May 2013
Location: Home
Old 04-29-2014 , 22:08   Re: Check if a team member has spesific conditions
Reply With Quote #2

If you want to know if vid is teammate with id you can replace
PHP Code:
..get_user_team(vid) &&  ?? teammember ??.. 

PHP Code:
..get_user_team(vid) == get_user_team(id) &&.. 
NikKOo31 is offline
egbertjan
Senior Member
Join Date: Mar 2007
Location: The Netherlands
Old 04-30-2014 , 06:46   Re: Check if a team member has spesific conditions
Reply With Quote #3

My current deathmsg has the following:

Code:
new weaponname[20]
    new kid = read_data(1)
    new vid = read_data(2)
    new headshot = read_data(3)
    read_data(4,weaponname,31)
Does the team member get any spesific read_data in case I would use get_user_team(id) ?

Code:
if (get_user_team(vid) == get_user_team(id) && player_class[id] == Necromancer && NecroRevive[id] == True) { 
         ExecuteHamB(Ham_CS_RoundRespawn, vid) 
}
So basicly this should work? (I will test later, I would just like to know in advance )

Last edited by egbertjan; 04-30-2014 at 06:48.
egbertjan is offline
Flick3rR
Veteran Member
Join Date: Feb 2014
Location: Bulgaria, Stara Zagora
Old 04-30-2014 , 06:53   Re: Check if a team member has spesific conditions
Reply With Quote #4

Didn't understand what wre you trying to do... You need to check if victimID team is the same as whose team? Or if there are alive players from the victim's team? Or what?
__________________
Flick3rR is offline
Send a message via Skype™ to Flick3rR
egbertjan
Senior Member
Join Date: Mar 2007
Location: The Netherlands
Old 04-30-2014 , 06:59   Re: Check if a team member has spesific conditions
Reply With Quote #5

I would like to know if the victim ID has a player in his team that is the class Necromancer and if he has NecroRevive as true.

Sorry that it was unclear.
egbertjan is offline
NikKOo31
Senior Member
Join Date: May 2013
Location: Home
Old 04-30-2014 , 10:38   Re: Check if a team member has spesific conditions
Reply With Quote #6

Now I understand xD

PHP Code:
new weaponname[20]
    new 
kid read_data(1)
    new 
vid read_data(2)
    new 
headshot read_data(3)
    
read_data(4,weaponname,31)

    new 
players[32], num
    
if(cs_get_user_team(vid) == CS_TEAM_CT// is he a CT?
        
get_players(playersnum"ae""CT"// get all alive CT

    
if(cs_get_user_team(vid) == CS_TEAM_T// is he a T?
        
get_players(playersnum"ae""TERRORIST"// get all alive T

    
if(num 0)    // is there any?
    
{
        new 
id
        
for(new 0numi++)    // let's loop them
        
{
            
id players[i]
            if(
player_class[id] == Necromancer && NecroRevive[id] == True// and check conditions
                
ExecuteHamB(Ham_CS_RoundRespawnvid// would be better to set task to revive D:
        
}
        
    } 
Edit1* #include <cstrike>
Edit2* If you want to check for dead teammates, change "ae" to "e" in get_players ^^

Last edited by NikKOo31; 04-30-2014 at 10:41.
NikKOo31 is offline
egbertjan
Senior Member
Join Date: Mar 2007
Location: The Netherlands
Old 04-30-2014 , 11:09   Re: Check if a team member has spesific conditions
Reply With Quote #7

Thanks for this! I would also like to know why it would be better to get a task for this.

Edit: It's talking about a stack error with this line:

Code:
new players[32], num
This is the code I put in my DeathMsg:

Code:
	if(cs_get_user_team(vid) == CS_TEAM_CT)
		get_players(players, num, "ae", "CT")
	if(cs_get_user_team(vid) == CS_TEAM_T)
		get_players(players, num, "ae", "TERRORIST")

	if(num > 0) {
		new id
		for(new i = 0; i < num; i++) {
			id = players[i]
			if(player_class[id] == Necromancer && NecroRevive[id] == true) {
				ExecuteHamB(Ham_CS_RoundRespawn, vid)
				NecroRevive[id] = false
			}	
		}
	}
The Necrorevive should become false when the Necromancer did his part (reviving the allied member).

Last edited by egbertjan; 04-30-2014 at 11:22.
egbertjan is offline
NikKOo31
Senior Member
Join Date: May 2013
Location: Home
Old 04-30-2014 , 13:05   Re: Check if a team member has spesific conditions
Reply With Quote #8

PHP Code:
    new weaponname[20]
    new 
kid read_data(1)
    new 
vid read_data(2)
    new 
headshot read_data(3)
    
read_data(4,weaponname,31

PHP Code:
    new weaponname[20]
    new 
kid read_data(1)
    new 
vid read_data(2)
    new 
headshot read_data(3)
    
read_data(4,weaponname,19// not 31 D: 
NikKOo31 is offline
egbertjan
Senior Member
Join Date: Mar 2007
Location: The Netherlands
Old 04-30-2014 , 13:32   Re: Check if a team member has spesific conditions
Reply With Quote #9

The error stacking is gone However the respawning function isn't quite working :<
egbertjan is offline
Flick3rR
Veteran Member
Join Date: Feb 2014
Location: Bulgaria, Stara Zagora
Old 04-30-2014 , 13:44   Re: Check if a team member has spesific conditions
Reply With Quote #10

PHP Code:
if(player_class[id] == Necromancer && NecroRevive[id] == True// and check conditions 
Should't the vid have this NecroRevive? Or in other words, this:
PHP Code:
&& NecroRevive[id] == True
should be like this?
PHP Code:
&& NecroRevive[vid] == True
__________________

Last edited by Flick3rR; 04-30-2014 at 13:45.
Flick3rR is offline
Send a message via Skype™ to Flick3rR
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 19:18.


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