Raised This Month: $32 Target: $400
 8% 

One-Shot Multikill Detection


Post New Thread Reply   
 
Thread Tools Display Modes
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 01-11-2017 , 18:31   Re: One-Shot Multikill Detection
Reply With Quote #51

Quote:
Originally Posted by EFFx View Post
1. Whats the problem using the format() ?

2. No, I want not return CHAT when the cvar is 6 or something else anymore. I want show hud message. And the reason is because some peoples use hud_saytext. And a hud is better.

And is not possible add case default, FYI.
1. There's no big problem with it, but when it makes no sense to needlessly call a native it should be eliminated.

2. Ok, then you're good as is.

Yes, I know that, I quickly moved the cases around and did that accidentally.
__________________

Last edited by Bugsy; 01-11-2017 at 18:31.
Bugsy is offline
EFFx
Veteran Member
Join Date: Feb 2016
Location: São Paulo, Brasil
Old 01-11-2017 , 18:36   Re: One-Shot Multikill Detection
Reply With Quote #52

And lets go about remove format().

I made a cvar

PHP Code:
enum _:CvarsSettings
{
    
pCvarMessageType
    
pCvarPluginEnabled,
    
pCvarChatPrefix
}
new 
cVars[CvarsSettings
PHP Code:
cVars[pCvarChatPrefix] = register_cvar("osmd_chatprefix","[OneShot MultiKill Detect]"
PHP Code:
SendMessage("^4%s^1 Oh my gawd!^4 %s^1 killed %d with one shot!",szPrefix,KillerName,UserKills[iKiller][iNumKills])
SendMessage("^4%s^1 ^4%s^1's grenade killed^4 %d^1 players!",szPrefix,szName,iKills
PHP Code:
default:
{
            new 
szPrefix[30]
            
get_pcvar_string(cVars[pCvarChatPrefix],szPrefix,charsmax(szPrefix))
            
            
replace_all(szMsg,charsmax(szMsg),szPrefix,"")

Before I use SendMessage(), Should I always use

PHP Code:
            new szPrefix[30]
            
get_pcvar_string(cVars[pCvarChatPrefix],szPrefix,charsmax(szPrefix)) 
? Can I make the szPrefix a global and use get_pcvar_string always before SendMessage() and before replace_all()?
__________________
• Ranking System • AutoMix 5vs5 System
• Web Ban System • Plugins for free

____________________________________________
For private works:
• Discord: EFFEXo#8850 • Steam: EFFEXo

Last edited by EFFx; 01-11-2017 at 18:37.
EFFx is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 01-11-2017 , 18:44   Re: One-Shot Multikill Detection
Reply With Quote #53

Just put it before you call SendMessage() in your 2 functions. It will then hit the replace_all() functions in SendMessage(). If you want to store it globally you can.. if your objective is to not call get_pcvar_string() every time...you can store it in a global var, but the user will not see any changes to the value until you call get_cvar_string() again.
__________________

Last edited by Bugsy; 01-11-2017 at 18:46.
Bugsy is offline
EFFx
Veteran Member
Join Date: Feb 2016
Location: São Paulo, Brasil
Old 01-11-2017 , 18:48   Re: One-Shot Multikill Detection
Reply With Quote #54

Yes, thats what I'm saying

PHP Code:
        new szPrefix[30]
        
get_pcvar_string(cVars[pCvarChatPrefix],szPrefix,charsmax(szPrefix))
        
SendMessage("Oh my gawd!^4 %s^1 killed %d with one shot!",szPrefix,KillerName,UserKills[iKiller][iNumKills]) 

PHP Code:
                new szPrefix[30]
                
get_pcvar_string(cVars[pCvarChatPrefix],szPrefix,charsmax(szPrefix))
                
SendMessage("^4%s^1 ^4%s^1's grenade killed^4 %d^1 players!",szPrefix,szName,iKills
Thats what you're saying, right?

But should I make the same at SendMessage()? Call three times get_pcvar_string()?

PHP Code:
            new szPrefix[30]
            
get_pcvar_string(cVars[pCvarChatPrefix],szPrefix,charsmax(szPrefix))
            
            
replace_all(szMsg,charsmax(szMsg),szPrefix,""
__________________
• Ranking System • AutoMix 5vs5 System
• Web Ban System • Plugins for free

____________________________________________
For private works:
• Discord: EFFEXo#8850 • Steam: EFFEXo

Last edited by EFFx; 01-11-2017 at 18:48.
EFFx is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 01-11-2017 , 18:51   Re: One-Shot Multikill Detection
Reply With Quote #55

No, the prefix will be in the string already when it reaches SendMessage(). Unless I'm misunderstanding you.
PHP Code:
SendMessage(const message[],any:...) 
{
    static 
szMsg[191]
    
vformat(szMsg,charsmax(szMsg),message,2)

    
//Prefix is in szMsg, it will now go through these 3 replace_all()'s
    
replace_all(szMsgcharsmax(szMsg),"!g","^4")
    
replace_all(szMsgcharsmax(szMsg),"!y","^1")
    
replace_all(szMsgcharsmax(szMsg),"!t","^3"
__________________
Bugsy is offline
EFFx
Veteran Member
Join Date: Feb 2016
Location: São Paulo, Brasil
Old 01-11-2017 , 18:58   Re: One-Shot Multikill Detection
Reply With Quote #56

No, the SendMessage() still showing the prefix.
I mean, how can I remove the prefix on Hud message?

Call again

PHP Code:
new szPrefix[30]
get_pcvar_string(cVars[pCvarChatPrefix],szPrefix,charsmax(szPrefix)) 
And use

PHP Code:
replace_all(szMsg,charsmax(szMsg),szPrefix,""
?

I'm talking about methods, I know it works.
__________________
• Ranking System • AutoMix 5vs5 System
• Web Ban System • Plugins for free

____________________________________________
For private works:
• Discord: EFFEXo#8850 • Steam: EFFEXo

Last edited by EFFx; 01-11-2017 at 19:07.
EFFx is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 01-11-2017 , 19:24   Re: One-Shot Multikill Detection
Reply With Quote #57

Quote:
Originally Posted by EFFx View Post
No, the SendMessage() still showing the prefix.
I mean, how can I remove the prefix on Hud message?
Ah, I see.

You can pull this off.

1. Add a 'prefix end pos' param to SendMessage().
2. When showing the HUD, start the message at prefix end pos.

PHP Code:
//Sending a msg. This puts the length of the prefix in the first param of SendMessage().
SendMessage("%s ^4%s^1's grenade killed^4 %d^1 players!",get_pcvar_string(cVars[pCvarChatPrefix],szPrefix,charsmax(szPrefix)),Prefix,szName,iKills)

//Add prefix-endpos param and move vformat() param start value to a 3.
SendMessage(const message[],iPrefixEndPos,any:...) 
{
    static 
szMsg[191]
    
vformat(szMsg,charsmax(szMsg),message,3)

...

//Do this when showing HUD.
ShowSyncHudMsg(0,gSync,szMsg[iPrefixEndPos]) 
__________________

Last edited by Bugsy; 01-11-2017 at 19:35.
Bugsy is offline
EFFx
Veteran Member
Join Date: Feb 2016
Location: São Paulo, Brasil
Old 01-11-2017 , 19:37   Re: One-Shot Multikill Detection
Reply With Quote #58

PHP Code:
vformat(szMsg,charsmax(szMsg),message,3
LMAO, not anymore xD

Just on DeathMsg, when I kill more than 2 with a grenade the hud works, but on DeathMsg, a debug appear
PHP Code:

L 01
/11/2017 22:35:55String formatted incorrectly parameter 5 (total 4)
L 01/11/2017 22:35:55: [AMXXDisplaying debug trace (plugin "OneShotMD.amxx")
L 01/11/2017 22:35:55: [AMXXRun time error 25parameter error 
L 01
/11/2017 22:35:55: [AMXX]    [0OneShotMD.sma::SendMessage (line 196)
L 01/11/2017 22:35:55: [AMXX]    [1OneShotMD.sma::CheckKills (line 131
PHP Code:
SendMessage("^4%s^1 Oh my gawd!^4 %s^1 killed %d with one shot!",get_pcvar_string(cVars[pCvarChatPrefix],szPrefix,charsmax(szPrefix)),KillerName,UserKills[iKiller][iNumKills]) 
Edit, solution

PHP Code:
SendMessage("^4%s^1 Oh my gawd!^4 %s^1 killed %d with one shot!",get_pcvar_string(cVars[pCvarChatPrefix],szPrefix,charsmax(szPrefix)),szPrefix,KillerName,UserKills[iKiller][iNumKills]) 
__________________
• Ranking System • AutoMix 5vs5 System
• Web Ban System • Plugins for free

____________________________________________
For private works:
• Discord: EFFEXo#8850 • Steam: EFFEXo

Last edited by EFFx; 01-11-2017 at 19:40.
EFFx is offline
EFFx
Veteran Member
Join Date: Feb 2016
Location: São Paulo, Brasil
Old 01-11-2017 , 19:47   Re: One-Shot Multikill Detection
Reply With Quote #59

No problems with the code and with the plugin yet. Plugin updated.
__________________
• Ranking System • AutoMix 5vs5 System
• Web Ban System • Plugins for free

____________________________________________
For private works:
• Discord: EFFEXo#8850 • Steam: EFFEXo
EFFx is offline
EFFx
Veteran Member
Join Date: Feb 2016
Location: São Paulo, Brasil
Old 01-11-2017 , 21:30   Re: One-Shot Multikill Detection
Reply With Quote #60

Hey,

I've added translations on this plugin, as you guys know, we cannot use ^ on LANG files. And if we try to use !g, !t or !y on this plugin, the message my, gawd, grenade, players will lose their letters. Those words will show

m, awd, renade, plaers.

And we cannot change the colors icons like !g to !m, !y to !n or !t to !p because have a chance that players with nickname with those icons will lose those letters as well.
Like

I love my mom

Will be 'I love m mom'.

So, the unique way I found is adding

[teamcolor], [greencolor], [chatcolor]

Those icons works like space on ML files. Example

[greencolor]EFFx[chatcolor]Killed[greencolor]HeadShoter[chatcolor].

The message will show

EFFx killed HeadShoter

But if you want add more than 1 word without any color, you can use space normally.

Like

EFFx Killed HeadShoter

Hope you guys understand. So, ML added and an observation has been added to the description.
__________________
• Ranking System • AutoMix 5vs5 System
• Web Ban System • Plugins for free

____________________________________________
For private works:
• Discord: EFFEXo#8850 • Steam: EFFEXo

Last edited by EFFx; 01-12-2017 at 03:24.
EFFx is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 01:18.


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