AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Team add score (https://forums.alliedmods.net/showthread.php?t=282838)

abdobiskra 05-18-2016 16:45

Team add score
 
Hi !
i want change score frag value (1 to 5 ) evry team T & CT

i try this do like that ... no thing ...who can give me correct code to do it ?

PHP Code:

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


new g_iTeam[33];
new 
MaxPlayers;

enum
{
    
CS_TEAM_T 1,
    
CS_TEAM_CT 2,
    
CS_TEAM_SPECTATOR 3
};

public 
plugin_init() {
    
    
register_event("DeathMsg""player_killed""a")
    
MaxPlayers get_maxplayers();
}

public 
player_killed()
{
    new 
CTiGift 5
    
new TiGift 2
    
    
new iKiller read_data(1)
    new 
id read_data(2)
    
    new 
tid get_user_team(iKiller)
    
    switch(
tid)
    {
        case 
1g_iTeam[iKiller] = CS_TEAM_T;
        case 
2g_iTeam[iKiller] = CS_TEAM_CT;
        default: return;
    }
    
    if(
<= iKiller <= MaxPlayers)
    {
        
        if(
get_user_team(id) == tid)
        {
            if(
tid == CS_TEAM_T 
            { 
                
player_setScore(tidTiGift)
            } 
            if(
tid == CS_TEAM_CT 
            { 
                
player_setScore(tidCTiGift)
            } 
        }
    }



player_setScore(idiAddFrags)
{
    new 
iFrags get_user_frags(id)
    new 
iDeaths get_user_deaths(id)
    
    new 
tid get_user_team(id)
    
    if(
iAddFrags != 0)
    {
        
iFrags += iAddFrags
        set_user_frags
(idiFrags)
    }
    
message_begin(MSG_BROADCASTget_user_msgid("TeamScore"))
    
write_byte(id)
    
write_short(iFrags)
    
write_short(iDeaths)
    
write_short(0)
    
write_short(tid)
    
message_end()
    
    



abdobiskra 05-20-2016 16:28

Re: Team add score
 
bump!

EFFx 05-20-2016 19:23

Re: Team add score
 
set_user_frags(id,get_user_frags(id) + 4) ( +1 by default game ) = 5, so simple

siriusmd99 05-21-2016 16:54

Re: Team add score
 
public player_killed(){
killer = read_data(1)
set_user_frags(killer, get_user_frags(killer) + 4)
}


Fun and amxmodx module , good luck.

abdobiskra 05-21-2016 17:13

Re: Team add score
 
i do like this for team !

PHP Code:

public player_killed(){

killer read_data(1)
new 
team get_user_team(killer)
if(
team == )
{
    
set_user_frags(killerget_user_frags(killer) + 1)
}
if(
team == )
{
    
set_user_frags(killerget_user_frags(killer) + 4)
}




EFFx 05-21-2016 19:37

Re: Team add score
 
You're a pro scripter man, Want you work for me?

abdobiskra 05-22-2016 03:29

Re: Team add score
 
Quote:

Originally Posted by EFFx (Post 2420893)
You're a pro scripter man, Want you work for me?

:bee::bee:

If I am well Why do I need to help
Just some simple things
I ask if it is a right way or not ?

siriusmd99 05-22-2016 05:51

Re: Team add score
 
yes, it's OK but you can do much more simple:

set_user_frags(killer, get_user_frags(killer) + get_user_team(killer) == 2 ? 4 : 1)


All times are GMT -4. The time now is 18:36.

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