Raised This Month: $ Target: $400
 0% 

Event_DeathMsg


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Airkish
AlliedModders Donor
Join Date: Apr 2016
Location: Lithuania
Old 03-11-2017 , 08:51   Event_DeathMsg
Reply With Quote #1

How to check in Event_DeathMsg which weapon was used by killer when he slain enemy?

For example: I wanna check if kill was done with AK-47 and give stuff.
__________________
Airkish is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 03-11-2017 , 09:15   Re: Event_DeathMsg
Reply With Quote #2

PHP Code:
read_data(4WeaponNamecharsmax(WeaponName)) 
__________________

Last edited by HamletEagle; 03-11-2017 at 09:16.
HamletEagle is offline
Airkish
AlliedModders Donor
Join Date: Apr 2016
Location: Lithuania
Old 03-11-2017 , 10:04   Re: Event_DeathMsg
Reply With Quote #3

Quote:
Originally Posted by HamletEagle View Post
PHP Code:
read_data(4WeaponNamecharsmax(WeaponName)) 
Like this?

PHP Code:
new weapon read_data(4WeaponNamecharsmax(WeaponName));
if(
weapon == CSW_AK47) {
do.....

__________________
Airkish is offline
georgik57
Veteran Member
Join Date: Oct 2008
Location: 🎧Music World
Old 03-11-2017 , 10:08   Re: Event_DeathMsg
Reply With Quote #4

Code:
if (equali(WeaponName, "ak47")) { /* Do your stuff */ }
__________________
georgik57 is offline
Send a message via MSN to georgik57 Send a message via Yahoo to georgik57 Send a message via Skype™ to georgik57
edon1337
Penguin Enthusiast
Join Date: Jun 2016
Location: Macedonia
Old 03-11-2017 , 10:08   Re: Event_DeathMsg
Reply With Quote #5

Code:
register_event("DeathMsg", "Event_DeathMsg_Ak47", "a", "4=ak47");
__________________

Last edited by edon1337; 03-11-2017 at 10:10.
edon1337 is offline
Airkish
AlliedModders Donor
Join Date: Apr 2016
Location: Lithuania
Old 03-11-2017 , 11:54   Re: Event_DeathMsg
Reply With Quote #6

Could you guys give me a simple example, I can't get it to work.
Thanks.
__________________
Airkish is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 03-11-2017 , 12:07   Re: Event_DeathMsg
Reply With Quote #7

Show us what you did.
__________________
HamletEagle is offline
Airkish
AlliedModders Donor
Join Date: Apr 2016
Location: Lithuania
Old 03-11-2017 , 12:11   Re: Event_DeathMsg
Reply With Quote #8

Quote:
Originally Posted by HamletEagle View Post
Show us what you did.
here

PHP Code:
public Event_DeathMsg()
{
    new 
iKiller read_data(1)
    new 
iVictim read_data(2)
    new 
iWeapon read_data(4ak47charsmax(ak47)) 

    new 
szName[33]; 
    
get_user_name(iKillerszNamecharsmax(szName))
    
    if(
is_user_alive(iKiller) && get_user_team(iKiller) != get_user_team(iVictim))
    {
        
Achievement[iKiller][EXECUTION]++
        
        if(
Achievement[iKiller][EXECUTION] == AchRequirement[EXECUTION])
        {
            
ColorChat(0RED"%s ^4%s ^1Sėkmingai atrakino ^4%s ^1pasiekimą ir gavo^3 500 ^1taškų!"prefixszNameAchName[EXECUTION])
            
set_user_points(iKillerget_user_points(iKiller) + 500);
        }
        
        if(
is_user_alive(iKiller) && get_user_team(iKiller) != get_user_team(iVictim))
        {
            
Achievement[iKiller][MURDER]++
        
            if(
Achievement[iKiller][MURDER] == AchRequirement[MURDER])
            {
                
ColorChat(0RED"%s ^4%s ^1Sėkmingai atrakino ^4%s ^1pasiekimą ir gavo^3 1000 ^1taškų!"prefixszNameAchName[MURDER])
                
set_user_points(iKillerget_user_points(iKiller) + 1000);
            }
        
        }
        
        if(
get_user_health(iKiller) == 1)
        {
            
Achievement[iKiller][ONEHPHERO]++
            
            if(
Achievement[iKiller][ONEHPHERO] == AchRequirement[ONEHPHERO])
            {
                
ColorChat(0RED"%s ^4%s ^1Sėkmingai atrakino ^4%s ^1pasiekimą ir gavo^3 2000 ^1taškų!"prefixszNameAchName[ONEHPHERO])
                
set_user_points(iKillerget_user_points(iKiller) + 2000);
            }
        }
        if(
read_data(3))
        {    
            
Achievement[iKiller][AIMKEY]++
            
            if(
Achievement[iKiller][AIMKEY] == AchRequirement[AIMKEY])
            {
                
ColorChat(0RED"%s ^4%s ^1Sėkmingai atrakino ^4%s ^1pasiekimą ir gavo^3 1000 ^1taškų!"prefixszNameAchName[AIMKEY])
                
set_user_points(iKillerget_user_points(iKiller) + 1000);

            }
            if( ++
Achievement[iKiller][HATTRICK] == AchRequirement[HATTRICK] ) {
                
ColorChat(0RED"%s ^4%s ^1Sėkmingai atrakino ^4%s ^1pasiekimą ir gavo^3 700 ^1taškų!"prefixszNameAchName[HATTRICK])
                
set_user_points(iKillerget_user_points(iKiller) + 700);
            }
        }
        else {
            
Achievement[iKiller][HATTRICK] = 0;
        }
        
//GUN PASIEKIMAI
        
if(iWeapon "weapon_ak47") {
            
Achievement[iKiller][AK_DILETANTAS]++
        }
    }
    return 
PLUGIN_CONTINUE

__________________
Airkish is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 03-11-2017 , 12:33   Re: Event_DeathMsg
Reply With Quote #9

Do you not know the difference between an integer and a string?
__________________
OciXCrom is offline
Send a message via Skype™ to OciXCrom
Airkish
AlliedModders Donor
Join Date: Apr 2016
Location: Lithuania
Old 03-11-2017 , 12:35   Re: Event_DeathMsg
Reply With Quote #10

Quote:
Originally Posted by OciXCrom View Post
Do you not know the difference between an integer and a string?
Integer is a number (1, 2, 3 etc.)
String is a text

Thanks for you help, kappa.
__________________
Airkish 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 17:57.


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