AlliedModders

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

ProIcons 03-19-2011 15:34

Gun Stats Counting...
 
Well , i have a code and i want on each kill / death to Count for 2 players gun stats. For the killer and the victim...
ex:

PHP Code:

new PlayerID[32];
new 
g_weap_names[32][32] = {"""p228""""scout""hegrenade",
"xm1014""c4""mac10""aug""smokegrenade""elite",
"fiveseven""ump45""sg550""galil""famas""usp""glock18",
"awp""mp5navy""m249""m3""m4a1""tmp",
"g3sg1""flashbang""deagle""sg552""ak47",
"knife""p90"""}
public 
client_death(killervictimwpnindexhitplaceTK)
{
    new 
headshot = ( hitplace == HIT_HEAD ) : "yes" "no"
    
new const HitPlaceStrings[][] = 
    {
        
"Generic",
        
"Head",
        
"Chest",
        
"Stomach",
        
"LeftArm",
        
"RightArm",
        
"LeftLeg",
        
"RightLeg"
    
};
    new 
killername[32], victimname[32], actuallkillerid[33], actuallvictimid[33]
    
get_user_name(killer,killername,31)
    
get_user_name(victim,victimname,31)
    
format(actualkillerid,PlayerID[killername],32);
    
format(actualvictimid,PlayerID[victimname],32);
    
msg("Kill Status: Killer: %s (%d) / Victim: %s (%d) / Weapon: %d / Hitplace: %s / TK: %d / HeadShot: %s ",killernamekillervictimnamevictimwpnindexHitPlaceStringshitplace ] , TKheadshot );


Well First of all in the array
PlayerID[32]
i store virtual ids for each player. Base on theese ids i want to store in a database for each player gunstats. Kills and deaths from each gun for each player.

now i want to make an array and put the stats in it
example:

weaponstats[32 -PlayerID][32 - WeaponID][1 - Kill - Deaths]
example for killing:
weaponstats[killer][wpnindex][0] - 0 for kills
weaponstats[victim][wpnindex][1] - 1 for deaths

But i am not sure how to make it :D
can anyone help me ?:D

ProIcons 04-22-2011 11:39

Re: Gun Stats Counting...
 
bump

Bugsy 04-22-2011 12:30

Re: Gun Stats Counting...
 
Untested
PHP Code:

const MAX_PLAYERS 32;

enum Score
{
     
Kills,
     
Deaths
}

new 
PlayerDataMAX_PLAYERS ][ 32 ][ Score ];

PlayerDataKillerID ][ WeaponID ][ Kills ]++;
PlayerDataVictimID ][ WeaponID ][ Deaths ]++; 



All times are GMT -4. The time now is 14:30.

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