Khalil Posted August 22, 2013 Share Posted August 22, 2013 function playerPing (thePlayer) if getPlayerPing ( thePlayer ) >= 900 then outputChatBox ( "Your ping is above 900, you may not use weapons until your ping is lowered", thePlayer, 255, 0, 0 ) end end function wepSwitch (thePlayer) setPlayerWeaponSlot ( thePlayer, 0 ) end addEventHandler ( "onPlayerWeaponSwitch", root, wepSwitch ) Link to comment
Castillo Posted August 22, 2013 Share Posted August 22, 2013 Well, firstly, "onPlayerWeaponSwitch" uses "source", the two arguments are the previous and the current weapon, second, you made two functions, one which is not connected to the other in any way, so it's not going to work. function playerPing ( ) if ( getPlayerPing ( source ) >= 900 ) then outputChatBox ( "Your ping is above 900, you may not use weapons until your ping is lowered", source, 255, 0, 0 ) setPedWeaponSlot ( source, 0 ) end end addEventHandler ( "onPlayerWeaponSwitch", root, playerPing ) Link to comment
Khalil Posted August 22, 2013 Author Share Posted August 22, 2013 But, will that player be able to switch weapons? Link to comment
Castillo Posted August 22, 2013 Share Posted August 22, 2013 With my code it'll always switch back to fist ( 0 ) if the ping is 900 or higher. 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