AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   [SOLVED] Needed better Idea for getting attacker weapon (https://forums.alliedmods.net/showthread.php?t=232605)

xxxperts 01-02-2014 07:06

[SOLVED] Needed better Idea for getting attacker weapon
 
hii all, i need some good suggestions & better way or new idea.... as i m wanted to give points as per specific weapon kills...

sooo is there any new idea to detect weapons....soo plugin can use low cpu usage...

if simple lang i dont want to use if that attacker has this or that weapon..


PHP Code:

public Event_Dead()
{
    new 
iKiller read_data(1);
    new 
iVictim read_data(2);
    new 
iHskill read_data(3);
    new 
weaponHitPoint get_user_attacker(iVictimweaponHitPoint);
    
    if(
weapon == CSW_KNIFE)
    {
        
// my points
    
}
    
    if(
weapon == CSW_M4A1)
    {
        if(
iHskill)
        {
            
// my points
        
}
        else
        {
            
// my points
        
}
    }
    
    if(
weapon == CSW_AK47)
    {
        if(
iHskill)
        {
            
// my points
        
}
        else
        {
            
// my points
        
}
    }
    
    if(
weapon == CSW_AWP)
    {
        if(
iHskill)
        {
            
// my points
        
}
        else
        {
            
// my points
        
}
    }
    
    if(
weapon == CSW_SCOUT)
    {
        if(
iHskill)
        {
            
// my points
        
}
        else
        {
            
// my points
        
}
    }
    
    if(
weapon == CSW_DEAGLE)
    {
        if(
iHskill)
        {
            
// my points
        
}
        else
        {
            
// my points
        
}
    }



DavidJr 01-02-2014 07:43

Re: Needed better Idea for getting attacker weapon
 
You can check the victim was killed by weapon of the attacker like this:

PHP Code:

new iWeapon[32]
read_data(4iWeaponsizeof iWeapon)

client_print(iKillerprint_chat"%s"iWeapon


xxxperts 01-02-2014 07:57

Re: Needed better Idea for getting attacker weapon
 
bro i wanted to give points on that weapon then how...???

DavidJr 01-02-2014 09:19

Re: Needed better Idea for getting attacker weapon
 
What do you mean points for weapon?

xxxperts 01-02-2014 11:49

Re: Needed better Idea for getting attacker weapon
 
i am creating xp / points system plugin ... i want to give points on specific weapons i had used that above give my code but i need better one..

BlueGaming 01-03-2014 05:47

Re: Needed better Idea for getting attacker weapon
 
Show here code :D

xxxperts 01-03-2014 05:57

Re: Needed better Idea for getting attacker weapon
 
code is show above ....

hornet 01-03-2014 18:45

Re: Needed better Idea for getting attacker weapon
 
Store your preset points for kills in an array ( corresponding with the CSW constants ), then retrieve the used weapon's name with read_data( 4 ), formatting it and converting it back to it's CSW constant, and then get the points value from the array.

xxxperts 01-04-2014 00:44

Re: Needed better Idea for getting attacker weapon
 
i didn't got this can show one example...plz

ConnorMcLeod 01-04-2014 07:00

Re: Needed better Idea for getting attacker weapon
 
long way without csx


easy way with csx module (RECOMMANDED)


All times are GMT -4. The time now is 10:07.

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