-
Posts
313 -
Joined
-
Last visited
Everything posted by MAB
-
._. isn't that what it did up there?!
-
help me here... i am making a medic job that to start it you should press E... what ever...the problem here is that on logout function destroys the last ambulance not the player who logged out one and i think the onexplode function does that as well (note : this on logout function is not the original one... that is one i was trying to make it destroy the player's ambulance only but it isn't working) i need you please to tell what is the best way to make a job.. client or server .. and what functions to use .. etc this is the all i reached with the job and all is client side... local medic = createMarker (-2685.57227,638.31696,13.45313,"cylinder",2,255,255,0,255) local medic_blip = createBlipAttachedTo (medic,60) function output (hit,mat) if ( getElementType(hit) == "player" ) and mat then if getElementData(hit,"Job") ~= "medic" then outputChatBox ( "Press E to start the medic job.", hit, 255, 255, 0, true ) else outputChatBox ( "You are a medic arleady.", hit, 255, 255, 0, true ) end end end addEventHandler("onMarkerHit",medic,output) function start (p,k,s) setElementData(p,"Job","medic") unbindKey(p,"e","down",start) amb = createVehicle(416,-2706.53613,615.68994,14.45313,0,0,180) amb_blip = createBlipAttachedTo(amb,56) setElementVisibleTo(amb_blip,root,false) setElementVisibleTo(amb_blip,p,true) setElementData(amb,"owner",getAccountName(getPlayerAccount(p))) setElementData(amb,"jobVehicle",true) addEventHandler("onVehicleExplode",amb,onexpolde) end function bind (hit,mat) if getElementData(hit,"Job") ~= "medic" and mat then bindKey (hit,"e","down",start) end end addEventHandler("onMarkerHit",medic,bind) function unbind (hit) if isKeyBound (hit,"e","down",start) then unbindKey (hit,"e","down",start) end end addEventHandler("onMarkerLeave",medic,unbind) function onenter (pla) if getElementData(source,"jobVehicle") == true then if getElementData(source,"owner") ~= getAccountName(getPlayerAccount(pla)) then cancelEvent() if getElementData(pla,"told") == false then outputChatBox("This isn't your vehicle.",pla,255,255,0) setElementData(pla,"told",true) setTimer(setElementData,5000,1,pla,"told",false) end end end end addEventHandler("onVehicleStartEnter",root,onenter) function destroyBlipsAttachedTo(player) local attached = getAttachedElements ( player ) if ( attached ) then for k,element in ipairs(attached) do if getElementType ( element ) == "blip" then destroyElement ( element ) end end end end function onLogout () local vehicles = getElementsByType("vehicle") for i,v in ipairs(vehicles) do if getElementData(v,"jobVehicle") == true then local data = getElementData(v,"owner") local account = getAccountFromName(data) if account == getPlayerAccount(source) then destroyBlipsAttachedTo(v) destroyElement(v) end end end end addEventHandler("onPlayerLogout",root,onLogout) function getAccountFromName ( name ) return getAccount ( name ) or false end function onexpolde () if isElement(amb_blip) then destroyElement(amb_blip) end local data = getElementData(source,"owner") local account = getAccountFromName(data) local player = getAccountPlayer(account) if player and isElement(player) then setElementData(player,"Job",false) end end
-
this is wrong? local sx,sy = guiGetScreenSize () local x,y = (sx/1280),(sy/768) dxDrawImage(x*992, y*653, x*25, y*29, ":speed/images/e.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) dxDrawRectangle(x*992, y*536, x*185, y*29, tocolor(0, 0, 0, 100), false) dxDrawRectangle(x*992, y*536, x*(currenthealth*1.85), y*29, color, false) dxDrawRectangle(x*992, y*575, x*185, y*29, tocolor(0, 0, 0, 100), false) dxDrawRectangle(x*992, y*575, x*(fuel*1.85), y*29, tocolor(0, 255, 255, 100), false) dxDrawImage(x*992, y*576, x*24, y*28, ":speed/images/f.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) dxDrawRectangle(x*992, y*497, x*185, y*29, tocolor(0, 0, 0, 100), false) -- speed dxDrawRectangle(x*992, y*497, x*(kphSpeed/1.85*1.42), y*29, tocolor(163, 109, 4, 100), false) dxDrawText(tostring(kphSpeed).."KM/H", x*1056, y*504, x*1100, y*518, tocolor(255, 255, 255, 255), x*0.50, "bankgothic", "left", "top", false, false, false, false, false) dxDrawText(tostring(currenthealth).."%", x*1056, y*541, x*1100, y*555, tocolor(255, 255, 255, 255), x*0.50, "bankgothic", "left", "top", false, false, false, false, false) dxDrawText(tostring(fuel).."%", x*1056, y*580, x*1095, y*600, tocolor(255, 255, 255, 255), x*0.50, "bankgothic", "left", "top", false, false, false, false, false)
-
i made a speedometer and i used the guiGetScreenSize example way to make it fixed for all screen resolutions (this way was recommanded by many scripters in this forum in other topic by me about making dx elements visible for all screen resolutions) but when i ran the script in the server down this post some players said that it is small and others said that it is big and almost in the center of the screen but it is perfect with me of course . so anyone knows another/better way to make the dx elements fixed for all screen resolutions? please share fast with examples
-
hm.. i tried what are you talking about but didn't work
-
i am trying to make a setting for a resource i made and that settings changes the number of the seconds that should pass so the the timer do a function... debugscript message : Error : server triggered clientside event receiveSettings, but event is not added clientside meta : "Michael" type="script" name="" description="" /> server : local FuelTimer = get"timer" triggerClientEvent("receiveSettings", root, FuelTimer) client : local timer = 60 addEventHandler( "onClientResourceStart", getResourceRootElement(getThisResource()) , function () addEvent("receiveSettings", true) end) addEventHandler("receiveSettings", root, function(arg) timer = arg end )
-
does anyone know what to put in the speed progress bar argument?
-
Bravo.. you were right and there is no message now
-
it's not a "better way", you are generating traffic (which isn't necessary). -- _G is a predefined variable which contains all the functions (and global variables) defined in the script (and the defaults too) you can test it if you want... for k, v in pairs ( _G ) do print ( k, v ) end the semicolons don't change anything in the script (in some other programming languages it's mandatory to end an instruction). about isEventHandlerAdded, you have to define it in the script: hope u understand i know it and that is the one i am saying that i have tried
-
i am making a speedometer and i found something very strange.. a debugscript message.. comes when there is not nitro in the vehicle that the player is in Error:26: attempt to perform arithmetic on local 'nitro' (a boolean value) although i did "if getVehicleUpgradeOnSlot(veh, then" it still coming note: when i put nitro on the vehicle ... the "currenthealth" progress bar color works but when there is no nitro that color turns white and that is because of that debug message.. also i need help in the speed progress bar.. what should i do in the width? i am tried with it local sx,sy = guiGetScreenSize () local x,y = (sx/1280),(sy/768) function draw () if isPedInVehicle(localPlayer) then local veh = getPedOccupiedVehicle(localPlayer) local sx, sy, sz = getElementVelocity ( veh ) local kphSpeed = math.ceil( ( ( sx^2 + sy^2 + sz^2 ) ^ ( 0.5 ) ) * 161 ) local health = getElementHealth ( veh ) local currenthealth = math.floor( health/10 ) local engine = getVehicleEngineState ( veh ) dxDrawImage(x*991, y*614, x*25, y*29, ":speed/images/settings.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) dxDrawRectangle(x*991, y*536, x*185, y*29, tocolor(0, 0, 0, 100), false) dxDrawRectangle(x*991, y*536, x*(currenthealth*1.85), y*29, color, false) dxDrawRectangle(x*991, y*575, x*185, y*29, tocolor(0, 0, 0, 100), false) dxDrawImage(x*992, y*576, x*24, y*28, ":speed/images/fuel.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) dxDrawRectangle(x*992, y*497, x*185, y*29, tocolor(0, 0, 0, 100), false) dxDrawImage(x*991, y*536, x*24, y*29, ":speed/images/wrench.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) dxDrawRectangle(x*992, y*614, x*185, y*29, tocolor(0, 0, 0, 100), false) dxDrawRectangle(x*991, y*653, x*185, y*29, tocolor(0, 0, 0, 100), false) dxDrawImage(x*991, y*653, x*25, y*29, ":speed/images/lock.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) dxDrawImage(x*992, y*497, x*28, y*29, ":speed/images/speed.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) if getVehicleUpgradeOnSlot(veh,8) then local nitro = getVehicleNitroLevel(veh) dxDrawRectangle(x*991, y*458, x*185, y*29, tocolor(0, 0, 0, 100), false) dxDrawRectangle(x*991, y*458, x*(185*nitro), y*29, tocolor(255, 255, 0, 255), false) dxDrawImage(x*991, y*458, x*24, y*29, ":speed/images/nitro.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) end if (currenthealth >= 80) then color = tocolor(0,255,0,255) elseif (currenthealth < 80 and currenthealth >= 60) then color = tocolor(150,255,0,255) elseif (currenthealth < 60 and currenthealth >= 50) then color = tocolor(255,215,0,255) elseif (currenthealth < 50 and currenthealth >= 40) then color = tocolor(255,69,0,255) elseif (currenthealth <40 and currenthealth >= 30) then color = tocolor(178,34,34,255) elseif (currenthealth < 30) then color = tocolor(50,0,0,255) end end end addEventHandler("onClientRender",root,draw)
-
i tried the function that u r talking about but it didn't work.. i didn't test what u typed but.. what does _G mean? and ; ??
-
now i made this dx gui..how to toggle that gui with /skills command? and make sure that it appears only on the player how commanded only and disappear from the person who commanded screen only? local sx,sy = guiGetScreenSize () local x,y = (sx/1280),(sy/768) function skills () dxDrawRectangle(x*381, y*196, x*521, y*373, tocolor(0, 0, 0, 100), false) end addEventHandler("onClientRender",root,skills) function page1 () dxDrawText("Weapon Skills", x*528, y*198, x*761, y*223, tocolor(255, 255, 255, 255), x*1.00, "bankgothic", "left", "top", false, false, false, false, false) dxDrawText("Colt-45", x*391, y*265, x*481, y*283, tocolor(255, 255, 255, 255), x*0.70, "bankgothic", "left", "top", false, false, false, false, false) dxDrawText("Desert-Eagle", x*390, y*325, x*541, y*344, tocolor(255, 255, 255, 255), x*0.70, "bankgothic", "left", "top", false, false, false, false, false) dxDrawText("Swan-Off", x*391, y*385, x*497, y*403, tocolor(255, 255, 255, 255), x*0.70, "bankgothic", "left", "top", false, false, false, false, false) dxDrawText("Shotgun", x*391, y*445, x*492, y*463, tocolor(255, 255, 255, 255), x*0.70, "bankgothic", "left", "top", false, false, false, false, false) dxDrawText("Spaz-12", x*391, y*505, x*497, y*523, tocolor(255, 255, 255, 255), x*0.70, "bankgothic", "left", "top", false, false, false, false, false) dxDrawLine(x*743, y*264, x*743, y*283, tocolor(0, 0, 0, 255), x*1, false) dxDrawLine(x*860, y*264, x*743, y*264, tocolor(0, 0, 0, 255), x*1, false) dxDrawLine(x*743, y*283, x*860, y*283, tocolor(0, 0, 0, 255), x*1, false) dxDrawLine(x*860, y*283, x*860, y*264, tocolor(0, 0, 0, 255), x*1, false) dxDrawRectangle(x*744, y*265, x*116, y*18, tocolor(0, 0, 0, 100), false) dxDrawLine(x*743, y*324, x*743, y*343, tocolor(0, 0, 0, 255), x*1, false) dxDrawLine(x*860, y*324, x*743, y*324, tocolor(0, 0, 0, 255), x*1, false) dxDrawLine(x*743, y*343, x*860, y*343, tocolor(0, 0, 0, 255), x*1, false) dxDrawLine(x*860, y*343, x*860, y*324, tocolor(0, 0, 0, 255), x*1, false) dxDrawRectangle(x*744, y*325, x*116, y*18, tocolor(0, 0, 0, 100), false) dxDrawLine(x*743, y*384, x*743, y*403, tocolor(0, 0, 0, 255), x*1, false) dxDrawLine(x*860, y*384, x*743, y*384, tocolor(0, 0, 0, 255), x*1, false) dxDrawLine(x*743, y*403, x*860, y*403, tocolor(0, 0, 0, 255), x*1, false) dxDrawLine(x*860, y*403, x*860, y*384, tocolor(0, 0, 0, 255), x*1, false) dxDrawRectangle(x*744, y*385, x*116, y*18, tocolor(0, 0, 0, 100), false) dxDrawLine(x*743, y*444, x*743, y*463, tocolor(0, 0, 0, 255), x*1, false) dxDrawLine(x*860, y*444, x*743, y*444, tocolor(0, 0, 0, 255), x*1, false) dxDrawLine(x*743, y*463, x*860, y*463, tocolor(0, 0, 0, 255), x*1, false) dxDrawLine(x*860, y*463, x*860, y*444, tocolor(0, 0, 0, 255), x*1, false) dxDrawRectangle(x*744, y*445, x*116, y*18, tocolor(0, 0, 0, 100), false) dxDrawLine(x*743, y*504, x*743, y*523, tocolor(0, 0, 0, 255), x*1, false) dxDrawLine(x*860, y*504, x*743, y*504, tocolor(0, 0, 0, 255), x*1, false) dxDrawLine(x*743, y*523, x*860, y*523, tocolor(0, 0, 0, 255), x*1, false) dxDrawLine(x*860, y*523, x*860, y*504, tocolor(0, 0, 0, 255), x*1, false) dxDrawRectangle(x*744, y*505, x*116, y*18, tocolor(0, 0, 0, 100), false) dxDrawText("Next", x*825, y*547, x*880, y*566, tocolor(255, 255, 255, 255), x*0.70, "bankgothic", "left", "top", false, false, false, false, false) end addEventHandler("onClientRender",root,page1)
-
wrong parameters.. the 9th parameter should be "left" not false and the "left" should be the font read this well DxDrawText if didn't work then check if the lua file is set as server not client
-
GTX please show me that way. t3wz what does ; mean? after the trigger client event.
-
i put a car mod in the server. now how to make the mod visible for someplayers only?
-
i am trying to make a resource like that one here is my codes.. not working and there is nothing in the debug.. note : i tried the startx,starty,startz client : function throw (weapon,ammo,hitx,hity,hitz,hitelement,startx,starty,startz) if ( weapon == 4 ) then local sx,sy,sz = getPedWeaponMuzzlePosition(source) knife = createObject (335,sx,sy,sz,90,0,0,"OutQuad") col = createColCuboid (sx,sy,sz) attachElements (col,knife) moveObject(knife,2000,hitx,hity,hitz) triggerServerEvent ("take",localPlayer) addEventHandler("onColShapeHit",col,damage) setTimer(destroy,2000,1,col) setTimer(destroy,2000,1,knife) end end addEventHandler ("onClientPlayerWeaponFire",getLocalPlayer(),throw) function damage (hit) if ( getElementType(hit) == "player" ) then setPedAnimation(hit,"KNIFE","KILL_Knife_Ped_Die") setTimer(setPedAnimation,2500,1,hit,nil,nil) setTimer(setElementHealth,2500,1,hit,0) end if ( getElementType(hit) == "vehicle" ) then local health = getElementHealth(hit) setElementHealth(hit,health-10) end if isElement(knife) then destroyElement(knife) elseif isElement(source) then destroyElement(source) end end function destroy (element) if isElement(element) then destroyElement(element) end end server : addEvent("take",true) addEventHandler("take",root,function() takeWeapon(source,4) end )
