Jump to content

LUA Help.


Khalil

Recommended Posts

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

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

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...