AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Solved [CSTRIKE] team kill positive fragging (https://forums.alliedmods.net/showthread.php?t=330503)

Natsheh 02-07-2021 10:36

[CSTRIKE] team kill positive fragging
 
how to change team kill to a positive fragging instead of getting -1 kill.

I'm searching for an efficient method to use .

SpliN 02-07-2021 10:50

Re: [CSTRIKE] team kill positive fragging
 
Quote:

Originally Posted by Natsheh (Post 2736031)
how to change team kill to a positive fragging instead of getting -1 kill.

I'm searching for an efficient method to use .

try this bro notice i am newbie in the amxmodx
PHP Code:

/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <amxmisc>
#include <fun>

#define PLUGIN "team kill"
#define VERSION "1.0"
#define AUTHOR "SpliN"

public plugin_init() {
    
    
register_event"DeathMsg""Death""a" )
    
}

public 
Death(id
{
    new 
teamkiller[35],teamvictim[35]
    new 
killerid read_data(1)
    new 
victimid read_data(2)
    new 
killerfrags get_user_frags(killerid)
    
get_user_team(killerid,teamkiller,charsmax(teamkiller))
    
get_user_team(victimid,teamkiller,charsmax(teamvictim))
    
    if(
equali(teamkiller,teamvictim))
    {
        
set_user_frags(killerid,killerfrags 2)
    
    }



Natsheh 02-07-2021 11:09

Re: [CSTRIKE] team kill positive fragging
 
yup this method is the one i am trying to avoid.



SOLVED :>

PHP Code:

new g_iMaxplayersg_iUSER_KILLS[33];

public 
plugin_init()
{
   
RegisterHam(Ham_Killed"player""fw_player_killed_post"1);
   
register_message(get_user_msgid("ScoreInfo"), "fw_message_scoreinfo");
   
g_iMaxplayers  get_maxplayers();
}

public 
fw_player_killed_post(victimkillergib)
{
    if( ( 
<= iKiller <= g_iMaxplayers ) && iKiller != iVictim )
    {
        
g_iUSER_KILLS[iKiller] ++;
        
set_user_frags(iKillerg_iUSER_KILLS[iKiller]);
        
                
// sometimes the scoreboard doesn't get updated with the correct frags.
        
message_begin(MSG_ALLget_user_msgid("ScoreInfo"), _0);
        
write_byte(iKiller);
        
write_short(g_iUSER_KILLS[iKiller]);
        
write_short(get_user_deaths(iKiller));
        
write_short(0);
        
write_short(get_user_team(iKiller));
        
message_end();
    }
}

public 
fw_message_scoreinfo(msgiddestid)
{
    new 
target get_msg_arg_int);
    
    
set_msg_arg_intARG_SHORTg_iUSER_KILLS[target]);
}

public 
client_disconnect(idg_iUSER_KILLS[id] = 0


SpliN 02-07-2021 13:03

Re: [CSTRIKE] team kill positive fragging
 
worked for u my way to acheive what u want

SpliN 02-07-2021 13:13

Re: [CSTRIKE] team kill positive fragging
 
i think two codes are the same but used different things

Bugsy 02-07-2021 13:34

Re: [CSTRIKE] team kill positive fragging
 
They do the same thing in different ways, where you add 2 kills for only TK while his code always gives + 1 for any kill.

Your code can be cleaned up a bit:
PHP Code:

public Death(id
{
    new 
killerid read_data)
    new 
victimid read_data)
    
    if ( 
is_user_connectedkillerid ) && ( cs_get_user_teamkillerid ) != cs_get_user_teamvictimid ) ) )
    {
        
set_user_fragskillerid get_user_fragskillerid ) + )
    }



SpliN 02-07-2021 15:18

Re: [CSTRIKE] team kill positive fragging
 
when he kill his friend he will get -1 then you should add 1 for remove -1 then add 1 to make him get a frags to make the kill positive

Bugsy 02-07-2021 16:59

Re: [CSTRIKE] team kill positive fragging
 
He is keeping a count of kills in a variable and then using that value to set the kill count & scoreboard, so it doesn't matter how many kills the game gives, or takes away.

SpliN 02-07-2021 17:28

Re: [CSTRIKE] team kill positive fragging
 
ah ok thanks bugsy
bro i have problem with zp 6.2 ultimatex by sidewinder i fixed the tag and i need help in teambugfix


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

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