AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Catching index of an event. (https://forums.alliedmods.net/showthread.php?t=189913)

Santaaa 07-12-2012 11:07

Catching index of an event.
 
Hello there, im trying to catch the index of the player who used it of this event.

PHP Code:

register_event("23""Cmdspray""a""1=112"

I thought it was read_data(2), and im sure it is. I used it on my other plugins too, but it isnt working now.

Even tryed a loop to give it +1 for everyone, even that didnt work. LOL

Exolent[jNr] 07-12-2012 11:26

Re: Catching index of an event.
 
Show the callback function you are using.

Santaaa 07-12-2012 11:35

Re: Catching index of an event.
 
This is what I used.

PHP Code:

/* Plugin generated by AMXX-Studio */

#include <amxmodx>

#define PLUGIN "Spray counter"
#define VERSION "1.0"
#define AUTHOR "Santa"

new Sprays[33]

public 
plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
register_event("23""Cmdspray""a""1=112")  
}

public 
Cmdspray()
{
    new 
id read_data(2)
    
    
Sprays[id]++



hleV 07-12-2012 11:37

Re: Catching index of an event.
 
Add a debug.
Code:
log_amx("Sprayer ID: %d", id);

Santaaa 07-12-2012 12:12

Re: Catching index of an event.
 
Nothing wrong.

Exolent[jNr] 07-12-2012 12:14

Re: Catching index of an event.
 
Quote:

Originally Posted by Santaaa (Post 1748800)
Nothing wrong.

What does the debug show?

Santaaa 07-12-2012 12:33

Re: Catching index of an event.
 
When I do this in an apart plugin it works, but if I add it in my other plugin it doesnt work, im using the same code btw.

<VeCo> 07-12-2012 13:25

Re: Catching index of an event.
 
Then maybe there is a missing function that stops the execution of plugin_init and the code below that line. Check for runtime errors.

Exolent[jNr] 07-12-2012 14:08

Re: Catching index of an event.
 
Quote:

Originally Posted by Santaaa (Post 1748807)
When I do this in an apart plugin it works, but if I add it in my other plugin it doesnt work, im using the same code btw.

Show the full plugin where it breaks.

Santaaa 07-12-2012 15:22

Re: Catching index of an event.
 
Well, I dont know what the problem was but I rewrote my plugin and its just fixed. Maybe because i've been using old include files? can that be the issue? because I upgraded my AMXX right now and it worked.


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

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