AlliedModders

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

capndurk 03-28-2006 00:03

FM_AlertMessage
 
I have this code:

Code:
register_forward(FM_AlertMessage, "eventSuicide")


I do want to block this message for the purpose of saving rank, but I'm having trouble with this:

Code:
public eventSuicide(at_type, message[]) {     if(containi(message, "suicide") != -1 && containi(message, "world") != -1)     {         if(g_switching[id] == true)         {             return FMRES_HANDLED         }     }         return PLUGIN_CONTINUE }


Basically, I have a global integer array that uses the 32 ids in the server, and I was wondering if there was a way to use at_type to gather that id from the function..?

Twilight Suzuka 03-28-2006 00:05

Why are you trying to capture suicide in that way?

We have a forward for suicide:
client_kill in engine

Also, there are other ways to capture damage and the like.

capndurk 03-28-2006 00:08

This isn't for when a user types kill in the console, it's for when he switches teams using the chooseteam function. Does team-switching still execute kill on the player's console?

Twilight Suzuka 03-28-2006 00:26

Why is it called eventSuicide then?

capndurk 03-28-2006 00:29

Err... personal touch? Lol, I just thought it appropriate since it's an event and I'm trying to capture when it happens. I've seen "blocksuicide" also, maybe that would be better.

capndurk 03-28-2006 00:44

Removed.

Twilight Suzuka 03-28-2006 01:02

It isn't spam, it was an honest attempt to try ot understand your problem and help you with it. It wasn't a pointless question; I was trying to understand what it did.

Now then, I understand now you are catching when a client dies, and is killed by worldspawn, so you can figure out when they change teams. Makes...some sense. However, clients are killed by worldspawn due to fall damage too, so I didn't understand to start with.

However, to answer your question: Check to see what at_type is. It might be the id of the player. If not, try read_data. Its still a message, so it should be possible to get said information back, unless its simply a debug or log message, in which case, you may need to use some other method of getting when this occurs.

Unfortunately, I still don't understand why you are using AlertMessage for this. Why are you trying to block the message? I don't see why there is a reason to block it. Why not use one of the messages that goes with register_message? I'm sure there is one for changing teams, or some other method which doesn't have a loophole like this one?

capndurk 03-28-2006 01:08

My goal in all this is to protect a person's rank when he switches teams, as well as his score within the server (+showscores thing). In order to protect the person's rank, I have to retrieve the message before it's stored in csstats.dat or whatever that file is, and the only way to do that is to capture the suicide using Fakemeta (as far as I can see).

So, if the person is switching (g_switching[id]), then I return FMRES_SUPERCEDE in order to block the message, and that will stop it from saving to the .dat file. This integer array is what also separates the regular suicides from the team-switching suicides.

//Edit// I also do have a couple bugs in mind that need fixing, but I just wanted to get this part of the plugin finished first.


P.S. Thanks for the help.

Freecode 03-28-2006 01:11

capndurk: No, at_type doesnt return the id. It identifies the type of message.
Code:

at_notice,
        at_console,                // same as at_notice, but forces a ConPrintf, not a message box
        at_aiconsole,        // same as at_console, but only shown if developer level is 2!
        at_warning,
        at_error,
        at_logged                // Server print to console ( only in multiplayer games ).

And if your using this in CS then it should always be at_logged

Twilight Suzuka 03-28-2006 01:12

That won't work, modules get the information quicker. You'll need to tell the module, not try and prevent the module from getting the info.


All times are GMT -4. The time now is 16:29.

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