Snakegold Posted August 30, 2018 Share Posted August 30, 2018 (edited) شباب ليش ما يعطي اللاعب سلاح؟ timer = setTimer(function() counter = counter - 1 if counter <= 30 then r,g,b = 0,255,0 end if counter <= 20 then r,g,b = 255,255,0 end if counter <= 10 then r,g,b = 255,0,0 end if counter == 0 then setElementFrozen (localPlayer, false) givePedWeapon(localPlayer, 32, 5000, true) givePedWeapon(localPlayer, 26, 5000, true) givePedWeapon(localPlayer, 31, 5000, true) removeEventHandler("onClientRender", root, draw) addEventHandler("onClientRender", root, draw3) addEventHandler("onClientRender", root, dxdraw) setTimer(function() removeEventHandler("onClientRender", root, dxdraw) end,3000,0) for i,v in ipairs(getElementsByType("player")) do if isTimer(timer) then killTimer(timer) end if isTimer(timer2) then killTimer(timer2) end end end end,1000,0) Line: 57 58 59 Edited August 30, 2018 by Snakegold Link to comment
Abdul KariM Posted August 31, 2018 Share Posted August 31, 2018 triggerServerEvent giveWeapon 1 Link to comment
Snakegold Posted August 31, 2018 Author Share Posted August 31, 2018 server: function giveWeapon ( ) giveWeapon ( source, 31, 200 ) giveWeapon ( source, 27, 200 ) giveWeapon ( source, 32, 200 ) end addEvent( "giveWeapon", true ) addEventHandler( "giveWeapon", resourceRoot, giveWeapon ) client: timer = setTimer(function() counter = counter - 1 if counter <= 30 then r,g,b = 0,255,0 end if counter <= 20 then r,g,b = 255,255,0 end if counter <= 10 then r,g,b = 255,0,0 end if counter == 0 then triggerServerEvent ( "giveWeapon", resourceRoot) setElementFrozen (localPlayer, false) removeEventHandler("onClientRender", root, draw) addEventHandler("onClientRender", root, draw3) addEventHandler("onClientRender", root, dxdraw) setTimer(function() removeEventHandler("onClientRender", root, dxdraw) end,3000,0) for i,v in ipairs(getElementsByType("player")) do if isTimer(timer) then killTimer(timer) end if isTimer(timer2) then killTimer(timer2) end end end end,1000,0) ما إشتغل Link to comment
Abdul KariM Posted August 31, 2018 Share Posted August 31, 2018 سوي ترايقر لـ اللوكال بلاير وبدل اسم الفنكشن بالسيرفر عشان مايكون فيه تعارض 1 Link to comment
Snakegold Posted August 31, 2018 Author Share Posted August 31, 2018 أنا جديد بالبرمجة أخي ممكن ان تصلح لي الكود تكفى؟ function giveWeaponToPlayer (source) giveWeapon ( source, 31, 9999 ) giveWeapon ( source, 26, 9999 ) giveWeapon ( source, 32, 9999 ) end addEvent( "giveWeapon", true ) addEventHandler( "giveWeapon", resourceRoot, giveWeaponToPlayer ) triggerServerEvent ( "giveWeapon", resourceRoot, localPlayer) Debug:Bad Argument @'giveWeapon' [Expected elemnt at argument 1, got nil] Link to comment
Mr.Mostafa Posted August 31, 2018 Share Posted August 31, 2018 15 minutes ago, Snakegold said: triggerServerEvent ( "giveWeapon", resourceRoot, localPlayer) triggerServerEvent ( "giveWeaponTrigger", localPlayer) -- # Server addEvent ("giveWeaponTrigger",true) addEventHandler ("giveWeaponTrigger",root, function( ) giveWeapon ( source, 31, 9999 ) giveWeapon ( source, 26, 9999 ) giveWeapon ( source, 32, 9999 ) end ) Link to comment
Mr.Mostafa Posted August 31, 2018 Share Posted August 31, 2018 1 minute ago, Snakegold said: شكرا إشتغل آلعفوآ 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