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

No-Scope and Quick-Scope distance


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Hardix
Junior Member
Join Date: Nov 2020
Old 11-25-2020 , 08:00   No-Scope and Quick-Scope distance
Reply With Quote #1

Hello,

I want a code when I kill with No-Scope or Quick-Scope a player I want to show in chat from what distance I killed him, thanks.
Hardix is offline
EFFx
Veteran Member
Join Date: Feb 2016
Location: São Paulo, Brasil
Old 11-26-2020 , 19:09   Re: No-Scope and Quick-Scope distance
Reply With Quote #2

You can use this:

PHP Code:
#include <amxmodx>
#include <cstrike>
#include <fakemeta>

#define MAX_PLAYERS 32

enum _:CvarsSettings
{
    
PluginEnabled,
    
DisplayMessageType,
    
PluginPrefix
}

const 
Float:g_iMeterCalc 32.0
new pCvars[CvarsSettings]

new 
szPluginPrefix[25]

enum _:PlayerScopeData
{
    
Float:ScopeTime,
    
ScopeType
}

new 
ScopeData[MAX_PLAYERS+1][PlayerScopeData]

new 
gMsgSync
new MsgSayText

new PluginForwardQuickPluginForwardNoScopeg_iReturn

public plugin_init() 
{
    new const 
PluginVersion[] = "1.2"
    
register_plugin("Quick and No Scope Detector"PluginVersion"EFFx")
    
    
gMsgSync CreateHudSyncObj()
    
    
pCvars[PluginEnabled] = register_cvar("qsd_enabled","1")
    
pCvars[DisplayMessageType] = register_cvar("qsd_messagetype","c")
    
pCvars[PluginPrefix] = register_cvar("qsd_chatprefix","[Quick&NoScopeDetector]")

    
PluginForwardQuick CreateMultiForward("client_NoScoped"ET_STOPFP_CELLFP_CELLFP_CELL)
    
PluginForwardNoScope CreateMultiForward("client_QuickScoped"ET_STOPFP_CELLFP_CELLFP_CELL)
    
    if(!
PluginForwardQuick)
    {
        
log_amx("client_NoScoped forward is not used by any other plugin.")
    }
    
    if(!
PluginForwardNoScope)
    {
        
log_amx("client_QuickScoped forward is not used by any other plugin.")
    }
    
    
register_event("DeathMsg","checkQuickScopeKill","a","1>0""4=scout","4=sg550""4=awp""4=g3sg1")
    
register_event("CurWeapon","fw_EvCurWeapon","b","1=1","2=3","2=13""2=18""2=24")
    
register_event("SetFOV","Zoom","b","1<90")
    
    
MsgSayText get_user_msgid("SayText")
}

public 
plugin_natives()
{
    
register_library("quicknoscoped")
}

public 
plugin_end()
{
    
DestroyForward(PluginForwardQuick)
    
DestroyForward(PluginForwardNoScope)
}

public 
Zoom(id)
{
    if(
is_user_alive(id))
    {
        
ScopeData[id][ScopeTime] = _:get_gametime()
    }
}
public 
fw_EvCurWeapon(id)
{
    if(
is_user_alive(id))
    {
        
ScopeData[id][ScopeType] = cs_get_user_zoom(id)
    }
}
public 
checkQuickScopeKill()
{
    if(!
get_pcvar_num(pCvars[PluginEnabled]))
        return
    
    new 
KillerName[32],VictimName[32],WeaponName[17]
    
    new 
iKiller read_data(1)
    new 
iVictim read_data(2)
    
    new 
Float:GameTime get_gametime()
    
    new 
bool:bNoScope bool:(ScopeData[iKiller][ScopeType] == CS_SET_NO_ZOOM)
    new 
bool:bQuickScope bool:(GameTime ScopeData[iKiller][ScopeTime] <= 0.20)
    
    if(
bNoScope || bQuickScope)
    {
        
get_user_name(iKiller,KillerName,charsmax(KillerName))
        
get_user_name(iVictim,VictimName,charsmax(VictimName))

        
bNoScope ExecuteForward(PluginForwardNoScopeg_iReturniKilleriVictimget_user_weapon(iKiller)) : ExecuteForward(PluginForwardQuickg_iReturniKilleriVictimget_user_weapon(iKiller))
        
        
read_data(4WeaponName,charsmax(WeaponName))

        new 
iOrigin1[3], iOrigin2[3]
        
get_user_origin(iKilleriOrigin1)
        
get_user_origin(iVictimiOrigin2)

        
QSD_ChatMessage 
        

            
"^4%s^1 Holy shit!^4 %s^1 %s^3 %s^1 with his^4 %s (%d m)"
            
get_pcvar_string(pCvars[PluginPrefix],szPluginPrefix,charsmax(szPluginPrefix)), 
            
szPluginPrefix
            
KillerName
            
bNoScope "just NO SCOPED" "made a^4 QUICK SCOPE^1 on" 
            
VictimName
            
WeaponName,
            
floatround(get_distance(iOrigin1iOrigin2) / g_iMeterCalc)
        )
    }
}
QSD_ChatMessage(const message[],withPrefixRemoved,any:...) 
{
    static 
szMsg[191]
    
vformat(szMsg,charsmax(szMsg),message,3)

    
replace_all(szMsgcharsmax(szMsg),"!g","^4")
    
replace_all(szMsgcharsmax(szMsg),"!y","^1")
    
replace_all(szMsgcharsmax(szMsg),"!t","^3")
    
    new const 
replaceIcons[] = {"^4","^3","^1"}
    
    new 
szMessageType[45]
    
get_pcvar_string(pCvars[DisplayMessageType],szMessageType,charsmax(szMessageType))
    
    switch(
szMessageType[0])
    {
        case 
'H','h':
        {
            for(new 
i;sizeof replaceIcons;i++)
            {
                
replace_all(szMsg,charsmax(szMsg),replaceIcons[i],"")
            }
            
set_hudmessage(0,255,0,-1.0,0.25,1,1.0,5.0)
            
ShowSyncHudMsg(0,gMsgSync,szMsg[withPrefixRemoved])
        }
        case 
'L','l':
        {
            for(new 
i;sizeof replaceIcons;i++)
            {
                
replace_all(szMsg,charsmax(szMsg),replaceIcons[i],"")
            }
            
log_amx(szMsg[withPrefixRemoved])
        }
        default:
        {
            new 
Players[32],iPlayersNum,PlayerID
            get_players
(Players,iPlayersNum,"ch")
                
            for(new 
i;iPlayersNum;i++)
            {
                
PlayerID Players[i]
                
message_begin(MSG_ONE_UNRELIABLE,MsgSayText, .player PlayerID)  
                
write_byte(PlayerID)
                
write_string(szMsg)
                
message_end()
            }
        }
    }

__________________
• Ranking System • AutoMix 5vs5 System
• Web Ban System • Plugins for free

____________________________________________
For private works:
• Discord: EFFEXo#8850 • Steam: EFFEXo
EFFx is offline
Reply


Thread Tools
Display Modes

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 21:33.


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