AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Event_DeathMsg (https://forums.alliedmods.net/showthread.php?t=294917)

Airkish 03-11-2017 08:51

Event_DeathMsg
 
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.

HamletEagle 03-11-2017 09:15

Re: Event_DeathMsg
 
PHP Code:

read_data(4WeaponNamecharsmax(WeaponName)) 


Airkish 03-11-2017 10:04

Re: Event_DeathMsg
 
Quote:

Originally Posted by HamletEagle (Post 2502672)
PHP Code:

read_data(4WeaponNamecharsmax(WeaponName)) 


Like this?

PHP Code:

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



georgik57 03-11-2017 10:08

Re: Event_DeathMsg
 
Code:
if (equali(WeaponName, "ak47")) { /* Do your stuff */ }

edon1337 03-11-2017 10:08

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

Airkish 03-11-2017 11:54

Re: Event_DeathMsg
 
Could you guys give me a simple example, I can't get it to work.
Thanks.

HamletEagle 03-11-2017 12:07

Re: Event_DeathMsg
 
Show us what you did.

Airkish 03-11-2017 12:11

Re: Event_DeathMsg
 
Quote:

Originally Posted by HamletEagle (Post 2502714)
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



OciXCrom 03-11-2017 12:33

Re: Event_DeathMsg
 
Do you not know the difference between an integer and a string?

Airkish 03-11-2017 12:35

Re: Event_DeathMsg
 
Quote:

Originally Posted by OciXCrom (Post 2502721)
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.


All times are GMT -4. The time now is 17:57.

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