AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   New Plugin Submissions (https://forums.alliedmods.net/forumdisplay.php?f=26)
-   -   One-Shot Multikill Detection (https://forums.alliedmods.net/showthread.php?t=292337)

EFFx 01-03-2017 19:17

One-Shot Multikill Detection
 
4 Attachment(s)
One-Shot Multikill Detection


First release: 03/01/2017
Last update: 04/15/2017



- Description
This plugin allow players to see if someone has killed two or more players just with one bullet.

- Cvars
Code:

// (c) One-Shot MultiKill Detection

// Used for check the type of message that will show when someone
// kill two or more players with one bullet
// 2 = CHAT, 1 = LOG MESSAGE, 0 = HUD MESSAGE
osmd_messagetype "0"

// Used for turn on/off the plugin
osmd_enabled "1"

- Change Log
Spoiler


- How to install?
Put the .sma file on dir/addons/amxmodx/scripting
Put the .amxx file on dir/addons/amxmodx/plugins
Put the folder OneShotMD on dir/addons/amxmodx/configs
Put the file osm_detector.txt on dir/addons/amxmodx/data/lang

After it, put the plugin's name on plugins.ini

Craxor 01-03-2017 20:16

Re: Two or more for one detect
 
litttle horribile for the moment ( i mean the code and the indentation ) .. but i'm waiting :p

Also what about Laser Mod ? You should focus to only 1 plugin until you get something with it ...

Can pleaseeeeeee name it "kill two birds with one stone" : ) )

EFFx 01-03-2017 20:21

Re: Two or more for one detect
 
Sorry about the code, its my style
Sorry about the indentation, here in my Text editor* its nice.

I hate the name you said.

klippy 01-03-2017 21:30

Re: Two or more for one detect
 
Quote:

Originally Posted by EFFx (Post 2483241)
here in my compiler its nice.

Text editor*, compiler is something else.
Indentation looks alright to me, not sure what Craxor is talking about.

Quote:

Originally Posted by EFFx (Post 2483241)
I hate the name you said.

"Kill two birds with one stone" is a very popular phrase in English language. Naming your plugin "Two birds, one stone" (or similar) sounds much better and will be much more recognizable. Your current name actually is awful and doesn't make much sense. Even just "One-Shot Multikill Detection" would sound much better.


As for my suggestions, you should add a multiplugin forward in my opinion, so other plugins could detect such kills (with parameters: who did it, weapon used, array of victim ids, how many victims, array of "was it headshot" booleans for every victim). This would be useful for giving bonus XP and such in other mods, for example. That means that you should add an option to your cvar to disable the message completely and use this only as an API.

aEEk 01-03-2017 21:50

Re: Two or more for one detect
 
It's possible to make this plugin to look like csgo? I mean that 'dead icons' in right corner (I'm not so advanced in coding, maybe is possible using DLL). Did you understand?

PS: Thanks for source :)

EFFx 01-03-2017 21:54

Re: Two or more for one detect
 
Quote:

One-Shot Multikill Detection
Its look much better for me

Quote:

Originally Posted by aEEk (Post 2483264)
PS: Thanks for source :)

I appreciate it

That was the first name I found, but I was going to change him, I just was searching a better than the original
Sorry about the popular phrase on english, I don't knew it.

EFFx 01-03-2017 22:27

Re: One-Shot Multikill Detection
 
Quote:

Originally Posted by aEEk (Post 2483264)
It's possible to make this plugin to look like csgo? I mean that 'dead icons' in right corner (I'm not so advanced in coding, maybe is possible using DLL). Did you understand?

PS: Thanks for source :)

I don't know nothing from CSGO, but you can make a thread on SourceMod requesting that.

Quote:

Originally Posted by KliPPy (Post 2483257)
As for my suggestions, you should add a multiplugin forward in my opinion, so other plugins could detect such kills (with parameters: who did it, weapon used, array of victim ids, how many victims, array of "was it headshot" booleans for every victim). This would be useful for giving bonus XP and such in other mods, for example. That means that you should add an option to your cvar to disable the message completely and use this only as an API.

I just see it right now, its a great idea and I had that idea too.

Edit:
But how suggest you to I add this? Because the event DeathMsg will run only when someone has killed someone. If someone want to give a bonus for who has killed more than 1 player with one bullet, need just add on my source code.

fysiks 01-03-2017 23:41

Re: One-Shot Multikill Detection
 
Line 303 (shown below) is wrong and will give an error every time.

PHP Code:

set_pcvar_num(iMessageType0

Also, in GetMessageType(), you should use a switch for iMessageType.

More importantly, using GetMessageType() to populate a global variable every time that you use that global variable is unnecessary and confusing (confusing particularly because of the name). Simply do this:

PHP Code:

MessageTypes:GetMessageType()
{
    new 
MessageTypes:iMessageType MessageTypes:get_pcvar_num(cVars[pCvarMessageType])
    new 
MessageTypes:returnValue
    
    
switch( iMessageType )
    {
        case 
CHATHUDLOG:
        {
            
returnValue iMessageType
        
}
        default:
        {
            
returnValue CHAT
            
// set_pcvar_num(cVars[pCvarMessageType], _:CHAT) // Not entirely necessary
        
}
    }

    return 
returnValue


Now, the name makes more sense and you would use it like this:

PHP Code:

SendMessage(0GetMessageType(), /*...*/

This:

PHP Code:

    register_plugin
    
(
    .
plugin_name PLUGIN,
    .
version VERSION,
    .
author AUTHOR
    


Is formatted unnecessarily and is ugly. Don't use dot notation unless you are going to be skipping several parameters. If you are using all parameters, simply supply all three parameters normally. Also, there is no real advantage to putting such a short command on multiple lines. Use a single line, even with dot notation, it will be shorter than many other lines of your code.

About indentation, the only thing that is ugly is that there are three tabs after an equal sign in an assignment statement. Trying to line things up with multiple tabs is guaranteed to look bad in someone's editor. Most of the time, lining assignment statements up like this is adds no value.

EFFx 01-04-2017 00:22

Re: One-Shot Multikill Detection
 
Sorry about the error, it doesn't give an error for me.

PHP Code:

MessageTypes:GetMessageType() 

    new 
MessageTypes:iMessageType MessageTypes:get_pcvar_num(cVars[pCvarMessageType]) 
    new 
MessageTypes:returnValue 
     
    
switch( iMessageType 
    { 
        case 
CHATHUDLOG
        { 
            
returnValue iMessageType 
        

        default: 
        { 
            
returnValue CHAT 
            
// set_pcvar_num(cVars[pCvarMessageType], _:CHAT) // Not entirely necessary 
        

    } 

    return 
returnValue 


Hm, I was searching how can I use that function like this:

PHP Code:

new szMessageTypeName[32]
GetMessageType(szMessageTypeName,charsmax(szMessageTypeName)) 

But I don't know how do that.

This,

PHP Code:

SendMessage(0GetMessageType(), /*...*/

That give an error.

Look what I made:

PHP Code:

MessageTypes:GetMessageType(MessageTypes:returnValue

    new 
MessageTypes:iMessageType MessageTypes:get_pcvar_num(cVars[pCvarMessageType]) 
     
    switch(
iMessageType
    { 
        case 
CHATHUDLOG
        { 
            
returnValue iMessageType 
        

        default: 
        { 
            
returnValue CHAT 
        

    } 
    return 
returnValue 


PHP Code:

SendMessage(0,GetMessageType(MessageType),"^4%s^1's grenade killed^4 %d^1 players!",szName,iKills

The MessageTypes:MessageType is a global.

PHP Code:

SendMessage(const indexMessageTypes:MsgType,const message[],any:...) 


HamletEagle 01-04-2017 03:29

Re: One-Shot Multikill Detection
 
Quote:

Is formatted unnecessarily and is ugly. Don't use dot notation unless you are going to be skipping several parameters. If you are using all parameters, simply supply all three parameters normally. Also, there is no real advantage to putting such a short command on multiple lines. Use a single line, even with dot notation, it will be shorter than many other lines of your code.
Saying it's ugly is only a matter of subjectivity and should never be part of a review. Don't try to enforce your own style.
Also, about when one should use the dot or not, here it's just a style.

Quote:

Also, there is no real advantage to putting such a short command on multiple lines. Use a single line, even with dot notation, it will be shorter than many other lines of your code.
No one is doing that for practical advantages. I'm personally using that way of writting the register_plugin line as my signature, for visual purpose only.


All times are GMT -4. The time now is 22:10.

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