This site is a testing version, but all data is shared with the live forum.


Raised This Month: $ Target: $400
 0% 

Finding values


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
@omik][Fusion
Member
Join Date: Nov 2005
Location: Killeen,Tx
Old 12-25-2005 , 15:26   Finding values
Reply With Quote #1

Happy holidays to all amxx patrons. I'm trying to write a plugin for my server and I'm have trouble with two things, since I'm still new to scripting and constantly learning. Anyways, 1. How do I find a players number of consecutive kills? 2. How do I find/catch/determine the start of a new round?

Any help anyone can give would be appreiciated. Thanks and Happy holidays once again.
@omik][Fusion is offline
Brad
AMX Mod X Team Member
Join Date: Jun 2004
Old 12-25-2005 , 15:47  
Reply With Quote #2

I'm doing this all from my head as we're about to have guests over so I can't look up and give you exact answers.

Quote:
1. How do I find a players number of consecutive kills?
I think this is something you'd have to track yourself. Setup a global array for the player kills and each time they get one (I think you can check the "damage" message) increment their count. If it happens that they died, reset their count.

Quote:
2. How do I find/catch/determine the start of a new round?
Depends. You can capture the "HUD reset" event but I don't recommend it as it can be exploited. My preferred method, unless circumstances dictate I do it otherwise, is to capture the log event for the round starting. It occurs right as the freeze time expires. You can probably search for "round_start" or something similar to find how to do this. Alternately, you can look at my three plugins and find how I did it (I don't recall which of the 3 has it).
Brad is offline
@omik][Fusion
Member
Join Date: Nov 2005
Location: Killeen,Tx
Old 12-25-2005 , 21:16  
Reply With Quote #3

Thanks for the suggestion brad. I think I found out how to capture a players consecutive kill value. I tried a global value like u said. The round start is a bit tricky. I found your bad camper sma which had the event_round_start in it, but it had a different set, i copied and tried to get to it run the commands I want to at round start but it keeps saying argument type mismatch. any suggestions?
@omik][Fusion is offline
@omik][Fusion
Member
Join Date: Nov 2005
Location: Killeen,Tx
Old 12-26-2005 , 03:16  
Reply With Quote #4

Anybody know how to fix an "array must be indexed error" when compiling?
@omik][Fusion is offline
teame06
i have a hat
Join Date: Feb 2005
Location: Hat City
Old 12-26-2005 , 03:52  
Reply With Quote #5

Quote:
Looks around for source code.
__________________
No private support via Instant Message
GunGame:SM Released
teame06 is offline
Send a message via AIM to teame06
haimmaik
Senior Member
Join Date: Jul 2005
Old 12-26-2005 , 04:01  
Reply With Quote #6

1: in ur plugin_init u need to register a death event

Code:
public plugin_init(){ . . register_event("DeathMsg","func_killdeath","a") // insted of "func_killdeath" you can put any function u want . } public func_killdeath(){ new killer=read_data(1) //get the killer's id new victim=read_data(2) //get the victim's id new headshot=read_data(3) //if headshot =1 if not =0 . . }

2. in ur plugin_init function u need to add a logevent of start round

Code:
public plugin_init(){ . . register_logevent("func_update",2,"0=World triggered","1=Round_Start") //insted of "func_update" u can put any function u want . } public func_update(){ . . //anything u want to happen when new round start . . }

hope i helped

Quote:
Originally Posted by @omik
[Fusion]Anybody know how to fix an "array must be indexed error" when compiling?
fix ur array..
new array[num]

the num must be bigger in 1 than what u want

example: if u need 32 players ur array will be players[33]
cuz it starts from 0 and ends in 32

u CANT do
players[33] = 5 (for example) .. that will give u index error.

(if u can also post ur code here that will be helpful)
haimmaik is offline
@omik][Fusion
Member
Join Date: Nov 2005
Location: Killeen,Tx
Old 12-26-2005 , 04:38  
Reply With Quote #7

thanks for the help so far guys...and yeah, the source code would be helpful. this is what i have so far
[small]

removed source code due to rewriting it, will repost source code once finished

/*small

^^^^Sorry bout that guys^^^^^ /small*/
@omik][Fusion is offline
Freecode
Never Fall Asleep
Join Date: Jan 2004
Old 12-26-2005 , 05:53  
Reply With Quote #8

well ur array is [32][2] and ur comparing only 1 ( g_streak[killer] )
im guessing the [2] was for the team or something. So u either do g_streak[killer][1] or g_streak[killer][0]
Freecode is offline
@omik][Fusion
Member
Join Date: Nov 2005
Location: Killeen,Tx
Old 12-26-2005 , 06:34  
Reply With Quote #9

thanks for the tip freecode, i'll give it a try. from what you saw, did i do most everything correct? in theory, would my code work or do you see any discrepencies there might be? or also if any experienced amxx scripter. im open to learning.

*EDIT To freecode, ur tip worked, it compiled with not a single error. but, it compiled on all values, 0 - 2. perhaps you could help to explain this type of value to me. this was a suggestion given to me by another scripter that i frequently chat with, but i do not fully understand its usage, purpose, etc. except from what i assume is its what tracks consecutive kills. please help. thanks again to all amxx scripters willing to help a newb on this.

*EDIT Figured out how to use that specific array. Thanks to all
@omik][Fusion is offline
Reply



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 14:17.


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