AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Finding values (https://forums.alliedmods.net/showthread.php?t=22390)

@omik][Fusion 12-25-2005 15:26

Finding values
 
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.

Brad 12-25-2005 15:47

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).

@omik][Fusion 12-25-2005 21:16

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 12-26-2005 03:16

Anybody know how to fix an "array must be indexed error" when compiling?

teame06 12-26-2005 03:52

Quote:

Looks around for source code.

haimmaik 12-26-2005 04:01

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)

@omik][Fusion 12-26-2005 04:38

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*/

Freecode 12-26-2005 05:53

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]

@omik][Fusion 12-26-2005 06:34

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


All times are GMT -4. The time now is 15:47.

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