Jump to content

help guys


franku

Recommended Posts

Upgrades

bool addVehicleUpgrade ( vehicle theVehicle, int upgrade ) 

Camera

setCameraMatrix 

Click Dx: (Example)

  
local screenWidth,screenHeight = guiGetScreenSize() 
bX, bY = screenWidth/2,screenHeight/2 
  
local scale = x/800 
local scaley = x/600 
local sx,sy = 300,300 
sx,sy = sx*scale,sy*scaley  
function renderoko() 
    dxDrawRectangle (sx/1.35, sy/2.5, sx/10.8, sx/10.8, tocolor ( 0, 0, 0, 150 ) ) 
    if isMouseWithinRangeOf(sx/1.35, sy/2.5, sx/10.8, sx/10.8 ) then 
        dxDrawRectangle (sx/1.35, sy/2.5, sx/10.8, sx/10.8, tocolor ( 195, 195, 195, 50 )) 
    end 
    if click then 
        dxDrawRectangle (sx/1.35, sy/2.5, sx/10.8, sx/10.8, tocolor ( 255, 0, 0, 255) ) 
    end 
end 
  
  
function key(button,press) 
    if press then 
        if isMouseWithinRangeOf(sx/1.35, sy/2.5, sx/10.8, sx/10.8 ) then 
            if click == true then 
                click = false 
            else 
                click = true 
                outputChatBox("click") 
            end 
        end 
    end 
end 
addEventHandler ( "onClientKey", getRootElement(), key ) 
  
  
  
function open() 
  
    if open == true then 
        removeEventHandler("onClientRender", root, renderoko) 
        open = false 
        showCursor(false) 
    else 
        addEventHandler("onClientRender", root, renderoko) 
        open = true 
        showCursor(true) 
    end 
end 
bindKey ( "g", "down", open )  
  
  
function isMouseWithinRangeOf(psx,psy,pssx,pssy) 
  if not isCursorShowing() then 
    return false 
  end 
  local cx,cy = getCursorPosition() 
  cx,cy = cx*x,cy*y 
  if cx >= psx and cx <= psx+pssx and cy >= psy and cy <= psy+pssy then 
    return true,cx,cy 
  else 
    return false 
  end 
end 
  

click g in game

Link to comment
pls show me example, thanks

oo sorry my bad :)

local screenWidth,screenHeight = guiGetScreenSize() 
bX, bY = screenWidth/2,screenHeight/2 
  
local scale = screenWidth/800 
local scaley = screenWidth/600 
local sx,sy = 300,300 
sx,sy = sx*scale,sy*scaley 
function renderoko() 
    dxDrawRectangle (sx/1.35, sy/2.5, sx/10.8, sx/10.8, tocolor ( 0, 0, 0, 150 ) ) 
    if isMouseWithinRangeOf(sx/1.35, sy/2.5, sx/10.8, sx/10 ) then 
        dxDrawRectangle (sx/1.35, sy/2.5, sx/10.8, sx/10.8, tocolor ( 195, 195, 195, 50 )) 
    end 
    if click then 
        dxDrawRectangle (sx/1.35, sy/2.5, sx/10.8, sx/10.8, tocolor ( 255, 0, 0, 255) ) 
    end 
end 
  
  
function key(button,press) 
    if press then 
        if isMouseWithinRangeOf(sx/1.35, sy/2.5, sx/10.8, sx/10.8 ) then 
            if click == true then 
                click = false 
            else 
                click = true 
                outputChatBox("click") 
            end 
        end 
    end 
end 
addEventHandler ( "onClientKey", getRootElement(), key ) 
  
  
  
function open() 
  
    if open == true then 
        removeEventHandler("onClientRender", root, renderoko) 
        open = false 
        showCursor(false) 
    else 
        addEventHandler("onClientRender", root, renderoko) 
        open = true 
        showCursor(true) 
    end 
end 
bindKey ( "g", "down", open ) 
  
  
function isMouseWithinRangeOf(psx,psy,pssx,pssy) 
  if not isCursorShowing() then 
    return false 
  end 
  local cx,cy = getCursorPosition() 
  cx,cy = cx*x,cy*y 
  if cx >= psx and cx <= psx+pssx and cy >= psy and cy <= psy+pssy then 
    return true,cx,cy 
  else 
    return false 
  end 
end 

Link to comment
did,nothing happen :)

ok, tested

  
local screenWidth,screenHeight = guiGetScreenSize() 
bX, bY = screenWidth/2,screenHeight/2 
  
local scale = screenWidth/800 
local scaley = screenWidth/600 
local sx,sy = 300,300 
sx,sy = sx*scale,sy*scaley 
function renderoko() 
    dxDrawRectangle (sx/1.35, sy/2.5, sx/10.8, sx/10.8, tocolor ( 0, 0, 0, 150 ) ) 
    if isMouseWithinRangeOf(sx/1.35, sy/2.5, sx/10.8, sx/10.8 ) then 
        dxDrawRectangle (sx/1.35, sy/2.5, sx/10.8, sx/10.8, tocolor ( 195, 195, 195, 50 )) 
    end 
    if click then 
        dxDrawRectangle (sx/1.35, sy/2.5, sx/10.8, sx/10.8, tocolor ( 255, 0, 0, 255) ) 
    end 
end 
  
  
function key(button,press) 
    if press then 
        if isMouseWithinRangeOf(sx/1.35, sy/2.5, sx/10.8, sx/10.8 ) then 
            if click == true then 
                click = false 
            else 
                click = true 
                outputChatBox("click") 
            end 
        end 
    end 
end 
addEventHandler ( "onClientKey", getRootElement(), key ) 
  
  
  
function open() 
  
    if open == true then 
        removeEventHandler("onClientRender", root, renderoko) 
        open = false 
        showCursor(false) 
    else 
        addEventHandler("onClientRender", root, renderoko) 
        open = true 
        showCursor(true) 
    end 
end 
bindKey ( "g", "down", open ) 
  
  
function isMouseWithinRangeOf(psx,psy,pssx,pssy) 
  if not isCursorShowing() then 
    return false 
  end 
  local cx,cy = getCursorPosition() 
  cx,cy = cx*screenWidth,cy*screenHeight 
  if cx >= psx and cx <= psx+pssx and cy >= psy and cy <= psy+pssy then 
    return true,cx,cy 
  else 
    return false 
  end 
end 
  

Link to comment

This Is My Example :)

  
--Client 
  
  
local screenWidth,screenHeight = guiGetScreenSize() 
bX, bY = screenWidth/2,screenHeight/2 
  
local scale = screenWidth/800 
local scaley = screenWidth/600 
local sx,sy = 300,300 
sx,sy = sx*scale,sy*scaley 
  
  
  
  
win =  
{ 
{ sx/1.35, sy/2.5, sx/10.8, sx/20.8}, 
  
{ sx/1.185, sy/2.5, sx/10.8, sx/20.8}, 
  
{ sx/1.055, sy/2.5, sx/10.8, sx/20.8}, 
  
{ sx/0.95, sy/2.5, sx/10.8, sx/20.8}, 
  
{ sx/0.865, sy/2.5, sx/10.8, sx/20.8}, 
  
{ sx/0.794, sy/2.5, sx/10.8, sx/20.8}, 
  
  
  
{ sx/1.35, sy/2.09, sx/10.8, sx/20.8}, 
  
{ sx/1.185, sy/2.09, sx/10.8, sx/20.8}, 
  
{ sx/1.055, sy/2.09, sx/10.8, sx/20.8}, 
  
{ sx/0.95, sy/2.09, sx/10.8, sx/20.8}, 
  
  
} 
  
  
  
  
  
function renderoko() 
    items =  
    { 
    {"1" }, 
    {"2" }, 
    {"3" }, 
    {"4" }, 
    {"5" }, 
    {"6" }, 
    {"7" }, 
    {"8" }, 
    {"9" }, 
    {"10" }, 
     
  
    } 
     
    for i=1,10 do 
     
    dxDrawRectangle (win[i][1], win[i][2], win[i][3], win[i][4], tocolor ( 0, 0, 0, 150 ) ) 
        for id,item in ipairs(items) do 
            dxDrawText (item[1], win[id][1], win[id][2], win[id][3], win[id][4], tocolor ( 255,255,255, 255 ), 1.02, "pricedown" ) 
        end 
     
     
     
         
        if isMouseWithinRangeOf(win[i][1], win[i][2], win[i][3], win[i][4]) then 
            dxDrawRectangle (win[i][1], win[i][2], win[i][3], win[i][4], tocolor ( 195, 195, 195, 50 ) ) 
        end  
        if click == i then 
            dxDrawRectangle (win[i][1], win[i][2], win[i][3], win[i][4], tocolor ( 255, 0, 0, 255) ) 
        end 
    end 
     
     
     
  
end 
  
  
function key(button,press) 
     
    if button == "mouse1" then 
        for i=1,10 do 
            if isMouseWithinRangeOf(win[i][1], win[i][2], win[i][3], win[i][4] ) then 
                if click == i then 
                    click = false 
                else 
                    click = i 
                    --outputChatBox("click") 
                end 
            end  
        end 
         
         
         
        if press then 
            --Click 1 
            if isMouseWithinRangeOf(win[1][1], win[1][2], win[1][3], win[1][4] ) then 
                local theVehicle = getPedOccupiedVehicle ( localPlayer ) 
                addVehicleUpgrade ( theVehicle, 1010 ) 
                outputChatBox("You Buy Nitro!") 
            --Click 2 
            elseif isMouseWithinRangeOf(win[2][1], win[2][2], win[2][3], win[2][4] ) then 
                local theVehicle = getPedOccupiedVehicle ( localPlayer ) 
                addVehicleUpgrade ( theVehicle, 1087 ) 
                outputChatBox("You Buy Hydralics!") 
            end 
             
             
             
        end 
    end 
end 
addEventHandler ( "onClientKey", getRootElement(), key ) 
  
function isMouseWithinRangeOf(psx,psy,pssx,pssy) 
  if not isCursorShowing() then 
    return false 
  end 
  local cx,cy = getCursorPosition() 
  cx,cy = cx*screenWidth,cy*screenHeight 
  if cx >= psx and cx <= psx+pssx and cy >= psy and cy <= psy+pssy then 
    return true,cx,cy 
  else 
    return false 
  end 
end 
  
  
  
function VehicleInMarker(hitElement) 
    addEventHandler("onClientRender", root, renderoko) 
    showCursor(true,false) 
end 
addEvent( "VehicleInMarker", true ) 
addEventHandler( "VehicleInMarker", localPlayer, VehicleInMarker ) 
  
function VehicleLeaveMarker(hitElement) 
    removeEventHandler("onClientRender", root, renderoko) 
    showCursor(false) 
end 
addEvent( "VehicleLeaveMarker", true ) 
addEventHandler( "VehicleLeaveMarker", localPlayer, VehicleLeaveMarker ) 
  

  
--Server 
  
removeWorldModel(10575,10575,-2716.2993,217.0497,5.7050714) 
  
local theMarker = createMarker ( -2725.056640625, 217.3232421875, 3.484375, "cylinder", 5, 255, 255, 0, 170 ) 
  
  
function MarkerHit( hitElement, matchingDimension ) 
    if getElementType(hitElement) == "player" and isPedInVehicle(hitElement) then  
        triggerClientEvent ( hitElement, "VehicleInMarker", hitElement, hitElement ) 
    else 
        if getElementType(hitElement) == "player" and not isPedInVehicle(hitElement) then 
            outputChatBox("You Must Car!", hitElement) 
        end 
    end 
end 
addEventHandler( "onMarkerHit", theMarker, MarkerHit ) 
  
function MarkerLeave( leaveElement, matchingDimension ) 
    if getElementType(leaveElement) == "player" and isPedInVehicle(leaveElement) then  
        triggerClientEvent ( leaveElement, "VehicleLeaveMarker", leaveElement, leaveElement ) 
    end 
end 
addEventHandler( "onMarkerLeave", theMarker, MarkerLeave ) 
  

Link to comment
This Is My Example :)
  
--Client 
  
  
local screenWidth,screenHeight = guiGetScreenSize() 
bX, bY = screenWidth/2,screenHeight/2 
  
local scale = screenWidth/800 
local scaley = screenWidth/600 
local sx,sy = 300,300 
sx,sy = sx*scale,sy*scaley 
  
  
  
  
win =  
{ 
{ sx/1.35, sy/2.5, sx/10.8, sx/20.8}, 
  
{ sx/1.185, sy/2.5, sx/10.8, sx/20.8}, 
  
{ sx/1.055, sy/2.5, sx/10.8, sx/20.8}, 
  
{ sx/0.95, sy/2.5, sx/10.8, sx/20.8}, 
  
{ sx/0.865, sy/2.5, sx/10.8, sx/20.8}, 
  
{ sx/0.794, sy/2.5, sx/10.8, sx/20.8}, 
  
  
  
{ sx/1.35, sy/2.09, sx/10.8, sx/20.8}, 
  
{ sx/1.185, sy/2.09, sx/10.8, sx/20.8}, 
  
{ sx/1.055, sy/2.09, sx/10.8, sx/20.8}, 
  
{ sx/0.95, sy/2.09, sx/10.8, sx/20.8}, 
  
  
} 
  
  
  
  
  
function renderoko() 
    items =  
    { 
    {"1" }, 
    {"2" }, 
    {"3" }, 
    {"4" }, 
    {"5" }, 
    {"6" }, 
    {"7" }, 
    {"8" }, 
    {"9" }, 
    {"10" }, 
     
  
    } 
     
    for i=1,10 do 
     
    dxDrawRectangle (win[i][1], win[i][2], win[i][3], win[i][4], tocolor ( 0, 0, 0, 150 ) ) 
        for id,item in ipairs(items) do 
            dxDrawText (item[1], win[id][1], win[id][2], win[id][3], win[id][4], tocolor ( 255,255,255, 255 ), 1.02, "pricedown" ) 
        end 
     
     
     
         
        if isMouseWithinRangeOf(win[i][1], win[i][2], win[i][3], win[i][4]) then 
            dxDrawRectangle (win[i][1], win[i][2], win[i][3], win[i][4], tocolor ( 195, 195, 195, 50 ) ) 
        end  
        if click == i then 
            dxDrawRectangle (win[i][1], win[i][2], win[i][3], win[i][4], tocolor ( 255, 0, 0, 255) ) 
        end 
    end 
     
     
     
  
end 
  
  
function key(button,press) 
     
    if button == "mouse1" then 
        for i=1,10 do 
            if isMouseWithinRangeOf(win[i][1], win[i][2], win[i][3], win[i][4] ) then 
                if click == i then 
                    click = false 
                else 
                    click = i 
                    --outputChatBox("click") 
                end 
            end  
        end 
         
         
         
        if press then 
            --Click 1 
            if isMouseWithinRangeOf(win[1][1], win[1][2], win[1][3], win[1][4] ) then 
                local theVehicle = getPedOccupiedVehicle ( localPlayer ) 
                addVehicleUpgrade ( theVehicle, 1010 ) 
                outputChatBox("You Buy Nitro!") 
            --Click 2 
            elseif isMouseWithinRangeOf(win[2][1], win[2][2], win[2][3], win[2][4] ) then 
                local theVehicle = getPedOccupiedVehicle ( localPlayer ) 
                addVehicleUpgrade ( theVehicle, 1087 ) 
                outputChatBox("You Buy Hydralics!") 
            end 
             
             
             
        end 
    end 
end 
addEventHandler ( "onClientKey", getRootElement(), key ) 
  
function isMouseWithinRangeOf(psx,psy,pssx,pssy) 
  if not isCursorShowing() then 
    return false 
  end 
  local cx,cy = getCursorPosition() 
  cx,cy = cx*screenWidth,cy*screenHeight 
  if cx >= psx and cx <= psx+pssx and cy >= psy and cy <= psy+pssy then 
    return true,cx,cy 
  else 
    return false 
  end 
end 
  
  
  
function VehicleInMarker(hitElement) 
    addEventHandler("onClientRender", root, renderoko) 
    showCursor(true,false) 
end 
addEvent( "VehicleInMarker", true ) 
addEventHandler( "VehicleInMarker", localPlayer, VehicleInMarker ) 
  
function VehicleLeaveMarker(hitElement) 
    removeEventHandler("onClientRender", root, renderoko) 
    showCursor(false) 
end 
addEvent( "VehicleLeaveMarker", true ) 
addEventHandler( "VehicleLeaveMarker", localPlayer, VehicleLeaveMarker ) 
  

  
--Server 
  
removeWorldModel(10575,10575,-2716.2993,217.0497,5.7050714) 
  
local theMarker = createMarker ( -2725.056640625, 217.3232421875, 3.484375, "cylinder", 5, 255, 255, 0, 170 ) 
  
  
function MarkerHit( hitElement, matchingDimension ) 
    if getElementType(hitElement) == "player" and isPedInVehicle(hitElement) then  
        triggerClientEvent ( hitElement, "VehicleInMarker", hitElement, hitElement ) 
    else 
        if getElementType(hitElement) == "player" and not isPedInVehicle(hitElement) then 
            outputChatBox("You Must Car!", hitElement) 
        end 
    end 
end 
addEventHandler( "onMarkerHit", theMarker, MarkerHit ) 
  
function MarkerLeave( leaveElement, matchingDimension ) 
    if getElementType(leaveElement) == "player" and isPedInVehicle(leaveElement) then  
        triggerClientEvent ( leaveElement, "VehicleLeaveMarker", leaveElement, leaveElement ) 
    end 
end 
addEventHandler( "onMarkerLeave", theMarker, MarkerLeave ) 
  

place in map: http://screenshot.sh/m7TLiFjrMXYBm

Link to comment
  
--Client 
local screenWidth,screenHeight = guiGetScreenSize() 
bX, bY = screenWidth/2,screenHeight/2 
  
local scale = screenWidth/800 
local scaley = screenWidth/600 
local sx,sy = 300,300 
sx,sy = sx*scale,sy*scaley 
  
  
  
  
win =  
{ 
{ sx/1.35, sy/2.5, sx/10.8, sx/20.8}, 
  
{ sx/1.185, sy/2.5, sx/10.8, sx/20.8}, 
  
{ sx/1.055, sy/2.5, sx/10.8, sx/20.8}, 
  
{ sx/0.95, sy/2.5, sx/10.8, sx/20.8}, 
  
{ sx/0.865, sy/2.5, sx/10.8, sx/20.8}, 
  
{ sx/0.794, sy/2.5, sx/10.8, sx/20.8}, 
  
  
  
{ sx/1.35, sy/2.09, sx/10.8, sx/20.8}, 
  
{ sx/1.185, sy/2.09, sx/10.8, sx/20.8}, 
  
{ sx/1.055, sy/2.09, sx/10.8, sx/20.8}, 
  
{ sx/0.95, sy/2.09, sx/10.8, sx/20.8}, 
  
  
} 
  
  
  
  
  
function renderoko() 
    items =  
    { 
    {"1" }, 
    {"2" }, 
    {"3" }, 
    {"4" }, 
    {"5" }, 
    {"6" }, 
    {"7" }, 
    {"8" }, 
    {"9" }, 
    {"10" }, 
     
  
    } 
     
    for i=1,10 do 
     
    dxDrawRectangle (win[i][1], win[i][2], win[i][3], win[i][4], tocolor ( 0, 0, 0, 150 ) ) 
        for id,item in ipairs(items) do 
            dxDrawText (item[1], win[id][1], win[id][2], win[id][3], win[id][4], tocolor ( 255,255,255, 255 ), 1.02, "pricedown" ) 
        end 
     
     
     
         
        if isMouseWithinRangeOf(win[i][1], win[i][2], win[i][3], win[i][4]) then 
            dxDrawRectangle (win[i][1], win[i][2], win[i][3], win[i][4], tocolor ( 195, 195, 195, 50 ) ) 
        end  
        if click == i then 
            dxDrawRectangle (win[i][1], win[i][2], win[i][3], win[i][4], tocolor ( 255, 0, 0, 255) ) 
        end 
    end 
     
     
     
  
end 
  
  
function key(button,press) 
     
    if button == "mouse1" then 
        for i=1,10 do 
            if isMouseWithinRangeOf(win[i][1], win[i][2], win[i][3], win[i][4] ) then 
                if click == i then 
                    click = false 
                else 
                    click = i 
                end 
            else 
                if click == i then 
                    click = false 
                end 
            end  
        end 
         
         
         
        if press then 
            --Click 1 
            if isMouseWithinRangeOf(win[1][1], win[1][2], win[1][3], win[1][4] ) then 
                local theVehicle = getPedOccupiedVehicle ( localPlayer ) 
                addVehicleUpgrade ( theVehicle, 1010 ) 
                outputChatBox("You Buy Nitro!") 
            --Click 2 
            elseif isMouseWithinRangeOf(win[2][1], win[2][2], win[2][3], win[2][4] ) then 
                local theVehicle = getPedOccupiedVehicle ( localPlayer ) 
                addVehicleUpgrade ( theVehicle, 1087 ) 
                outputChatBox("You Buy Hydralics!") 
            end 
             
             
             
        end 
    end 
end 
addEventHandler ( "onClientKey", getRootElement(), key ) 
  
function isMouseWithinRangeOf(psx,psy,pssx,pssy) 
  if not isCursorShowing() then 
    return false 
  end 
  local cx,cy = getCursorPosition() 
  cx,cy = cx*screenWidth,cy*screenHeight 
  if cx >= psx and cx <= psx+pssx and cy >= psy and cy <= psy+pssy then 
    return true,cx,cy 
  else 
    return false 
  end 
end 
  
  
  
function VehicleInMarker(hitElement) 
    addEventHandler("onClientRender", root, renderoko) 
    showCursor(true,false) 
    setCameraMatrix(-2725.86640625, 211.9232421875, 6.484375, 1.388671875, 5550.42474365234, -1850.881813049316) 
end 
addEvent( "VehicleInMarker", true ) 
addEventHandler( "VehicleInMarker", localPlayer, VehicleInMarker ) 
  
function VehicleLeaveMarker(hitElement) 
    removeEventHandler("onClientRender", root, renderoko) 
    showCursor(false) 
    setCameraTarget ( hitElement ) 
end 
addEvent( "VehicleLeaveMarker", true ) 
addEventHandler( "VehicleLeaveMarker", localPlayer, VehicleLeaveMarker ) 
  
  

Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...