Tox
Members-
Posts
77 -
Joined
-
Last visited
Everything posted by Tox
-
hey uh, i am trying to make an ammo limit but when after a few attempts, it somehow reduces ammo. i couldn't find a solution so i thought about posting it here; outputDebugString ("Ammo limit (re)started.") local number = 0 local slotLimits = { --index = slot,[get ID] = {weapon 1, weapon 2, weapon 3}, limit [1] = {2,{22,23,24},tonumber (get ("Handgun Limit"))}, [2] = {3,{25,26,27},tonumber (get ("Shotgun Limit"))}, [3] = {4, {28,29,32},tonumber (get ("Submachine Gun Limit"))}, [4] = {5, {30,31},tonumber (get ("Machine Gun Limit"))}, [5] = {6,{33,34},tonumber (get ("Rifle Limit"))}, [6] = {8, {16,17,18,39}, tonumber (get ("Projectile Limit"))}, [7] = {7, {35,36}, tonumber (get ("Heavy Weapon Limit"))} } function weaponLimit() for i,v in ipairs (getElementsByType ("player")) do for index, value in ipairs (slotLimits) do if getPedTotalAmmo(v,value[1]) ~= value[3] then if getPedTotalAmmo (v,value[1]) >= value[3] then if #value[2] == 2 then number = 2 elseif #value[2] == 3 then number = 3 else number = 4 end for i= 1, number do setWeaponAmmo (v, value[2][i], value[3] ) end end end end end end setTimer (weaponLimit, 50, 0) addEventHandler ("onPlayerWeaponSwitch",root,weaponLimit)
-
hi, i will call a resource's function but there is an error call: failed to call 'gangs:setBlipInvisible' [string "?"] code is below: function and resource i'll call: function setBlipInvisible (player) if isElement(blips [player]) then destroyElement (blips[player]) end end function setBlipVisible (player) local bbbbr,bbbbg,bbbbb = getPlayerNametagColor (player) blips [player] = createBlipAttachedTo(p, 0, 2, bbbbr,bbbbg,bbbbb ,255,0) end meta.xml: <meta> <info author="Tox" type="script" name="Super Market" version = "1.0.1" description= "hi" /> <oop>true</oop> <script src="client.lua" type="client" /> <script src="server.lua" type="server" /> <script src="skills/cloak_c.lua" type="client" /> <script src="skills/cloak_s.lua" type="server" /> <script src="skills/two-handed_c.lua" type="client" /> <script src="skills/two-handed_s.lua" type="server" /> <settings> <setting name="*Skill key" value="B" /> </settings> <export function="setBlipVisible" type= "server" /> <export function="setBlipInvisible" type= "server" /> <min_mta_version server="1.3.4-0.00000" client="1.3.4-0.00000"></min_mta_version> </meta> script i'll be calling the function in: addEvent ( "skills_cloak", true ) addEventHandler ("skills_cloak", root, function ( seconds, alpha ) local client = client client:setAlpha( alpha ) client:setNametagShowing( false ) exports.gangs:setBlipInvisible(client) Timer ( function () if isElement ( client ) then client:setAlpha( 255 ) client:setNametagShowing( true ) exports.gangs:setBlipVisible(client) end end, 1000*seconds, 1) end ) can someone help me out?
-
ty both, i got the idea
-
hi, is there any way to insert function in a table? I tried to name my function but it came up with an error; my example is below table = { [1] = {"table item", "table item", "event", function testFunction() outputChatBox ("test") end } }
-
oh alright thanks. i don't know why this happens, i used not to need passing arguments in before
-
things afterline 44 does not work at all local peds = {} local timers = {} function appearDknight (ped) setElementData (ped, "knightEnabled",true) timers [tostring (ped).."appear"] = setTimer ( function () if getElementAlpha (ped) < 255 then setElementAlpha (ped, getElementAlpha (ped)+1) setElementData (ped, "appearwait", true) setTimer (function () setElementData (ped, "appearwait", false) end, 10000,1) else killTimer (timers[tostring(ped).."appear"]) timers [tostring (ped).."fade"] = setTimer ( function () if not getElementData (ped, "appearwait") and getElementAlpha (ped) > 1 then setElementAlpha (ped, getElementAlpha (ped)-1) end end, 50,0 ) end end, 50,0 ) end addEventHandler ("onPlayerTarget",root, function (t_Element) if t_Element then if getElementType (t_Element) == "player" then if getElementData (t_Element, "admin") and not peds[t_Element] then local x,y,z = getElementPosition (source) local rx,ry,rz = getElementRotation (source) setElementFrozen (source, true) peds [t_Element] = createPed (0,x,y+0.2,z,rz) setElementAlpha (peds[t_Element], 0) addPedClothes (peds[t_Element], "gimpleg", "gimpleg", 17) setPedAnimation (source, "ped", "IDLE_tired", 10000,true) setPedAnimation (peds[t_Element], "PAULNMAC", "Piss_loop",10000,true) setPedStat (peds[t_Element],23,1000) appearDknight (peds[t_Element]) setElementData (t_Element, "knightEnabled",false) timers [tostring (t_Element).."finish"] = setTimer ( function (p) if isElement (p) and not getElementData (t_Element, "knightEnabled") then setElementFrozen (p, false) if peds [t_Element] then destroyElement (peds[t_Element]) ; peds[t_Element] = nil if timers [tostring (t_Element).."appear"] or timers [tostring (t_Element).."fade"] then killTimer (timers [tostring (t_Element).."appear"]) killTimer (timers [tostring (t_Element).."fade"]) end end else killTimer (timers [tostring (t_Element).."finish"]) end end,5000,0 ) end end end end )
-
well the page you gave just explains how things work in sql we can find it all in wiki as well. not saying it's not useful but it doesn't give what exactly wanted. I would like to see an example too.
-
well I know math.floor but this is for a K/D ratio so I will have to write last 2 digits as well. Thank you though
-
I am looking for math. function that will work to show only 2 digits after comma. Current is showing all the digits after it What does it look like now: 16.66666667 What do I want it to look like: 16.66 Thanks in advance.
-
god, I am always getting my ass kicked by that fault... Thank you mate it worked
-
I used gui editor and the sample on wiki, didn't work. Code is below function IPind() local screenW, screenH = guiGetScreenSize( ) dxDrawText("tobeadded", (screenW * 0.0069) - 1, (screenH * 0.9356) - 1, (screenW * 0.2326) - 1, (screenH * 0.9789) - 1, tocolor(0, 0, 0, 255), 1.85, "pricedown", "left", "top", false, false, true, true, false) dxDrawText("tobeadded", (screenW * 0.0069) + 1, (screenH * 0.9356) - 1, (screenW * 0.2326) + 1, (screenH * 0.9789) - 1, tocolor(0, 0, 0, 255), 1.85, "pricedown", "left", "top", false, false, true, true, false) dxDrawText("tobeadded", (screenW * 0.0069) - 1, (screenH * 0.9356) + 1, (screenW * 0.2326) - 1, (screenH * 0.9789) + 1, tocolor(0, 0, 0, 255), 1.85, "pricedown", "left", "top", false, false, true, true, false) dxDrawText("tobeadded", (screenW * 0.0069) + 1, (screenH * 0.9356) + 1, (screenW * 0.2326) + 1, (screenH * 0.9789) + 1, tocolor(0, 0, 0, 255), 1.85, "pricedown", "left", "top", false, false, true, true, false) dxDrawText("tobeadded", screenW * 0.0069, screenH * 0.9356, screenW * 0.2326, screenH * 0.9789, tocolor(210, 210, 210, 255), 1.85, "pricedown", "left", "top", false, false, true, true, false) end function HandleTheRendering ( ) addEventHandler ( "onClientRender", getRootElement(), IPind ) -- keep the text visible with onClientRender. end addEventHandler ( "onClientResourceStart", resourceRoot, HandleTheRendering )
-
I got 0 errors on debugscript mode 3. I also checked if triggerClientEvent works as you can see on line 4 of the Server-side. I don't see what is the problem. Hope you can help me... Client-side: addEventHandler ("onClientResourceStart", getResourceRootElement(getThisResource()), function () function leaveSound() playSound ("sounds/goodbye.mp3") end addEvent ("onLeaveEvent", true) addEventHandler ("onLeaveEvent", localPlayer, leaveSound) end) Server-side: function onLeave (playerSource) setPlayerTeam (playerSource, nil) triggerClientEvent("onLeaveEvent", playerSource) outputChatBox ("bok") end addCommandHandler ("leave", onLeave)
-
Duh, but I created the team on admin panel and set my team by admin panel also. Not sure it is wrong
-
Hey, thank you man but it doesn't work...
-
Hey uh, I am a little stuck here in my team saving script.The code is below there. I am having a trouble seeing what's wrong-not sure if it's because the "play" resource tho- so I would be so glad if you would give me a hand. function saveTeam () local account = getPlayerAccount (source) if not isGuestAccount (account) then local team = getPlayerTeam (source) setAccountData (account, "savingTeam", team) end end addEventHandler ("onPlayerWasted", root, saveTeam) addEventHandler ("onPlayerQuit", root, saveTeam) function getTeam () local account = getPlayerAccount (source) if account then if not isGuestAccount (account) then team = getAccountData (account, "savingTeam") if team then setPlayerTeam (source, team) end end end end addEventHandler ("onPlayerSpawn", root, getTeam) addEventHandler ("onPlayerLogin", root, getTeam)
-
thank you both guys you helped a lot
-
hello, thank you for replying but I still get WARNING from debugscript here are the warnings :