Jump to content

need help


Majhol

Recommended Posts

Posted

hi guys I couldn't post a code because I couldn't think of anything

all I need is how to make ak47 for only "police" team I couldn't do it , can anyone help me out?

Posted

Well, you can make a script where when a player tries to change his weapon, if he's not in the Police team and the weapon is the Ak-47, then set it back to the old slot or the next one.

Use the event: onPlayerWeaponSwitch

and the functions:

getPlayerTeam 
getTeamName 
setPedWeaponSlot 

Posted
WeaponID = { 
    [30] = true, 
} 
  
--add an event handler for onPlayerWeaponSwitch 
addEventHandler ( 'onPlayerWeaponSwitch', getRootElement ( ), 
    function ( previousWeaponID, currentWeaponID ) 
     
        if ( WeaponID[currentWeaponID] ) then 
            toggleControl ( source, 'fire', false ) --disable the fire button 
        else 
         if ( getPlayerTeam ( hitPlayer ) == getTeamFromName ( "Police" ) ) then 
            toggleControl ( source, 'fire', true ) --enable it 
        end 
    end 
) 
  
  
  

this is what i reached to and I couldn't figure out the setpedweaponslot thingy can u help me?

Posted
WeaponID = 
    { 
        [ 30 ] = true, 
    } 
  
--add an event handler for onPlayerWeaponSwitch 
addEventHandler ( 'onPlayerWeaponSwitch', getRootElement ( ), 
    function ( previousWeaponID, currentWeaponID ) 
        if ( WeaponID [ currentWeaponID ] ) then 
            toggleControl ( source, 'fire', false ) --disable the fire button 
        end 
        if ( getPlayerTeam ( source ) == getTeamFromName ( "Police" ) ) then 
            toggleControl ( source, 'fire', true ) --enable it 
        end 
    end 
) 

Posted
WeaponID = 
    { 
        [ 30 ] = true, 
    } 
  
--add an event handler for onPlayerWeaponSwitch 
addEventHandler ( 'onPlayerWeaponSwitch', getRootElement ( ), 
    function ( previousWeaponID, currentWeaponID ) 
        if ( WeaponID [ currentWeaponID ] ) then 
            toggleControl ( source, 'fire', false ) --disable the fire button 
        else 
            toggleControl ( source, 'fire', true ) --disable the fire button 
        end 
        if ( getPlayerTeam ( source ) == getTeamFromName ( "Police" ) ) then 
            toggleControl ( source, 'fire', true ) --enable it 
        end 
    end 
) 

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...