Jump to content

Problems


Jaysds1

Recommended Posts

  • Replies 365
  • Created
  • Last Reply

Top Posters In This Topic

so, I changed it to client side and added the onClientRender:

function start(player) 
    local vehicle = source 
    if (getControlState(player, "vehicle_left")) then 
        setVehicleOverrideLights(vehicle, 1) 
        setVehicleOverrideLights(vehicle, 2) 
        setVehicleOverrideLights(vehicle, 1) 
        setVehicleOverrideLights(vehicle, 2) 
        setVehicleOverrideLights(vehicle, 1) 
        setVehicleOverrideLights(vehicle, 2) 
        setVehicleOverrideLights(vehicle, 1) 
        setVehicleOverrideLights(vehicle, 2) 
    else 
        setVehicleOverrideLights(vehicle,0) 
    end 
    if (getControlState(player, "vehicle_right")) then 
        setVehicleOverrideLights(vehicle, 1) 
        setVehicleOverrideLights(vehicle, 2) 
        setVehicleOverrideLights(vehicle, 1) 
        setVehicleOverrideLights(vehicle, 2) 
        setVehicleOverrideLights(vehicle, 1) 
        setVehicleOverrideLights(vehicle, 2) 
        setVehicleOverrideLights(vehicle, 1) 
        setVehicleOverrideLights(vehicle, 2) 
    else 
        setVehicleOverrideLights(vehicle,0) 
    end 
end 
addEventHandler("onVehicleEnter", getRootElement(), start) 
addEventHandler("onClientRender", getRootElement(), start) 

but this is what is shown in the debugscript:

Warning: JEngine/client.lua:4: Bad Arguement @ 'getControlType'

Warning: JEngine/client.lua:16: Bad Arguement @ 'getControlType'

Edit: is it possible to make a bindkey for this?

Link to comment
function start(player) 
    vehicle = source 
    addEventHandler("onClientRender", getRootElement(), startChecking) 
end 
  
function startChecking() 
    if (getControlState(player, "vehicle_left")) then 
        setVehicleOverrideLights(vehicle, 1) 
        setVehicleOverrideLights(vehicle, 2) 
        setVehicleOverrideLights(vehicle, 1) 
        setVehicleOverrideLights(vehicle, 2) 
        setVehicleOverrideLights(vehicle, 1) 
        setVehicleOverrideLights(vehicle, 2) 
        setVehicleOverrideLights(vehicle, 1) 
        setVehicleOverrideLights(vehicle, 2) 
    else 
        setVehicleOverrideLights(vehicle,0) 
    end 
    if (getControlState(player, "vehicle_right")) then 
        setVehicleOverrideLights(vehicle, 1) 
        setVehicleOverrideLights(vehicle, 2) 
        setVehicleOverrideLights(vehicle, 1) 
        setVehicleOverrideLights(vehicle, 2) 
        setVehicleOverrideLights(vehicle, 1) 
        setVehicleOverrideLights(vehicle, 2) 
        setVehicleOverrideLights(vehicle, 1) 
        setVehicleOverrideLights(vehicle, 2) 
    else 
        setVehicleOverrideLights(vehicle,0) 
    end 
end 
addEventHandler("onVehicleEnter", getRootElement(), start) 

Add on vehicle exit and remove the onClientRender event handler

Link to comment
function start(player) 
    vehicle = source 
    addEventHandler("onClientRender", getRootElement(), startChecking) 
end 
  
function startChecking() 
    if (getControlState(localPlayer, "vehicle_left")) then 
        setVehicleOverrideLights(vehicle, 1) 
        setVehicleOverrideLights(vehicle, 2) 
        setVehicleOverrideLights(vehicle, 1) 
        setVehicleOverrideLights(vehicle, 2) 
        setVehicleOverrideLights(vehicle, 1) 
        setVehicleOverrideLights(vehicle, 2) 
        setVehicleOverrideLights(vehicle, 1) 
        setVehicleOverrideLights(vehicle, 2) 
    else 
        setVehicleOverrideLights(vehicle,0) 
    end 
    if (getControlState(localPlayer, "vehicle_right")) then 
        setVehicleOverrideLights(vehicle, 1) 
        setVehicleOverrideLights(vehicle, 2) 
        setVehicleOverrideLights(vehicle, 1) 
        setVehicleOverrideLights(vehicle, 2) 
        setVehicleOverrideLights(vehicle, 1) 
        setVehicleOverrideLights(vehicle, 2) 
        setVehicleOverrideLights(vehicle, 1) 
        setVehicleOverrideLights(vehicle, 2) 
    else 
        setVehicleOverrideLights(vehicle,0) 
    end 
end 
addEventHandler("onClientVehicleEnter", getRootElement(), start) 

Link to comment

it works, but this is what is shown in the debugscript

Warning: JEngine/client.lua:7: Bad Arguement @ 'getControlType'

Warning: JEngine/client.lua:23: Bad Arguement @ 'getControlType'

This is how the code looks now:

function start(player) 
    vehicle = source 
    addEventHandler("onClientRender", getRootElement(), startChecking) 
end 
  
function startChecking(player) 
    if (getControlState(player, "vehicle_left")) then 
        setVehicleLightState(vehicle, 1,1) 
        setVehicleLightState(vehicle, 3,1) 
        setTimer(function() setVehicleOverrideLights(vehicle, 1) end,1000,0) 
        setTimer(function() setVehicleOverrideLights(vehicle, 2) end,1000,0) 
        setTimer(function() setVehicleOverrideLights(vehicle, 1) end,1000,0) 
        setTimer(function() setVehicleOverrideLights(vehicle, 2) end,1000,0) 
        setTimer(function() setVehicleOverrideLights(vehicle, 1) end,1000,0) 
        setTimer(function() setVehicleOverrideLights(vehicle, 2) end,1000,0) 
        setTimer(function() setVehicleOverrideLights(vehicle, 1) end,1000,0) 
        setTimer(function() setVehicleOverrideLights(vehicle, 2) end,1000,0) 
        setTimer(function() setVehicleOverrideLights(vehicle, 1) end,1000,0) 
        setTimer(function() setVehicleOverrideLights(vehicle, 2) end,1000,0) 
    else 
        setVehicleOverrideLights(vehicle,0) 
        setVehicleLightState(vehicle, 1,0) 
        setVehicleLightState(vehicle, 3,0) 
    end 
    if (getControlState(player, "vehicle_right")) then 
        setVehicleLightState(vehicle, 0,1) 
        setVehicleLightState(vehicle, 2,1) 
        setTimer(function() setVehicleOverrideLights(vehicle, 1) end,5000,0) 
        setTimer(function() setVehicleOverrideLights(vehicle, 2) end,5000,0) 
        setTimer(function() setVehicleOverrideLights(vehicle, 1) end,5000,0) 
        setTimer(function() setVehicleOverrideLights(vehicle, 2) end,5000,0) 
        setTimer(function() setVehicleOverrideLights(vehicle, 1) end,5000,0) 
        setTimer(function() setVehicleOverrideLights(vehicle, 2) end,5000,0) 
        setTimer(function() setVehicleOverrideLights(vehicle, 1) end,5000,0) 
        setTimer(function() setVehicleOverrideLights(vehicle, 2) end,5000,0) 
        setTimer(function() setVehicleOverrideLights(vehicle, 1) end,5000,0) 
        setTimer(function() setVehicleOverrideLights(vehicle, 2) end,5000,0) 
    else 
        setVehicleOverrideLights(vehicle,0) 
        setVehicleLightState(vehicle, 0,0) 
        setVehicleLightState(vehicle, 2,0) 
    end 
end 
addEventHandler("onClientVehicleEnter", getRootElement(), start) 
addEventHandler("onClientVehicleExit", getRootElement(),function() removeEventHandler("onClientRender", getRootElement(), startChecking) end) 

Link to comment

You should look at the code I give you better.

function start(player) 
    vehicle = source 
    addEventHandler("onClientRender", getRootElement(), startChecking) 
end 
  
function startChecking() 
    if (getControlState(getLocalPlayer(), "vehicle_left")) then 
        setVehicleLightState(vehicle, 1,1) 
        setVehicleLightState(vehicle, 3,1) 
        setTimer(function() setVehicleOverrideLights(vehicle, 1) end,1000,0) 
        setTimer(function() setVehicleOverrideLights(vehicle, 2) end,1000,0) 
        setTimer(function() setVehicleOverrideLights(vehicle, 1) end,1000,0) 
        setTimer(function() setVehicleOverrideLights(vehicle, 2) end,1000,0) 
        setTimer(function() setVehicleOverrideLights(vehicle, 1) end,1000,0) 
        setTimer(function() setVehicleOverrideLights(vehicle, 2) end,1000,0) 
        setTimer(function() setVehicleOverrideLights(vehicle, 1) end,1000,0) 
        setTimer(function() setVehicleOverrideLights(vehicle, 2) end,1000,0) 
        setTimer(function() setVehicleOverrideLights(vehicle, 1) end,1000,0) 
        setTimer(function() setVehicleOverrideLights(vehicle, 2) end,1000,0) 
    else 
        setVehicleOverrideLights(vehicle,0) 
        setVehicleLightState(vehicle, 1,0) 
        setVehicleLightState(vehicle, 3,0) 
    end 
    if (getControlState(getLocalPlayer(), "vehicle_right")) then 
        setVehicleLightState(vehicle, 0,1) 
        setVehicleLightState(vehicle, 2,1) 
        setTimer(function() setVehicleOverrideLights(vehicle, 1) end,5000,0) 
        setTimer(function() setVehicleOverrideLights(vehicle, 2) end,5000,0) 
        setTimer(function() setVehicleOverrideLights(vehicle, 1) end,5000,0) 
        setTimer(function() setVehicleOverrideLights(vehicle, 2) end,5000,0) 
        setTimer(function() setVehicleOverrideLights(vehicle, 1) end,5000,0) 
        setTimer(function() setVehicleOverrideLights(vehicle, 2) end,5000,0) 
        setTimer(function() setVehicleOverrideLights(vehicle, 1) end,5000,0) 
        setTimer(function() setVehicleOverrideLights(vehicle, 2) end,5000,0) 
        setTimer(function() setVehicleOverrideLights(vehicle, 1) end,5000,0) 
        setTimer(function() setVehicleOverrideLights(vehicle, 2) end,5000,0) 
    else 
        setVehicleOverrideLights(vehicle,0) 
        setVehicleLightState(vehicle, 0,0) 
        setVehicleLightState(vehicle, 2,0) 
    end 
end 
addEventHandler("onClientVehicleEnter", getRootElement(), start) 
addEventHandler("onClientVehicleExit", getRootElement(),function() removeEventHandler("onClientRender", getRootElement(), startChecking) end) 

Link to comment
function start(player) 
    vehicle = source 
    addEventHandler("onClientRender", getRootElement(), startChecking) 
end 
  
function startChecking() 
    if (getControlState("vehicle_left")) then 
        setVehicleLightState(vehicle, 1,1) 
        setVehicleLightState(vehicle, 3,1) 
        setTimer(function() setVehicleOverrideLights(vehicle, 1) end,1000,0) 
        setTimer(function() setVehicleOverrideLights(vehicle, 2) end,1000,0) 
        setTimer(function() setVehicleOverrideLights(vehicle, 1) end,1000,0) 
        setTimer(function() setVehicleOverrideLights(vehicle, 2) end,1000,0) 
        setTimer(function() setVehicleOverrideLights(vehicle, 1) end,1000,0) 
        setTimer(function() setVehicleOverrideLights(vehicle, 2) end,1000,0) 
        setTimer(function() setVehicleOverrideLights(vehicle, 1) end,1000,0) 
        setTimer(function() setVehicleOverrideLights(vehicle, 2) end,1000,0) 
        setTimer(function() setVehicleOverrideLights(vehicle, 1) end,1000,0) 
        setTimer(function() setVehicleOverrideLights(vehicle, 2) end,1000,0) 
    else 
        setVehicleOverrideLights(vehicle,0) 
        setVehicleLightState(vehicle, 1,0) 
        setVehicleLightState(vehicle, 3,0) 
    end 
    if (getControlState("vehicle_right")) then 
        setVehicleLightState(vehicle, 0,1) 
        setVehicleLightState(vehicle, 2,1) 
        setTimer(function() setVehicleOverrideLights(vehicle, 1) end,5000,0) 
        setTimer(function() setVehicleOverrideLights(vehicle, 2) end,5000,0) 
        setTimer(function() setVehicleOverrideLights(vehicle, 1) end,5000,0) 
        setTimer(function() setVehicleOverrideLights(vehicle, 2) end,5000,0) 
        setTimer(function() setVehicleOverrideLights(vehicle, 1) end,5000,0) 
        setTimer(function() setVehicleOverrideLights(vehicle, 2) end,5000,0) 
        setTimer(function() setVehicleOverrideLights(vehicle, 1) end,5000,0) 
        setTimer(function() setVehicleOverrideLights(vehicle, 2) end,5000,0) 
        setTimer(function() setVehicleOverrideLights(vehicle, 1) end,5000,0) 
        setTimer(function() setVehicleOverrideLights(vehicle, 2) end,5000,0) 
    else 
        setVehicleOverrideLights(vehicle,0) 
        setVehicleLightState(vehicle, 0,0) 
        setVehicleLightState(vehicle, 2,0) 
    end 
end 
addEventHandler("onClientVehicleEnter", getRootElement(), start) 
addEventHandler("onClientVehicleExit", getRootElement(),function() removeEventHandler("onClientRender", getRootElement(), startChecking) end) 

Link to comment
function start(player) 
    vehicle = source 
    addEventHandler("onClientRender", getRootElement(), startChecking) 
end 
  
function startChecking() 
    if (getControlState("vehicle_left")) then 
        setVehicleLightState(vehicle, 1,1) 
        setVehicleLightState(vehicle, 3,1) 
        setTimer(function() setVehicleOverrideLights(vehicle, 1) end,1000,0) 
        setTimer(function() setVehicleOverrideLights(vehicle, 2) end,1000,0) 
        setTimer(function() setVehicleOverrideLights(vehicle, 1) end,1000,0) 
        setTimer(function() setVehicleOverrideLights(vehicle, 2) end,1000,0) 
        setTimer(function() setVehicleOverrideLights(vehicle, 1) end,1000,0) 
        setTimer(function() setVehicleOverrideLights(vehicle, 2) end,1000,0) 
        setTimer(function() setVehicleOverrideLights(vehicle, 1) end,1000,0) 
        setTimer(function() setVehicleOverrideLights(vehicle, 2) end,1000,0) 
        setTimer(function() setVehicleOverrideLights(vehicle, 1) end,1000,0) 
        setTimer(function() setVehicleOverrideLights(vehicle, 2) end,1000,0) 
    elseif (getControlState("vehicle_right")) then 
        setVehicleLightState(vehicle, 0,1) 
        setVehicleLightState(vehicle, 2,1) 
        setTimer(function() setVehicleOverrideLights(vehicle, 1) end,5000,0) 
        setTimer(function() setVehicleOverrideLights(vehicle, 2) end,5000,0) 
        setTimer(function() setVehicleOverrideLights(vehicle, 1) end,5000,0) 
        setTimer(function() setVehicleOverrideLights(vehicle, 2) end,5000,0) 
        setTimer(function() setVehicleOverrideLights(vehicle, 1) end,5000,0) 
        setTimer(function() setVehicleOverrideLights(vehicle, 2) end,5000,0) 
        setTimer(function() setVehicleOverrideLights(vehicle, 1) end,5000,0) 
        setTimer(function() setVehicleOverrideLights(vehicle, 2) end,5000,0) 
        setTimer(function() setVehicleOverrideLights(vehicle, 1) end,5000,0) 
        setTimer(function() setVehicleOverrideLights(vehicle, 2) end,5000,0) 
    else 
        setVehicleOverrideLights(vehicle,0) 
        setVehicleLightState(vehicle, 0,0) 
        setVehicleLightState(vehicle, 2,0) 
    end 
end 
addEventHandler("onClientVehicleEnter", getRootElement(), start) 
addEventHandler("onClientVehicleExit", getRootElement(),function() removeEventHandler("onClientRender", getRootElement(), startChecking) end) 

Try that.

Link to comment

HI again, I have a problem with this gridlist,

When the person joins the gridlist appears but the rows doesn't show

here's the script

Client-side:

function ggs() 
gangs = guiCreateGridList(18,180,147,196,false) 
guiGridListSetSelectionMode(gangs,2) 
guiGridListAddColumn(gangs,"Gangs",55) 
for i = 1, 11 do 
    guiGridListAddRow(gangs) 
end 
guiGridListSetItemText(gangs,0,1,"Aztecas") 
guiGridListSetItemText(gangs,1,1,"Ballas") 
guiGridListSetItemColor(gangs,1,1,100,0,100,255) 
guiGridListSetItemText(gangs,2,1,"Bikers") 
guiGridListSetItemText(gangs,3,1,"Da Nang") 
guiGridListSetItemText(gangs,4,1,"Grove") 
guiGridListSetItemColor(gangs,4,1,0,255,0,255) 
guiGridListSetItemText(gangs,5,1,"Mafia") 
guiGridListSetItemText(gangs,6,1,"Rifa") 
guiGridListSetItemText(gangs,7,1,"Russians") 
guiGridListSetItemText(gangs,8,1,"Sindacco") 
guiGridListSetItemText(gangs,9,1,"Triad") 
guiGridListSetItemText(gangs,10,1,"Vagos") 
end 

Link to comment
function ggs() 
gangs = guiCreateGridList(18,180,147,196,false) 
guiGridListSetSelectionMode(gangs,2) 
guiGridListAddColumn(gangs,"Gangs",55) 
for i = 1, 11 do 
    guiGridListAddRow(gangs) 
end 
guiGridListSetItemText(gangs,0,1,"Aztecas", false, false) 
guiGridListSetItemText(gangs,1,1,"Ballas", false, false) 
guiGridListSetItemColor(gangs,1,1,100,0,100,255) 
guiGridListSetItemText(gangs,2,1,"Bikers", false, false) 
guiGridListSetItemText(gangs,3,1,"Da Nang", false, false) 
guiGridListSetItemText(gangs,4,1,"Grove", false, false) 
guiGridListSetItemColor(gangs,4,1,0,255,0,255) 
guiGridListSetItemText(gangs,5,1,"Mafia", false, false) 
guiGridListSetItemText(gangs,6,1,"Rifa", false, false) 
guiGridListSetItemText(gangs,7,1,"Russians", false, false) 
guiGridListSetItemText(gangs,8,1,"Sindacco", false, false) 
guiGridListSetItemText(gangs,9,1,"Triad", false, false) 
guiGridListSetItemText(gangs,10,1,"Vagos", false, false) 
end 

You forgot required arguments.

Link to comment

Sorry to bug u again, but when the person clicks on the row or team then the buttons are suppose show and the camera is suppose to be on a target but when I press the row then nothing happens,

Client-side:

  
    addEventHandler("onClientGUIClick", gangs, choose 
    function(button) 
        if (button == "left") then 
            backSkin = guiCreateButton(259,448,65,25,"<",false) 
            nextSkin = guiCreateButton(457,452,65,25,">",false) 
            spawn = guiCreateButton(353,534,90,24,"Spawn",false) 
            if (guiGridListGetItemText ( gangs, guiGridListGetSelectedItem ( gangs ), 0 )) then 
            elseif (guiGridListGetItemText ( gangs, guiGridListGetSelectedItem ( gangs ), 1 )) then 
            ball1 = createPed(102,2045.6923828125,-1116.6484375,26.361747741699,0.50811767578125) 
            ball2 = createPed(103,1999.8740234375,-1114.0556640625,27.125,179.30236816406) 
            ball3 = createPed(104,1955.1240234375,-1115.1962890625,27.830497741699,268.91918945313) 
            ball4 = createPed(13,1938.9091796875,-1114.48828125,27.452295303345,178.80798339844) 
            setCameraTarget(source,ball1) 

Link to comment

Sorry again for bugging u guyz, but when I press the gang in the gridlist, the camera doesn't fade to the ped.

Client-side:

  
    addEventHandler("onClientGUIClick", gangs, 
    function(button) 
        if (button == "left") then 
            backSkin = guiCreateButton(259,448,65,25,"<",false) 
            nextSkin = guiCreateButton(457,452,65,25,">",false) 
            spawn = guiCreateButton(353,534,90,24,"Spawn",false) 
            if (guiGridListGetItemText ( gangs, guiGridListGetSelectedItem ( gangs ), 0 )) then 
            elseif (guiGridListGetItemText ( gangs, guiGridListGetSelectedItem ( gangs ), 1 )) then 
            ball1 = createPed(102,2045.6923828125,-1116.6484375,26.361747741699,0.50811767578125) 
            ball2 = createPed(103,1999.8740234375,-1114.0556640625,27.125,179.30236816406) 
            ball3 = createPed(104,1955.1240234375,-1115.1962890625,27.830497741699,268.91918945313) 
            ball4 = createPed(13,1938.9091796875,-1114.48828125,27.452295303345,178.80798339844) 
            fadeCamera(true, 3) 
            setCameraMatrix(2045.724609375,-1110.4052734375,28.871231079102) 

Link to comment

Maybe:

  addEventHandler("onClientGUIClick", gangs, 
    function(button) 
        if (button == "left") then 
            backSkin = guiCreateButton(259,448,65,25,"<",false) 
            nextSkin = guiCreateButton(457,452,65,25,">",false) 
            spawn = guiCreateButton(353,534,90,24,"Spawn",false) 
            if (guiGridListGetItemText ( gangs, guiGridListGetSelectedItem ( gangs ), 1 )) ~= false then 
            ball1 = createPed(102,2045.6923828125,-1116.6484375,26.361747741699,0.50811767578125) 
            ball2 = createPed(103,1999.8740234375,-1114.0556640625,27.125,179.30236816406) 
            ball3 = createPed(104,1955.1240234375,-1115.1962890625,27.830497741699,268.91918945313) 
            ball4 = createPed(13,1938.9091796875,-1114.48828125,27.452295303345,178.80798339844) 
            fadeCamera(true, 3) 
            setCameraMatrix(2045.724609375,-1110.4052734375,28.871231079102) 

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...