Jump to content

Hero192

Members
  • Posts

    512
  • Joined

  • Last visited

Everything posted by Hero192

  1. I am really confused , I don't know what I've to edit in this case, can you give me a hand please function forceReload(p) reloadPedWeapon (p) end addCommandHandler("Reload weapon",forceReload) function bindPlayerReloadKey(p) bindKey(p,"r","down","Reload weapon") end function bindReloadForAllPlayers() for k,v in ipairs(getElementsByType("player")) do bindPlayerReloadKey(v) end end addEvent("onPlayerReload",true) addEventHandler("onPlayerReload",getRootElement(), function() reloadPedWeapon (source) end) --client of reload resource: addCommandHandler("Reload weapon", function() triggerServerEvent("onPlayerReload",getLocalPlayer()) end) bindKey("r","down","Reload weapon")
  2. How can I do that? I want when I disable the fire, after the end of timer he can shoot again normaly without reloading
  3. But when I do that the player be forced to reload and I won't him to reload and It toggle for all weapons not only silenced
  4. Hey, How to stop player's weapon from shooting for example only silenced not all weapons for a moment?
  5. The best way to do it is just use cancelEvent anyhow. Okay, Can you help me to do it? because I am scripting the tazer system in server side and the timer is in server side onPlayerDamage Event so how can I use cancelEvent and this event doesn't accept cancelEvent. And if I used cancelEvent in client I need to get the timer from server side to client side to check it and cancel the event, SO what can I do in this situation?
  6. Good idea but I want only Tazer can't shoot for a moment and others can, and it's possible
  7. Listen ,I have already the timer in server side which this code is part of server side so it's hard to check a timer in client side that it's already created in server side. SO, is there's anyway to Block the fire I won't cancel the Event and there's a way I saw it in many servers blocking weapon fires without reloading then when the timer ends the weapon can shoot normal if (isTimer (timers[source] )) then --If the timer still running then --Add the func that block the fire end
  8. I did that, but If I canceled the event, the cop can't even tase wanted, and I need to cancel the fire only if the timer is still running. Any idea? if (isTimer (timers[source] )) then --If the timer still running then let's block cop tazer's fire --WHAT I've to add here ? to "BLOCK" the Silenced gun fire without letting the cop reload for shoot end
  9. Okay i'll try, I still have one more problem, It's about sound client side, I want the sound plays for 5 seconds the normal sound time is about 1 or 2 seconds, I tried that but not working just plays it for the normal fire timer function onTaserSound(attacker) local sound = playSound("taser/Fire.wav") outputDebugString("Sound started.", 3) -- This message appear setSoundVolume(sound, 0.5) setTimer ( function() if sound and isElement(sound) then outputDebugString("sound will be stopped after 4secs.", 3) --This doesn't appear in debugscript 3 stopSound(sound) end end, 5000, 1) end addEvent("onStartTaserSound", true) addEventHandler("onStartTaserSound", localPlayer, onTaserSound)
  10. But does cancelEvent() works on server side > onPlayerDamage (Event) ?
  11. Hello everyone, anyone can give me a hand on this I've scripted a tazer system but I just want to block the tazer(silenced) shoot untill the timers end whole code is fine exept this line cause bug , the bug is the cop need to reload the gun but I won't that, I just want to block is fire for a moment then make him able to shoot without RELOAD --Server side:(because the system is scripted in server side) if (isTimer (timers[source] )) then --WHAT I've to add here ? to "BLOCK" the Silenced gun fire without letting the cop reload for shoot return outputChatBox("Your tazer is still on cooldown.", attacker, 255,0,0) end I won't use toggleControl fire, because the cop will be forced to RELOAD. ~Regards, much thanks !
  12. Hey all, I want to make If the police or LAWTEAM shooted a wanted player with taser the law team need to wait 2 secs to shoot the wanted player again, I tried that but not working fine and no errors on debug. local lawTeam = {["Police"]=true, ["SWAT"]=true} function onShoot(target, posX, posY, posZ) if (getPlayerTeam(localPlayer) and lawTeam[getTeamName(getPlayerTeam(localPlayer))]) then local wanted = getPlayerWantedLevel() if (wanted > 0) then if (source == 23) then setTimer(function() --HERE i don't know how to stop him shooting only with Silenced gun (ID23) end,2000,1) end end end end addEventHandler("onClientWeaponFire", root, onShoot)
  13. As you see from the topic's name, I am trying to make an arrest system, I want to know how to force the prisoner to follows the cop who arrested him.
  14. Okay thanks I understood, So, The usage of this function is totally wrong , Because the event register doesn't exist here to use this event, RIGHT? triggerEvent ( "onPlayerShoot", player, enemy) triggerClientEvent ( player, "onPlayerShoot", player, enemy)
  15. I know how to use the trigger(client/server)event , but I have a problem with this can you correct my first question please
  16. So this event can be used only with the Register event of the trigger function? or it can be used on this situation too triggerEvent ( "onPlayerShoot", player, enemy) triggerClientEvent ( player, "onPlayerShoot", player, enemy) What I understood from you, This function get all the information from register event and sends it to somewhere by using triggerEvent, Correct me if I am wrong please
  17. Hey, I am interested to learn about this function "triggerEvent" , can anyone explain to me more clear with an example please because I didn't get well what on wiki about this function, Thanks !
  18. Hey guys, today I am thinking about scripting a custom wanted system and release it to the community but first i want to know which functions and events should I use to make this resource proper. ~Thanks
  19. Hey first of, thanks for your answer, I tried that Is that correct ? function (source) setPedAnimation ( source, "ped", "KO_shot_stom" ) setTimer ( function(source) setPedAnimation(source) end, 5000, 1, source ) setPedAnimation ( source) end
  20. Hey guys, Can anyone tell me how can i remove the cool down animation, I mean when the timer of animation ends the player keep down on the ground, how to make when the timer of the animation ends the player get up normaly like the first time? That's what I did setPedAnimation(source, "ped", "KO_shot_stom", 5500, false, true, false) and much thanks for who gonna help me
  21. Hey guys, I am asking for a proper way for usage setTimer on this function I want to set the timer about 2 secs ( 2000miliseconds) but I failed function onPlaySound() local sound = playSound("file/sound.wav") setSoundVolume(sound, 0.5) end
×
×
  • Create New...