Jump to content

MAB

Members
  • Posts

    313
  • Joined

  • Last visited

Everything posted by MAB

  1. MAB

    help

    OK thanks
  2. MAB

    help

    ID GTX i want it to be in one object not all the object
  3. MAB

    help

    is it possible to load a DFF and TXD and Col files in one object only? for example i got 2 objects i want to load the DFF and TXD files i got on one and keep the other on like it is,,,, ?!!?!!?!??!
  4. MAB

    error

    didn't understand that can you please give me an example with numbers?!
  5. MAB

    error

    attempt to call global "isMouseInPosition" ( a nil value ) at line 22.. what to do?! sx,sy = guiGetScreenSize() x,y = (sx/1280),(sy/768) function add (player) addEventHandler( "onClientRender", root, edit ) addEventHandler ( "onClientClick", root, join ) end marker = createMarker ( -2187.50439, 708.30951, 52.89063, "cylinder", 1.5, 255, 255, 255, 255 ) createBlipAttachedTo ( marker, 56 ) addEventHandler ( "onClientMarkerHit", marker, add ) function edit () showCursor(true,true) dxDrawRectangle(x*391, y*99, x*526, y*470, tocolor(0, 0, 0, 100), false) dxDrawRectangle(x*393, y*150, x*524, y*4, tocolor(255, 255, 255, 255), false) dxDrawRectangle(x*391, y*512, x*524, y*4, tocolor(255, 255, 255, 255), false) dxDrawText("Counter Strike", x*532, y*106, x*755, y*150, tocolor(255, 255, 255, 255), 1.50, "pricedown", "left", "top", false, false, false, false, false) dxDrawText("Join", x*450, y*522, x*564, y*552, color, 1.30, "pricedown", "left", "top", false, false, false, false, false) dxDrawText("Close", x*756, y*522, x*870, y*552, color2, 1.30, "pricedown", "left", "top", false, false, false, false, false) dxDrawText("Counter Strike is an event that was meant\n as a mini game. \n In this event you will be in a team of two\n teams and there will be players with you in\n the same team and others in the other team.\n You and your team mates must eliminate all\n the other team players to win.\n All the winner team members will be given\n rewards.", 402, 163, 907, 506, tocolor(255, 255, 255, 255), 1.00, "pricedown", "left", "top", false, false, false, false, false) if ( isMouseInPosition ( 450, 522, 564, 552 ) ) then color = 255,255,0,255 else color = 255,255,255,255 end if ( isMouseInPosition ( 450, 522, 870, 552 ) ) then color2 = 255,255,0,255 else color2 = 255,255,255,255 end end function join (button,state) if ( isMouseInPosition ( 450, 522, 870, 552 ) ) then if ( button == "left" and state == "up" ) then showCursor(false) removeEventHandler("onClientRender", player, edit) end end end
  6. MAB

    little help here

    i am typing "debugscript 3" in the console of my local server but it is saying "debugscript : Incorrect client type for this command"
  7. MAB

    Help

    how to make a dx editbox ?
  8. MAB

    problem

    ok thanks guys
  9. MAB

    problem

    karim : no GTX : u gave me that x,y thing urself
  10. MAB

    problem

    didn't work
  11. MAB

    problem

    why the script is not working?! it is client at the meta.xml sx,sy = guiGetScreenSize() x,y = (sx/1280),(sy/768) function speedometer() 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 ) dxDrawRectangle(x*91, y*495, x*181, y*18, tocolor(0, 0, 0, 100), false) dxDrawRectangle(x*91, y*473, x*181, y*18, tocolor(0, 0, 0, 100), false) dxDrawRectangle(x*91, y*495, x*(181/161/0.5/2/1.5*kphSpeed), y*18, tocolor(0, 0, 255, 100), false) dxDrawRectangle(x*91, y*473, x*(currenthealth*181), y*18, tocolor(r, g, b, 100), false) if (currenthealth >= 80) then r, g, b = 0, 255, 0 elseif (currenthealth < 80 and currenthealth >= 60) then r, g, b = 150, 255, 0 elseif (currenthealth < 60 and currenthealth >= 50) then r, g, b = 255, 215, 0 elseif (currenthealth < 50 and currenthealth >= 40) then r, g, b = 255, 69, 0 elseif (currenthealth <40 and currenthealth >= 30) then r, g, b = 178, 34, 34 elseif (currenthealth < 30) then r, g, b = 50, 0, 0 end end end addEventHandler ( "onClientRender", root, speedometer )
  12. MAB

    Screen Resolution

    this work with images and restangles
  13. How to make images , lines , rectangles fit all screen resolutions?
  14. hi i am trying to draw a text that displays the vehicle health and make it fits all screens with that but it didn't work. local sx,sy = guiGetScreenSize() local px,py = 1600,900 local x,y = (sx/px), (sy/py) local car = getPedOccupiedVehicle ( localPlayer ) local health = getElementHealth ( car ) local currenthealth = math.floor( health/10 ) dxDrawText(tostring(currenthealth).." % ", x*1090, y*635, x*1226, y*549, tocolor(255, 255, 255, 255), 1.00, "default-bold", "left", "top", false, false, false, false, false)
  15. MAB

    Bugs to fix

    it is my script but i changed it due to idea in my head...
  16. MAB

    Bugs to fix

    this is my speedometer with a fuel system.... problems : serverside: attempt to perform arithmetic on local data < a boolean value > .. : client : problem 2 : the speedo was working but now it is not.... problem 3 : i am trying to bind "j" to toggle the car engine but when the data of the fuel is 0 cancelEvent but it isn't working.... client : function draw () if isPedInVehicle ( localPlayer ) then local car = getPedOccupiedVehicle ( localPlayer ) local x, y, z = getElementPosition( localPlayer ) local sx, sy, sz = getElementVelocity ( car ) local kphSpeed = math.ceil( ( ( sx^2 + sy^2 + sz^2 ) ^ ( 0.5 ) ) * 161 ) local health = getElementHealth ( car ) local currenthealth = math.floor( health/10 ) local nitro = getVehicleNitroLevel(car) local engine = getVehicleEngineState ( car ) local light = getVehicleOverrideLights ( car ) local fuel = getElementData ( car, "fuel" ) dxDrawLine(1006 - 1, 662 - 1, 1006 - 1, 692, tocolor(0, 0, 0, 255), 1, false) dxDrawLine(1238, 662 - 1, 1006 - 1, 662 - 1, tocolor(0, 0, 0, 255), 1, false) dxDrawLine(1006 - 1, 692, 1238, 692, tocolor(0, 0, 0, 255), 1, false) dxDrawLine(1238, 692, 1238, 662 - 1, tocolor(0, 0, 0, 255), 1, false) dxDrawRectangle(1006, 662, 232, 30, tocolor(0, 0, 0, 100), false) dxDrawLine(1006 - 1, 698 - 1, 1006 - 1, 728, tocolor(0, 0, 0, 255), 1, false) dxDrawLine(1238, 698 - 1, 1006 - 1, 698 - 1, tocolor(0, 0, 0, 255), 1, false) dxDrawLine(1006 - 1, 728, 1238, 728, tocolor(0, 0, 0, 255), 1, false) dxDrawLine(1238, 728, 1238, 698 - 1, tocolor(0, 0, 0, 255), 1, false) dxDrawRectangle(1006, 698, 232, 30, tocolor(0, 0, 0, 100), false) dxDrawLine(1006 - 1, 592 - 1, 1006 - 1, 622, tocolor(0, 0, 0, 255), 1, false) dxDrawLine(1238, 592 - 1, 1006 - 1, 592 - 1, tocolor(0, 0, 0, 255), 1, false) dxDrawLine(1006 - 1, 622, 1238, 622, tocolor(0, 0, 0, 255), 1, false) dxDrawLine(1238, 622, 1238, 592 - 1, tocolor(0, 0, 0, 255), 1, false) dxDrawRectangle(1006, 592, 232, 30, tocolor(0, 0, 0, 100), false) dxDrawRectangle(1006, 592, fuel*2.32, 30, tocolor(0, 255, 0, 100), false) dxDrawLine(1006 - 1, 627 - 1, 1006 - 1, 657, tocolor(0, 0, 0, 255), 1, false) dxDrawLine(1238, 627 - 1, 1006 - 1, 627 - 1, tocolor(0, 0, 0, 255), 1, false) dxDrawLine(1006 - 1, 657, 1238, 657, tocolor(0, 0, 0, 255), 1, false) dxDrawLine(1238, 657, 1238, 627 - 1, tocolor(0, 0, 0, 255), 1, false) dxDrawRectangle(1006, 627, 232, 30, tocolor(0, 0, 0, 100), false) dxDrawRectangle(1006, 627, currenthealth*2.32, 30, tocolor(255, 0, 0, 100), false) dxDrawLine(1006 - 1, 557 - 1, 1006 - 1, 587, tocolor(0, 0, 0, 255), 1, false) dxDrawLine(1238, 557 - 1, 1006 - 1, 557 - 1, tocolor(0, 0, 0, 255), 1, false) dxDrawLine(1006 - 1, 587, 1238, 587, tocolor(0, 0, 0, 255), 1, false) dxDrawLine(1238, 587, 1238, 557 - 1, tocolor(0, 0, 0, 255), 1, false) dxDrawRectangle(1006, 557, 232, 30, tocolor(0, 0, 0, 100), false) dxDrawRectangle(1006, 557, 232/161/0.5/2/1.5*kphSpeed, 30, tocolor(255, 255, 0, 100), false) dxDrawImage(1010, 564, 23, 18, ":speed/images/speed.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) dxDrawImage(1010, 592, 22, 25, ":speed/images/fuel.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) dxDrawImage(1010, 634, 20, 18, ":speed/images/health.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) dxDrawImage(1010, 666, 16, 16, ":speed/images/lock.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) dxDrawImage(1010, 704, 16, 14, ":speed/images/engine.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) dxDrawText(tostring(kphSpeed).." KM/H ", 1090, 565, 1226, 549, tocolor(255, 255, 255, 255), 1.00, "default-bold", "left", "top", false, false, false, false, false) dxDrawText(tostring(currenthealth).." % ", 1090, 635, 1226, 549, tocolor(255, 255, 255, 255), 1.00, "default-bold", "left", "top", false, false, false, false, false) dxDrawText(tostring(fuel).." % ", 1090, 600, 1226, 549, tocolor(255, 255, 255, 255), 1.00, "default-bold", "left", "top", false, false, false, false, false) if engine == true then dxDrawText(" On ", 1090, 705, 1226, 549, tocolor(255, 255, 255, 255), 1.00, "default-bold", "left", "top", false, false, false, false, false) else dxDrawText(" Off ", 1090, 705, 1226, 549, tocolor(255, 255, 255, 255), 1.00, "default-bold", "left", "top", false, false, false, false, false) end if isVehicleLocked ( car ) then dxDrawText("Locked ", 1090, 670, 1226, 549, tocolor(255, 255, 255, 255), 1.00, "default-bold", "left", "top", false, false, false, false, false) else dxDrawText("Unlocked ", 1090, 670, 1226, 549, tocolor(255, 255, 255, 255), 1.00, "default-bold", "left", "top", false, false, false, false, false) end end end addEventHandler("onClientRender", root, draw) function nitro () local car = getPedOccupiedVehicle ( localPlayer ) local nitro = getVehicleNitroLevel(car) if isPedInVehicle ( localPlayer ) then if getVehicleUpgradeOnSlot ( car, 8 ) then if nitro then dxDrawLine(1006 - 1, 521 - 1, 1006 - 1, 551, tocolor(0, 0, 0, 255), 1, false) dxDrawLine(1238, 521 - 1, 1006 - 1, 521 - 1, tocolor(0, 0, 0, 255), 1, false) dxDrawLine(1006 - 1, 551, 1238, 551, tocolor(0, 0, 0, 255), 1, false) dxDrawLine(1238, 551, 1238, 521 - 1, tocolor(0, 0, 0, 255), 1, false) dxDrawRectangle(1006, 521, 232, 30, tocolor(0, 0, 0, 100), false) dxDrawRectangle(1006, 521, 232/1*nitro, 30, tocolor(0, 255, 255, 100), false) dxDrawImage(1010, 528, 16, 19, ":speed/images/nitro.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) dxDrawText(math.floor(nitro/1*100).."%", 1090, 527, 1226, 549, tocolor(255, 255, 255, 255), 1.00, "default-bold", "left", "top", false, false, false, false, false) end end end end addEventHandler("onClientRender", root, nitro) function nitro2 (key, keyState) localplayer = getLocalPlayer() if isPedInVehicle(localplayer) then pVehicle = getPedOccupiedVehicle(localplayer) if getVehicleUpgradeOnSlot(pVehicle, -- s8) --> then if isVehicleNitroActivated(pVehicle) then setVehicleNitroActivated (pVehicle, false) end end end end bindKey ("mouse1", "up",nitro2) function nitro3 (key, keyState) localplayer = getLocalPlayer() if isPedInVehicle(localplayer) then pVehicle = getPedOccupiedVehicle(localplayer) if getVehicleUpgradeOnSlot(pVehicle, -- s8) --> then setVehicleNitroActivated (pVehicle, true) end end end bindKey ("mouse1", "down",nitro3) function toggleEngine ( key, keyState ) local data = getElementData ( source, "fuel" ) setVehicleEngineState ( source, false ) else setVehicleEngineState ( source, true ) if data == 0 then cancelEvent() end end bindKey ( "j", "down", toggleEngine )] server : function set () if getElementData ( source, "fuel" ) == false then setElementData ( source, "fuel", tonumber(100) ) end end addEventHandler ( "onVehicleEnter",root,set ) function update () for i,v in pairs(getElementsByType("vehicle")) do local data = getElementData ( v, "fuel" ) if getVehicleEngineState ( v ) == true and data ~= 0 then setElementData ( v, "fuel", data - tonumber(1) ) end if getVehicleEngineState ( v ) == false then cancelEvent() end if data == tonumber(0) then setVehicleEngineState ( v, false ) end if data ~= tonumber(0) then setVehicleEngineState ( v, true ) end end end function starttimer () setTimer ( update, 1000, 0 ) end addEventHandler ( "onResourceStart", getResourceRootElement(getThisResource()), starttimer )
  17. MAB

    Help

    attempt to compare with boolean .. note: the same line was used with == and there was no errors and also tried > and < and the same problem happend if data ~= tonumber(0) then setVehicleEngineState ( v, true ) end
  18. the error is the fuel isn't going down
  19. so what you suggest to do?
  20. why the fuel isn't going down?! am i using the data wrong? *NOTE: this isn't the full script it is just the function that the error is in.. function updateFuel() local veh = getPedOccupiedVehicle( localPlayer ) if isPedInVehicle ( localPlayer ) then if getVehicleEngineState ( veh ) == true then CurrentFuelValue = getElementData(veh,"Fuel") NewFuelValue = CurrentFuelValue - 1 timer = setTimer ( setElementData, 10*1000, 0, veh, "fuel", tonumber(NewFuelValue) ) end if getVehicleEngineState ( veh ) == false then if timer then killTimer ( timer ) end end end if (CurrentFuelValue==0) then setVehicleEngineState(veh,false) end end addEventHandler ("onClientRender", getLocalPlayer(), updateFuel)
  21. MAB

    [Help] Coding

    How code my scripts? so if it was stolen so no one know how it was maden...or i uploaded it to the community no one edit it..
  22. i don't know how to make mta create one of these markers randomly when an event happens.. and on the hit one of the other two will be created and the old one get destroyed i tried and failed so i deleted the old code and i am here for help markers = { marker1 = createMarker ( 1640.04163, -2451.72778, 12.55469, "cylinder", 1.5, 255, 255, 0, 170 ), marker2 = createMarker ( -1641.87573, -183.24684, 13.14844, "cylinder", 1.5, 255, 255, 0, 170 ), marker3 = createMarker ( 1566.22876, 1498.72900, 9.83527, "cylinder", 1.5, 255, 255, 0, 170 ) }
  23. MAB

    command

    that one worked thank you alot btw i don't know how to debug
  24. MAB

    command

    Didn't work...
  25. MAB

    command

    why it is not sending?! function send (player,command,player2,money) if ( not player2 or not tonumber ( money ) ) then outputChatBox ( "The correct syntax for /"..tostring(command).." is /"..tostring(command).." [playername] [amount]", player, 255, 255, 0 ) return false end local money = math.floor ( tonumber ( money ) ) local money2 = getPlayerMoney ( player ) local taker = getPlayerFromName ( player2 ) local name = getPlayerName ( player ) if ( money and money >= money2 and tonumber ( money ) and taker and player2 ) then takePlayerMoney ( player, money ) outputChatBox ( "You sent "..money.."$ to "..player2".", player, 255, 255, 0, false ) givePlayerMoney ( taker, money ) outputChatBox ( name.." sent you "..money.."$ "..player2".", player2, 255, 255, 0, false ) end end addCommandHandler ( "send", send )
×
×
  • Create New...