AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Jumpkick Worldspawn Kill Detection (https://forums.alliedmods.net/showthread.php?t=129704)

TheFrozenFire 06-16-2010 00:33

Jumpkick Worldspawn Kill Detection
 
1 Attachment(s)
Hello :)

I'm trying to modify the Jumpkick plugin by Hawk552, in order to have it account for kills induced by jumpkicking a player into the ground, or into a hazard.

To achieve this, my idea was to have an array which keeps track, by player ID, which player has jumpkicked each player last. I also set a task to zero out the element for each player after a set number of seconds (so that if a player kills themself, the last player doesn't always get the kill).

A function is then registered to DeathMsg, filtered with the KillerID being 0, and the weapon being worldspawn. This function checks the tracking array to see if the victim is associated with an attacker, and if it is, it registers the death as a kill for the respective attacker.

For some reason, this method isn't working. The modified plugin compiles fine, and loads fine, but kills are not registering.

Here is a diff of my edits to the current Jumpkick plugin:
Code:

6a7
> new attackerID[33];
17a19,20
>    register_cvar("amx_jumpkick_world", "1");
>    register_cvar("amx_jumpkick_worldtime", "3.0");
19a23,24
>    register_event("DeathMsg", "worldKill", "a", "1=0", "4=worldspawn");
>   
50a56,60
>            if(get_cvar_num("amx_jumpkick_world") == 1) {
>                remove_task(ent);
>                attackerID[ent] = id;
>                set_task(get_cvar_float("amx_jumpkick_worldtime"),"worldKillUnset",ent);
>            }
58d67
<
97a107,122
> public worldKill()
> {
>    new victim = get_msg_arg_int(2);
>    if(attackerID[victim] == 0) return PLUGIN_CONTINUE;
>   
>    createKill(victim, attackerID[victim], "Jumpkick Against Ground");
>    worldKillUnset(victim);
>    return PLUGIN_CONTINUE;
> }
>
> public worldKillUnset(id)
> {
>    attackerID[id] = 0;
>    return 0;
> }
>

I just started with Pawn and AMXX, so forgive me if anything is blatantly silly. I've been coding in PHP and C for several years now, so I'm competent in most regards, but AMXX is substantially different from the environment I'm accustomed to.


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

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