AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   If you kill a teammate twice, banned. (https://forums.alliedmods.net/showthread.php?t=162821)

Diegorkable 07-23-2011 10:12

If you kill a teammate twice, banned.
 
Hey guys, I registered an event, that it'll hopefully work, that like the title says, if you TK twice you get banned for 1 minute, for some reason it doesnt work, maybe the register i did is not correct since im not familliar with it:

PHP Code:

/* Global */
new g_LeftKills[11]   // It is set to 2 when a client connects, look at public client_connect()
new bool:g_IsStarted     // When a match starts it is set to true, trust me it works cuz i tested it. 
/* Global */


public plugin_init()
{
        
register_event("DeathMsg""tk""b")
}

public 
client_connect(id)
{
      
g_LeftKills[id] = 2
}

public 
tk()
{
    new 
killer read_data(1)
    new 
victim read_data(2)
    
    if (
g_IsStarted)
    {
        if ((
cs_get_user_team(killer) == cs_get_user_team(victim)))
        {
            if (
g_LeftKills[killer] == 2)
            {
                
client_print(killerprint_chat"%s Warning! DO NOT Team-Kill, 1 more TK and you will be banned."PREFIX)
                
client_print(killerprint_chat"%s Warning! DO NOT Team-Kill, 1 more TK and you will be banned."PREFIX)
                
g_LeftKills[killer]--
            }
            
            else if (
g_LeftKills[killer] == 1)
            {
                
server_cmd("amx_ban #%d 60 Team-Kills are not allowed!"get_user_userid(killer))
            }
        }
    }



bibu 07-23-2011 10:27

Re: If you kill a teammate twice, banned.
 
"mp_autokick 1"

Diegorkable 07-23-2011 10:58

Re: If you kill a teammate twice, banned.
 
Thanks but no thanks, can someone now please tell me whats wrong with my code?

mp_autokick just kicks him if he TKs, and not at the number of times I want, except that, it doesnt ban, the player can get kicked, relog, and TK again, so no thanks.

bibu 07-23-2011 11:06

Re: If you kill a teammate twice, banned.
 
"Enables automatic team-killer banning."

Diegorkable 07-23-2011 11:11

Re: If you kill a teammate twice, banned.
 
Dude, just leave that mp_autokick alone, if you can't help me with the code i posted dont. Still thanks for the suggestion.

HBxander 07-23-2011 11:14

Re: If you kill a teammate twice, banned.
 
PHP Code:

new boolg_IsStarted 

returns to? you only use it here:
PHP Code:

if(g_IsStarted

and its always false, when you dont change it.
Im 99% sure about thats the bug.

Diegorkable 07-23-2011 11:50

Re: If you kill a teammate twice, banned.
 
I said in the code..... g_IsStarted is true when a MATCH STARTS, you dont see it here cuz i didnt post the code, once again, i tested it, and g_IsStarted turns true.

bibu 07-23-2011 12:22

Re: If you kill a teammate twice, banned.
 
Debug it then.

Diegorkable 07-23-2011 12:23

Re: If you kill a teammate twice, banned.
 
...... I did, the reason I post here is because I've already done it and can't figure out whats going on.

bibu 07-23-2011 12:25

Re: If you kill a teammate twice, banned.
 
Quote:

Originally Posted by Diegorkable (Post 1516819)
...... I did.

Show what you did? The best would be do add some messages, then you can at least see till when the plugin works.


All times are GMT -4. The time now is 17:01.

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