Raised This Month: $ Target: $400
 0% 

get_user_weapons


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
striker07
Veteran Member
Join Date: Mar 2012
Location: Solar System/Earth/Belgi
Old 04-15-2012 , 18:28   Re: get_user_weapons
Reply With Quote #5

Quote:
Originally Posted by claudiuhks View Post
If a player has a weapon in his inventory, then what exactly do you want to do?
the moment a player dies and the victim had more then one weapon (knife + any other PRIMARY weapon) then i want to ignore the rest of the following code.

Spoiler

EDIT:
To explain it a lil better:

I need to use this function in the event: DeathMsg, its for an anti freekill system i'm working on.
To check if a victim has a primary weapon, so if the victim only had a knife AND he was not a rebel then i want to ignore the rest of the code in event: DeathMsg.

or in other words:

If the victim was not a rebel but had a primary weapon when he died (even if he wasnt holding that primary weapon) then i want to ignore the rest of the code.

This is how im using it now:
PHP Code:
public Event_DeathMsg() 

    new 
iKiller read_data(1); 
    new 
iVictim read_data(2);
    
    new 
freekill_slay get_pcvar_num(jb_slay_4freekills)
    new 
max_freekills get_pcvar_num(jb_max_freekills);
    new 
szVName[32], szKName[32]; 
    
get_user_name(iVictimszVNamecharsmax(szVName)); 
    
get_user_name(iKillerszKNamecharsmax(szKName));

    
clear_bit(g_bIsAliveiVictim);
    
    if( 
cs_get_user_teamiVictim ) == CS_TEAM_T 
    {  
        if( 
IsPlayeriKiller ) && cs_get_user_teamiKiller ) == CS_TEAM_CT 
        { 
            if( 
g_bRebel[iVictim] ) 
            { 
                
fnColorPrint(0"Guard^4 %s ^1killed rebel^4 %s ^1!"szKNameszVName); 
            }
            else if( !
g_bRebel[iVictim] ) //if victim is not a rebel   &&\/
            
{
                new 
Weapons[32];
                new 
numWeaponsiweapon;
                
get_user_weapons(iVictim,WeaponsnumWeapons); 
                for (
i=0i<numWeaponsi++) 
                { 
                    
weapon Weapons[i]; 
                    if(
weapon >= )                      //if he has a primary weapon, then ignore the rest
                        
return PLUGIN_HANDLED;
                } 

                
g_iFreekill[iKiller]++
                
                if(
g_iFreekill[iKiller] == 1)
                {
                    
fnColorPrint(iKiller"^3Warning: ^1Freekilling is not allowed. ");
                    
UTIL_ScreenFade(iKiller,{ 25510061 }, 2.02.085);
                }
                if(
g_iFreekill[iKiller] == 2)
                {
                    
UTIL_ScreenFade(iKiller,{ 25510061 }, 2.52.595);
                }
                if(
g_iFreekill[iKiller] == freekill_slay)
                {
                    
fnColorPrint(iKiller"^3Last warning:^1 Every freekill you make form now will result in instant slay");
                    
UTIL_ScreenFade(iKiller,{ 2550}, 2.52.5175);
                }
                if(
g_iFreekill[iKiller] >= max_freekills)
                {
                    
//client_tutor(0, TutorRed, FriendDied, 6.0, "Freekilling is not allowed,^nType rules to see the rules.");
                    
UTIL_ScreenFade(iKiller,{ 2550}, 2.52.5255);
                    
user_kill(iKiller);
                }
            }
        } 
    }
    return 
PLUGIN_HANDLED;

I hope this explains it a lil better

Last edited by striker07; 04-22-2012 at 08:36.
striker07 is offline
 



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 07:46.


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