Majhol Posted August 1, 2013 Share Posted August 1, 2013 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? Link to comment
Castillo Posted August 1, 2013 Share Posted August 1, 2013 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 Link to comment
Majhol Posted August 1, 2013 Author Share Posted August 1, 2013 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? Link to comment
Castillo Posted August 1, 2013 Share Posted August 1, 2013 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 ) Link to comment
Majhol Posted August 1, 2013 Author Share Posted August 1, 2013 I found a big bug , now if you are not in the police teams all all weapons doesn't shot Link to comment
Castillo Posted August 1, 2013 Share Posted August 1, 2013 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 ) Link to comment
Majhol Posted August 1, 2013 Author Share Posted August 1, 2013 working well , thanks muuuch! Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now