justn Posted March 24, 2014 Share Posted March 24, 2014 So, how do i make if the player is not doing anything (Shooting) for about 5 minutes, then the player's wanted level will be reduced by -1 Link to comment
manawydan Posted March 24, 2014 Share Posted March 24, 2014 setTimer getTickCount getControlState getPlayerWantedLevel setPlayerWantedLevel can be userful Link to comment
cheez3d Posted March 25, 2014 Share Posted March 25, 2014 Client: addEventHandler("onClientPlayerWeaponFire",localPlayer,function() triggerServerEvent("playerFire",source) end) Server: local timers = {} addEventHandler("onResourceStart",resourceRoot,function() for _,player in ipairs (getElementsByType("player")) do timers[player] = setTimer(setPlayerWantedLevel,300000,0,player,getPlayerWantedLevel(player)-1) end end) addEventHandler("onPlayerJoin",root,function() timers[source] = setTimer(setPlayerWantedLevel,300000,0,source,getPlayerWantedLevel(source)-1) end) addEvent("playerFire",true) addEventHandler("playerFire",root,function() if isTimer(timer[client]) then resetTimer(timer[client]) end end) Not tested. Link to comment
Saml1er Posted March 25, 2014 Share Posted March 25, 2014 The source of onClientWeaponFire is the weapon not the player element. A small typo. addEventHandler("onClientPlayerWeaponFire",localPlayer,function() triggerServerEvent("playerFire",localPlayer) end) Link to comment
Moderators IIYAMA Posted March 25, 2014 Moderators Share Posted March 25, 2014 The source of onClientWeaponFire is the weapon not the player element. A small typo. addEventHandler("onClientPlayerWeaponFire",localPlayer,function() triggerServerEvent("playerFire",localPlayer) end) But he isn't using onClientWeaponFire but onClientPlayerWeaponFire. It can be both, source and localPlayer. Link to comment
Saml1er Posted March 25, 2014 Share Posted March 25, 2014 The source of onClientWeaponFire is the weapon not the player element. A small typo. addEventHandler("onClientPlayerWeaponFire",localPlayer,function() triggerServerEvent("playerFire",localPlayer) end) But he isn't using onClientWeaponFire but onClientPlayerWeaponFire. It can be both, source and localPlayer. sorry, my bad. 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