AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Help: Custom Stats (https://forums.alliedmods.net/showthread.php?t=187419)

^SmileY 06-12-2012 21:56

Help: Custom Stats
 
1 Attachment(s)
Performance? Any suggestions??

Ps.
I will be done the plugin with a SQLx later.

And help for saving method:

On new round + client disconnect

or

On round end + client disconnect..

I will appreciate any help :P

Backstabnoob 06-13-2012 06:27

Re: Help: Custom Stats
 
PHP Code:


for(new i;iNum;i++)
{
     
Players iPlayers[i];
     new 
CsTeams:iTeam cs_get_user_team(Players); 

You should create the variable outside the loop.

<VeCo> 06-13-2012 07:35

Re: Help: Custom Stats
 
PHP Code:

 switch(Place)
 {
  case 
HIT_GENERICStatsData[Attacker][_Hit_Generic] += 1;
  
  case 
HIT_HEADStatsData[Attacker][_Hit_Head] += 1;
  
  case 
HIT_CHESTStatsData[Attacker][_Hit_Chest] += 1;
  
  case 
HIT_STOMACHStatsData[Attacker][_Hit_Stomach] += 1;
  
  case 
HIT_LEFTARMStatsData[Attacker][_Hit_Left_Arm] += 1;
  
  case 
HIT_RIGHTARMStatsData[Attacker][_Hit_Right_Arm] += 1;
  
  case 
HIT_LEFTLEGStatsData[Attacker][_Hit_Left_Leg] += 1;
  
  case 
HIT_RIGHTLEGStatsData[Attacker][_Hit_Right_Leg] += 1;
 } 

-->

PHP Code:

StatsData[Attacker][Place 7] += 1


^SmileY 06-13-2012 10:13

Re: Help: Custom Stats
 
k+ thanks

round end or new round?

Backstabnoob 06-13-2012 10:35

Re: Help: Custom Stats
 
It's up to you, it doesn't matter.

^SmileY 06-13-2012 15:57

Re: Help: Custom Stats
 
PHP Code:

            switch(cs_get_user_team(Players))
            {
                case 
CS_TEAM_T:
                {
                    
StatsData[Players][_Rounds_Played]++;
                    
                    
StatsData[Players][_Round_Wins]++;
                }
                case 
CS_TEAM_CT:
                {
                    
StatsData[Players][_Rounds_Played]++;
                    
                    
StatsData[Players][_Rounds_Loses]++;
                }
            } 

Sorry, small fix

DjOptimuS 06-13-2012 16:06

Re: Help: Custom Stats
 
PHP Code:

public bomb_planting(id)
{
    if(!
get_pcvar_num(p_Active)) return;
    
    
StatsData[id][_Bomb_Planting] += 1;


also

PHP Code:

public bomb_defusing(id)
{
    if(!
get_pcvar_num(p_Active)) return;
    
    
StatsData[id][_Bomb_Defusing] += 1;


Add repeating protect, i saw many players that press the +USE button several times before beggining the actual defuse process.

Or you may add a cooldown, IE. don't count if it is pushed more than once in a second or so.

^SmileY 06-13-2012 16:29

Re: Help: Custom Stats
 
Incorrect: Only counts when a progress bar its open.

DjOptimuS 06-13-2012 16:44

Re: Help: Custom Stats
 
yes i know, but he can push the +USE button till the progress bar appears, and then he can -USE (cancel the action) and after that +USE again

it's the same thing

^SmileY 06-13-2012 17:56

Re: Help: Custom Stats
 
Updated code witch CSW and HIT Constants.


All times are GMT -4. The time now is 06:16.

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