Raised This Month: $ Target: $400
 0% 

weapon[][]


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
ProIcons
Senior Member
Join Date: Jan 2009
Location: Greece - Salonica
Old 02-03-2010 , 08:47   weapon[][]
Reply With Quote #1

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
__________________
function rb return $regsubex($$1-,/(.)/g,$+($chr(2) $+ $chr(3),$r(2,15),$chr(2),\1))
ProIcons is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 02-03-2010 , 08:51   Re: weapon[][]
Reply With Quote #2

Quote:
Originally Posted by ProIcons View Post
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?
__________________
Bugsy is offline
Owyn
Veteran Member
Join Date: Nov 2007
Old 02-03-2010 , 09:02   Re: weapon[][]
Reply With Quote #3

PHP Code:
new playerdata[33][33]

playerdata[killer][victim] = weapon
?
__________________
☜ Free Mozy ☂backup\҉sync user
Quote:
Американский форум - Задаёшь вопрос, потом тебе отвечают.
Израильский форум - Задаёшь вопрос, потом тебе задают вопрос.
Русский форум - Задаёшь вопрос, потом тебе долго рассказывают, какой ты мудак.
Owyn is offline
Send a message via ICQ to Owyn
ProIcons
Senior Member
Join Date: Jan 2009
Location: Greece - Salonica
Old 02-03-2010 , 09:24   Re: weapon[][]
Reply With Quote #4

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
__________________
function rb return $regsubex($$1-,/(.)/g,$+($chr(2) $+ $chr(3),$r(2,15),$chr(2),\1))
ProIcons is offline
Owyn
Veteran Member
Join Date: Nov 2007
Old 02-03-2010 , 09:41   Re: weapon[][]
Reply With Quote #5

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
__________________
☜ Free Mozy ☂backup\҉sync user
Quote:
Американский форум - Задаёшь вопрос, потом тебе отвечают.
Израильский форум - Задаёшь вопрос, потом тебе задают вопрос.
Русский форум - Задаёшь вопрос, потом тебе долго рассказывают, какой ты мудак.

Last edited by Owyn; 02-03-2010 at 09:47.
Owyn is offline
Send a message via ICQ to Owyn
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 02-03-2010 , 10:03   Re: weapon[][]
Reply With Quote #6

PHP Code:
g_KillData33 ][ ];

g_KillDatavictim ][ ] = killer;
g_KillDatavictim ][ ] = weaponid
__________________
Bugsy is offline
ProIcons
Senior Member
Join Date: Jan 2009
Location: Greece - Salonica
Old 02-03-2010 , 10:59   Re: weapon[][]
Reply With Quote #7

Quote:
Originally Posted by Bugsy View Post
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
...
__________________
function rb return $regsubex($$1-,/(.)/g,$+($chr(2) $+ $chr(3),$r(2,15),$chr(2),\1))
ProIcons is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 02-03-2010 , 13:50   Re: weapon[][]
Reply With Quote #8

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 );
      }

__________________

Last edited by Bugsy; 02-03-2010 at 13:56.
Bugsy is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


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


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