Raised This Month: $ Target: $400
 0% 

Changing Teams Help!


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
oxygen935
Veteran Member
Join Date: Jun 2012
Location: Athens, Greece
Old 04-14-2013 , 14:29   Changing Teams Help!
Reply With Quote #1

Hey i have a problem...
I want a plugin for my deathmatch server... But its complicated...
I want when a CT Kills a T:
-The CT next round Will be moved to T
-The T next round Will be moved to CT

I have this code but is bugged...
I mean when CT Kills T: the CT next round moved to T but the T isn't moved to CT

Code for fixing:
PHP Code:
#include <amxmodx>
#include <cstrike>

#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "oxygen"

new nextct[33]
new 
nextt[33]

public 
plugin_init() 
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
register_event("DeathMsg""Event_DeathMsg""a")
    
register_logevent("logevent_round_end"2"1=Round_End"
}
public 
Event_DeathMsg()
{
    new 
iKiller read_data(1)
    new 
iVictim read_data(2)
    
    new 
killername[33], victimname[33]
    
get_user_name(iKiller,killername,32)
    
get_user_name(iVictim,victimname,32)
    
    switch(
cs_get_user_team(iVictim))
    {
        case 
CS_TEAM_T:
        {
            
nextct[iVictim] = true
            nextt
[iKiller] = true
        
}
    }
}

public 
logevent_round_end()
{
    new 
players[32], pnumtempid
    get_players
(playerspnum"a"); 
    for( new 
ii<pnumi++ ) 
    { 
        
tempid players[i];
        if(
nextt[tempid])
        {
            
cs_set_user_team(tempidCS_TEAM_T)
        }
        if(
nextct[tempid])
        {
            
cs_set_user_team(tempidCS_TEAM_CT)
        }
    }

__________________
Quote:
Originally Posted by quark View Post
You're a genius
Stopped any pawn work cause of university for computer science

Last edited by oxygen935; 04-15-2013 at 00:48.
oxygen935 is offline
Send a message via Skype™ to oxygen935
wickedd
Veteran Member
Join Date: Nov 2009
Old 04-14-2013 , 15:00   Re: IMPORTANT plz help!
Reply With Quote #2

If it's so IMPORTANT search the forum, this has been discuss many times.
__________________
Just buy the fucking game!!!!
I hate No-Steamers and lazy ass people.
wickedd is offline
oxygen935
Veteran Member
Join Date: Jun 2012
Location: Athens, Greece
Old 04-14-2013 , 15:03   Re: IMPORTANT plz help!
Reply With Quote #3

i searched man... And the only thing i found is Team Swap...
It's so difficult to help?? :/
__________________
Quote:
Originally Posted by quark View Post
You're a genius
Stopped any pawn work cause of university for computer science
oxygen935 is offline
Send a message via Skype™ to oxygen935
wickedd
Veteran Member
Join Date: Nov 2009
Old 04-14-2013 , 15:07   Re: IMPORTANT plz help!
Reply With Quote #4

Is it so difficult to post a descriptive title? Beside, if you search the forum you will find a working code that does what you want.
__________________
Just buy the fucking game!!!!
I hate No-Steamers and lazy ass people.
wickedd is offline
oxygen935
Veteran Member
Join Date: Jun 2012
Location: Athens, Greece
Old 04-14-2013 , 15:11   Re: IMPORTANT plz help!
Reply With Quote #5

And again... If you have a topic that do what i want to do with this plugin(cause i can't find) post the topic here or gimme a keyword to search...
__________________
Quote:
Originally Posted by quark View Post
You're a genius
Stopped any pawn work cause of university for computer science

Last edited by oxygen935; 04-15-2013 at 00:50.
oxygen935 is offline
Send a message via Skype™ to oxygen935
Blizzard_87
Veteran Member
Join Date: Oct 2012
Old 04-14-2013 , 16:51   Re: IMPORTANT plz help!
Reply With Quote #6

to edit title. click edit on your first post then click go advanced.
__________________
Blizzard_87 is offline
Blizzard_87
Veteran Member
Join Date: Oct 2012
Old 04-14-2013 , 20:18   Re: not important, don't open me
Reply With Quote #7

i dont know if this is correct but i tested with bots and when you kill someone what ever team they were on they switch next round... and you also switch on next round....

and if you didnt kill anyone then you dont switch...

this what you want?

PHP Code:
#include <amxmodx> 
#include <cstrike> 

#define PLUGIN "New Plug-In" 
#define VERSION "1.0" 
#define AUTHOR "oxygen" 

new NRTS[33] = false;

public 
plugin_init()  

    
register_plugin(PLUGINVERSIONAUTHOR
    
register_event("DeathMsg""Event_DeathMsg""a"
    
register_logevent("logevent_round_end"2"1=Round_End")  

public 
Event_DeathMsg() 

    new 
iKiller read_data(1
    new 
iVictim read_data(2
    
    
NRTS[iKiller] = true;
    
NRTS[iVictim] = true;
    
set_task(1.0"Change_Teams"iVictim)


public 
logevent_round_end() 

    new 
players[32], pnumtempid 
    get_players
(playerspnum"ac""CT");  
    for( new 
0i<pnumi++ )  
    {  
        
tempid players[i]; 
        
        
set_task(1.0"Change_Teams"tempid)
    } 
}  

public 
Change_Teams(id)
{
    if(
NRTS[id])
    {
        switch(
cs_get_user_team(id))
        {
            case 
CS_TEAM_CTcs_set_user_team(idCS_TEAM_T);
            case 
CS_TEAM_Tcs_set_user_team(idCS_TEAM_CT);
        }
    }

__________________
Blizzard_87 is offline
oxygen935
Veteran Member
Join Date: Jun 2012
Location: Athens, Greece
Old 04-15-2013 , 00:47   Re: not important, don't open me
Reply With Quote #8

I only want to change teams when CT Kills T but when T Kills CT not changing teams...
__________________
Quote:
Originally Posted by quark View Post
You're a genius
Stopped any pawn work cause of university for computer science
oxygen935 is offline
Send a message via Skype™ to oxygen935
Blizzard_87
Veteran Member
Join Date: Oct 2012
Old 04-15-2013 , 00:52   Re: Changing Teams Help!
Reply With Quote #9

ok. you should be able to edit it. but if not ill change it when I get on computer.
__________________
Blizzard_87 is offline
Kard1nal
Senior Member
Join Date: Dec 2012
Location: Russia
Old 04-15-2013 , 04:23   Re: Changing Teams Help!
Reply With Quote #10

Code:
#include <amxmodx> #include <cstrike> #include <hamsandwich> new bool:T[33], bool:CT[33] public plugin_init() {     RegisterHam(Ham_Killed, "player", "player_killed", 1)     register_logevent("round_start", 2, "0=World triggered", "1=Round_Start") } public player_killed(victim, attacker, shouldgib) {     if(victim == attacker || get_user_team(attacker) != 2 || get_user_team(victim) != 1)         return HAM_IGNORED             T[attacker] = true     CT[victim] = true     return HAM_IGNORED } public client_disconnect(id) {     T[id] = false     CT[id] = false } public round_start() {     new Players[32], num, i     get_players(Players, num, "a")     for(i = 0; i < num; i++)     {         if(T[Players[i]])         {             cs_set_user_team(Players[i], CS_TEAM_T)             T[Players[i]] = false         }         else if(CT[Players[i]])         {             cs_set_user_team(Players[i], CS_TEAM_CT)             CT[Players[i]] = false         }     } }
__________________
Sorry for my English, I'm Russian.

Last edited by Kard1nal; 04-15-2013 at 04:23.
Kard1nal is offline
Send a message via Skype™ to Kard1nal
Reply


Thread Tools
Display Modes

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 10:54.


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