AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   weapon[][] (https://forums.alliedmods.net/showthread.php?t=117652)

ProIcons 02-03-2010 08:47

weapon[][]
 
PHP Code:

weapon[MKiller][Pkills[MKiller]+1] = data[weapon

This could be work? I want for each player (MKiller) for each kill (Pkills[MKiller]+1 (On Kill)) to set the weapon
can i do that?:S

Bugsy 02-03-2010 08:51

Re: weapon[][]
 
Quote:

Originally Posted by ProIcons (Post 1077033)
PHP Code:

weapon[MKiller][Pkills[MKiller]+1] = data[weapon

This could be work? I want for each player (MKiller) for each kill (Pkills[MKiller]+1 (On Kill)) to set the weapon
can i do that?:S

What does weapon hold? MKiller = player id? Pkills[] = player kills?

Owyn 02-03-2010 09:02

Re: weapon[][]
 
PHP Code:

new playerdata[33][33]

playerdata[killer][victim] = weapon

?

ProIcons 02-03-2010 09:24

Re: weapon[][]
 
No well, i have 10 Cvars with player nicks...
player_1 = ASD
player_2 = adsafa

No when someone kill someone else i am holding him kills. now i want if player == "ASD" to set on a var
weapon[1][Kills[1]] = Weapon
i mean on the first slot will have the player's number and on the second the player's kills so at the end of the map to read the gun of every kill. ex

ASD killed Test1 with m4a1
ASD killed Test1 with knife

weapon[1][1] Will be: m4a1
weapon[1][2] Will be: knife

Owyn 02-03-2010 09:41

Re: weapon[][]
 
new weapon[33][33] - for killer and victim = weapon killed with

and reset all values on new round

then on when you need frags and the rest count values and if weapon is not zero so you have a frag with who killed, whom killed and with what killed data

Bugsy 02-03-2010 10:03

Re: weapon[][]
 
PHP Code:

g_KillData33 ][ ];

g_KillDatavictim ][ ] = killer;
g_KillDatavictim ][ ] = weaponid


ProIcons 02-03-2010 10:59

Re: weapon[][]
 
Quote:

Originally Posted by Bugsy (Post 1077124)
PHP Code:

g_KillData33 ][ ];

g_KillDatavictim ][ ] = killer;
g_KillDatavictim ][ ] = weaponid


I Don't want this i want

var[NUMBER][KILLS] = GUN

var[1][43] = ak47
...

Bugsy 02-03-2010 13:50

Re: weapon[][]
 
Doing it this way you must reset the g_KillNum[] at round start or else you run the risk of getting an out-of-bounds error. Currently it can only handle up to 31 kills since HL servers only support 32 players so this # will suffice If you want to store a larger number, increase 31 to a larger number.

Untested
PHP Code:

//***** If you want to store the weapon name for each kill use this: 
new g_KillData33 ][ 31 ][ 18 ];
new 
g_KillNum33 ];

//Retrieve weapon name here and store in array position 
g_KillDataid ][ g_KillNumid ]++ ];

//Or if you have the weapon index do this 
get_weaponnameiWeaponIndex g_KillDataid][ g_KillNumid ]++ ] , 17 );

//To display kill info 
new iNumKills g_KillNumid ];
for ( new 
iNumKills i++ ) 
      
client_printid print_chat "Kill %d was with %s" i+g_KillDataid ][ ] );

//***** If you want to store the weapon index use this: 
new g_KillData33 ][ 31 ];
new 
g_KillNum33 ];

g_KillDataid ][ g_KillNumid ]++ ] = WeaponIndex 

new iNumKills g_KillNumid ];
new 
szWeapon18 ];
for ( new 
iNumKills i++ )

      
get_weaponnameg_KillDataid ][ g_KillNumid ] ] , szWeapon 17 );
      
client_printid print_chat "Kill %d was with%s" i+g_KillDataid ][ ] );


This way will work without resetting anything Each player will have an array of each weapon ndex. The array element will increase for each kill with that weapon.

Untested
PHP Code:

new g_KillData33 ][ 31 ];
g_KillDataid ][ WeaponIndex ]++; // ie. g_KillData[ id ][ CSW_M4A1 ]++;

new szWeapon18 ] , iKillVal

for ( new 
31 i++ )

      
iKillVal g_KillDataid ][ ];
      if ( 
iKillVal )
      { 
            
get_weaponnameszWeapon 17 );
            
client_printid print_chat "%d kills with %s" iKillVal szWeapon );
      }




All times are GMT -4. The time now is 07:20.

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