Raised This Month: $51 Target: $400
 12% 

Plugin kill info [edit] help


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
FreezerPT
Senior Member
Join Date: Mar 2017
Location: 127.0.0.1
Old 09-25-2017 , 10:39   Plugin kill info [edit] help
Reply With Quote #1

Hello, I have this plugin that when the player dies it says "who killed it" and "how much life was" and I tried to add a line that is get_user_weapon and I thought it also indicated the weapon with which it was killed, but it did not work I would like to know if anyone can by this plugin do what they already did but also indicate the weapon with which the victim was killed! Like this "You have been killed by User with M4a1-s and still with 43 HP"

PHP Code:
#include <amxmodx>
#include <cromchat>

public plugin_init()
{
    
register_plugin("Kill Info""1.0""OciXCrom")
    
register_event("DeathMsg""OnPlayerKilled""a")
    
CC_SetPrefix("&x04[&x03WIZARD&x01-&x03CM&x04]")
}

public 
OnPlayerKilled()
{
    new 
iAttacker read_data(1),
        
iVictim read_data(2)
        
    if(!
is_user_connected(iAttacker) || !is_user_connected(iVictim) || iAttacker == iVictim)
        return
        
    new 
szName[32]
    
get_user_name(iAttackerszNamecharsmax(szName))
    
CC_SendMessage(iVictim" &x01- You have been killed by &x03%s &x01with &x04%i &x01and he still with &x03%i &x04HP"szNameget_user_weapon(iAttacker), get_user_health (iAttacker))


Last edited by FreezerPT; 09-25-2017 at 10:40.
FreezerPT is offline
EFFx
Veteran Member
Join Date: Feb 2016
Location: Sγo Paulo, Brasil
Old 09-25-2017 , 10:59   Re: Plugin kill info [edit] help
Reply With Quote #2

get_user_weapon() returns the weapon's ID. With DeathMsg, you must use link this:

PHP Code:
new szWeaponName[17]
read_data(4szWeaponNamecharsmax(szWeaponName)) 
and use like this for show the name:

PHP Code:
client_print(iVictimprint_chat"Weapon: %s"szWeaponName
But, it'll return with weapon_ prefix, if you wont it, use replace() to remove:

PHP Code:
replace(szWeaponNamecharsmax(szWeaponName), "weapon_"""
If you want to convert all chars in string to upper case, use strtoupper():

PHP Code:
strtoupper(szWeaponName
So, the final code gotta be:

PHP Code:
#include <amxmodx>
#include <cromchat>

public plugin_init()
{
    
register_plugin("Kill Info""1.0""OciXCrom")
    
register_event("DeathMsg""OnPlayerKilled""a")
    
    
CC_SetPrefix("&x04[&x03WIZARD&x01-&x03CM&x04]")
}

public 
OnPlayerKilled()
{
    new 
iAttacker read_data(1),
    
iVictim read_data(2)
    
    if(!
is_user_connected(iAttacker) || !is_user_connected(iVictim) || iAttacker == iVictim)
        return
    
    new 
szWeaponName[17]
    
read_data(4szWeaponNamecharsmax(szWeaponName))

    
replace(szWeaponNamecharsmax(szWeaponName), "weapon_""")
    
strtoupper(szWeaponName)
    
    new 
szNameAttacker[32], szNameVictim[32]
    
get_user_name(iAttackerszNameAttackercharsmax(szNameAttacker))
    
get_user_name(iVictimszNameVictimcharsmax(szNameVictim))
    
CC_SendMessage(iVictim" &x01- You have been killed by &x03%s &x01with &x04%s &x01and he still with &x03%i &x04HP"szNameAttackerszNameVictimszWeaponNameget_user_health (iAttacker))

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

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

Last edited by EFFx; 09-25-2017 at 11:38.
EFFx is offline
FreezerPT
Senior Member
Join Date: Mar 2017
Location: 127.0.0.1
Old 09-25-2017 , 11:58   Re: Plugin kill info [edit] help
Reply With Quote #3

[QUOTE=EFFx;2550771]

So now if i convert to amxx when player die this says Who kills/weapon/life or i need to do somethin to weapon appears!?
FreezerPT is offline
EFFx
Veteran Member
Join Date: Feb 2016
Location: Sγo Paulo, Brasil
Old 09-25-2017 , 12:05   Re: Plugin kill info [edit] help
Reply With Quote #4

You just need to compile it.
__________________
• Ranking System • AutoMix 5vs5 System
• Web Ban System • Plugins for free

____________________________________________
For private works:
• Discord: EFFEXo#8850 • Steam: EFFEXo
EFFx is offline
FreezerPT
Senior Member
Join Date: Mar 2017
Location: 127.0.0.1
Old 09-25-2017 , 12:13   Re: Plugin kill info [edit] help
Reply With Quote #5

[QUOTE=EFFx;2550787]

Just one more thing!

Can you tell me where the plugin go browse the name of wepons like when i kill appears GLOCK 18, but if i like to change the name how can i do like GLOCK-18
FreezerPT is offline
TheSpaniard
Senior Member
Join Date: Jul 2017
Location: Hell
Old 09-25-2017 , 12:32   Re: Plugin kill info [edit] help
Reply With Quote #6

Quote:
Originally Posted by FreezerPT View Post

Just one more thing!

Can you tell me where the plugin go browse the name of wepons like when i kill appears GLOCK 18, but if i like to change the name how can i do like GLOCK-18
Should be where the names of the guns are declared or written just search for it in the code. you should post the whole code so someone could point it out for you.
__________________
And I Am Back.

Last edited by TheSpaniard; 09-25-2017 at 12:32.
TheSpaniard is offline
FreezerPT
Senior Member
Join Date: Mar 2017
Location: 127.0.0.1
Old 09-25-2017 , 12:46   Re: Plugin kill info [edit] help
Reply With Quote #7

Quote:
Originally Posted by TheSpaniard View Post
Should be where the names of the guns are declared or written just search for it in the code. you should post the whole code so someone could point it out for you.
Nope bro the name aren΄t in plugin
FreezerPT is offline
FreezerPT
Senior Member
Join Date: Mar 2017
Location: 127.0.0.1
Old 09-25-2017 , 12:47   Re: Plugin kill info [edit] help
Reply With Quote #8

Quote:
Originally Posted by TheSpaniard View Post
Should be where the names of the guns are declared or written just search for it in the code. you should post the whole code so someone could point it out for you.
PHP Code:
#include <amxmodx>
#include <cromchat>

public plugin_init()
{
    
register_plugin("Kill Info""1.0""OciXCrom")
    
register_event("DeathMsg""OnPlayerKilled""a")
    
    
CC_SetPrefix("&x04[&x03WIZARD&x01-&x03CM&x04]")
}

public 
OnPlayerKilled()
{
    new 
iAttacker read_data(1),
    
iVictim read_data(2)
    
    if(!
is_user_connected(iAttacker) || !is_user_connected(iVictim) || iAttacker == iVictim)
        return
    
    new 
szWeaponName[17]
    
read_data(4szWeaponNamecharsmax(szWeaponName))

    
replace(szWeaponNamecharsmax(szWeaponName), "weapon_""")
    
strtoupper(szWeaponName)
    
    new 
szNameAttacker[32], szNameVictim[32]
    
get_user_name(iAttackerszNameAttackercharsmax(szNameAttacker))
    
get_user_name(iVictimszNameVictimcharsmax(szNameVictim))
    
CC_SendMessage(iVictim" &x01- O Jogador &x03%s &x01matou-te com &x04%s &x01e ele ainda tem &x03%i &x04HP"szNameAttackerszWeaponNameget_user_health (iAttacker))

FreezerPT is offline
Relaxing
AlliedModders Donor
Join Date: Jun 2016
Location: White Plains
Old 09-25-2017 , 12:49   Re: Plugin kill info [edit] help
Reply With Quote #9

if(equal(szWeaponName, "glock" //after replace native) { // print a custom message and return H@NDLE }
__________________
Relaxing is offline
EFFx
Veteran Member
Join Date: Feb 2016
Location: Sγo Paulo, Brasil
Old 09-25-2017 , 13:08   Re: Plugin kill info [edit] help
Reply With Quote #10

With this:

PHP Code:
if(containi(szWeaponName"glock") != -1)
{
    
copy(szWeaponNamecharsmax(szWeaponName), "glock-18")

->

PHP Code:
#include <amxmodx> 
#include <cromchat> 

public plugin_init() 

    
register_plugin("Kill Info""1.0""OciXCrom"
    
register_event("DeathMsg""OnPlayerKilled""a"
    
    
CC_SetPrefix("&x04[&x03WIZARD&x01-&x03CM&x04]"


public 
OnPlayerKilled() 

    new 
iAttacker read_data(1), 
    
iVictim read_data(2
    
    if(!
is_user_connected(iAttacker) || !is_user_connected(iVictim) || iAttacker == iVictim
        return 
    
    new 
szWeaponName[17
    
read_data(4szWeaponNamecharsmax(szWeaponName)) 
    
    
replace(szWeaponNamecharsmax(szWeaponName), "weapon_"""

    if(
containi(szWeaponName"glock") != -1)
    {
        
copy(szWeaponNamecharsmax(szWeaponName), "glock-18")
    }
    
    
strtoupper(szWeaponName)
    
    new 
szNameAttacker[32], szNameVictim[32
    
get_user_name(iAttackerszNameAttackercharsmax(szNameAttacker)) 
    
get_user_name(iVictimszNameVictimcharsmax(szNameVictim)) 
    
CC_SendMessage(iVictim" &x01- O Jogador &x03%s &x01matou-te com &x04%s &x01e ele ainda tem &x03%i &x04HP"szNameAttackerszWeaponNameget_user_health (iAttacker)) 

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

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

Last edited by EFFx; 09-25-2017 at 13:10.
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 03:21.


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