Jump to content

مشكلة بعمل ترايقر بين كلاينكت وسيرفر


Recommended Posts

كلنت

triggerServerEvent("fix", localPlayer) 

سيرفر

addEvent("fix",true) 
    addEventHandler("fix",root, 
        function ( thePlayer ) 
            outputChatBox("fix.",thePlayer,255,255,255,true) 
        end 
    ) 

Link to comment

thePlayer = ?

تقدر تسوية كذا :

triggerServerEvent('fix',localPlayer,localPlayer) 

ويشتغل

او هذي :

addEvent("fix",true) 
    addEventHandler("fix",root, 
        function (  ) 
            outputChatBox("fix.",client,255,255,255,true) 
        end 
    ) 
Link to comment

كلنت

    addEventHandler('onClientGUIClick', root, 
    function() 
        if ( source == fix ) then 
            triggerServerEvent("fix",localPlayer,localPlayer) 
        elseif ( source == color ) then 
            triggerServerEvent("color",localPlayer,localPlayer) 
        elseif ( source == engine ) then 
            triggerServerEvent("engine",localPlayer,localPlayer) 
        elseif ( source == lock ) then 
            triggerServerEvent("lock",localPlayer,localPlayer) 
        elseif ( source == light ) then 
            triggerServerEvent("light",localPlayer,localPlayer) 
        end  
    end 
    ) 

سيرفر

addEvent("fix",true) 
    addEventHandler("fix",root, 
        function () 
            local Vehicle = getPedOccupiedVehicle(thePlayer) 
            fixVehicle ( Vehicle ) 
        end 
    ) 

http://prntscr.com/1a36kq

Edited by Guest
Link to comment
addEvent("fix",true) 
    addEventHandler("fix",root, 
        function ( thePlayer ) 
            if isPedInVehicle ( thePlayer ) then 
                fixVehicle ( getPedOccupiedVehicle(thePlayer) ) 
            end 
        end 
    ) 

Link to comment

 

سيرفر

addEvent("fix",true) 
    addEventHandler("fix",root, 
        function () 
            local Vehicle = getPedOccupiedVehicle(thePlayer) 
            if Vehicle then 
                if (getPlayerMoney (thePlayer) >= 1000) then 
                fixVehicle ( Vehicle ) 
                takePlayerMoney ( thePlayer, 1000 ) 
                outputChatBox("#00FF00Your vehicle has been fixed at $1000.",thePlayer,255,255,255,true) 
                else 
                outputChatBox("#FF0000انت لاتملك المال الكافي.",thePlayer,255,255,255,true) 
                end 
            else 
                outputChatBox("#FF0000You must be a Vehicle.",thePlayer,255,255,255,true) 
            end 
        end 
    ) 
addEvent("color",true) 
    addEventHandler("color",root, 
        function () 
            local Vehicle = getPedOccupiedVehicle(thePlayer) 
            if Vehicle then 
                if getPlayerMoney (thePlayer) >= 1000 then 
                    local r, g, b = math.random( 255 ), math.random( 255 ), math.random( 255 ) 
                    setVehicleColor( Vehicle, r, g, b ) 
                    takePlayerMoney ( thePlayer, 1000 ) 
                    outputChatBox("#00FF00Change the color of your vehicle successfully at $1000.",thePlayer,255,255,255,true) 
                else 
                    outputChatBox("انت لاتملك المال الكافي.",thePlayer,255,255,255,true) 
                end 
            else 
                outputChatBox("#FF0000You must be a Vehicle.",thePlayer,255,255,255,true) 
            end 
        end 
    ) 
addEvent("engine",true) 
    addEventHandler("engine",root, 
        function () 
            executeCommandHandler( 'engine' ) 
        end 
    ) 
addEvent("lock",true) 
    addEventHandler("lock",root, 
        function () 
            executeCommandHandler( 'lock' ) 
        end 
    ) 
addEvent("light",true) 
    addEventHandler("light",root, 
        function () 
            executeCommandHandler( 'light' ) 
        end 
    ) 

Link to comment
addEvent("fix",true) 
addEventHandler("fix",root, 
    function (thePlayer) 
        local Vehicle = getPedOccupiedVehicle(thePlayer) 
            if Vehicle then 
              if (getPlayerMoney (thePlayer) >= 1000) then 
                fixVehicle ( Vehicle ) 
                takePlayerMoney ( thePlayer, 1000 ) 
                outputChatBox("#00FF00Your vehicle has been fixed at $1000.",thePlayer,255,255,255,true) 
                else 
                outputChatBox("#FF0000انت لاتملك المال الكافي.",thePlayer,255,255,255,true) 
                end 
            else 
                outputChatBox("#FF0000You must be a Vehicle.",thePlayer,255,255,255,true) 
            end 
        end 
    ) 
addEvent("color",true) 
    addEventHandler("color",root, 
        function (thePlayer) 
            local Vehicle = getPedOccupiedVehicle(thePlayer) 
            if Vehicle then 
                if getPlayerMoney (thePlayer) >= 1000 then 
                    local r, g, b = math.random( 255 ), math.random( 255 ), math.random( 255 ) 
                    setVehicleColor( Vehicle, r, g, b ) 
                    takePlayerMoney ( thePlayer, 1000 ) 
                    outputChatBox("#00FF00Change the color of your vehicle successfully at $1000.",thePlayer,255,255,255,true) 
                else 
                    outputChatBox("انت لاتملك المال الكافي.",thePlayer,255,255,255,true) 
                end 
            else 
                outputChatBox("#FF0000You must be a Vehicle.",thePlayer,255,255,255,true) 
            end 
        end 
    ) 
addEvent("engine",true) 
    addEventHandler("engine",root, 
        function (thePlayer) 
            executeCommandHandler( 'engine',thePlayer ) 
        end 
    ) 
addEvent("lock",true) 
    addEventHandler("lock",root, 
        function () 
            executeCommandHandler( 'lock',thePlayer ) 
        end 
    ) 
addEvent("light",true) 
    addEventHandler("light",root, 
        function (thePlayer) 
            executeCommandHandler( 'light',thePlayer ) 
        end 
    ) 

Link to comment
  
GUIEditor = { 
    button = {}, 
    window = {}, 
    label = {} 
} 
addEventHandler("onClientResourceStart", resourceRoot, 
    function() 
        GUIEditor.window[1] = guiCreateWindow(309, 220, 212, 194, "Cars Panel", false) 
        guiWindowSetSizable(GUIEditor.window[1], false) 
  
        fix = guiCreateButton(15, 30, 79, 39, "fix", false, GUIEditor.window[1]) 
        guiSetProperty(GUIEditor.button[1], "NormalTextColour", "FF3B00FF") 
        color = guiCreateButton(113, 30, 79, 39, "color", false, GUIEditor.window[1]) 
        guiSetProperty(GUIEditor.button[2], "NormalTextColour", "FF3B00FF") 
        engine = guiCreateButton(15, 84, 79, 39, "engine", false, GUIEditor.window[1]) 
        guiSetProperty(GUIEditor.button[3], "NormalTextColour", "FF3B00FF") 
        lock = guiCreateButton(113, 84, 79, 39, "lock", false, GUIEditor.window[1]) 
        guiSetProperty(GUIEditor.button[4], "NormalTextColour", "FF3B00FF") 
        light = guiCreateButton(59, 135, 79, 39, "light", false, GUIEditor.window[1]) 
        guiSetProperty(GUIEditor.button[5], "NormalTextColour", "FF3B00FF") 
        GUIEditor.label[1] = guiCreateLabel(8, 140, 46, 22, "Panel By", false, GUIEditor.window[1]) 
        guiLabelSetColor(GUIEditor.label[1], 254, 0, 0) 
        GUIEditor.label[2] = guiCreateLabel(8, 164, 46, 18, "Mr.eKoO", false, GUIEditor.window[1]) 
        guiLabelSetColor(GUIEditor.label[2], 44, 251, 3) 
        GUIEditor.button[6] = guiCreateButton(207, 132, 0, 18, "", false, GUIEditor.window[1]) 
        buttonclose = guiCreateButton(166, 150, 21, 20, "x", false, GUIEditor.window[1])     
    end 
) 
  
open = function() 
   guiSetVisible ( GUIEditor.window[1], not guiGetVisible ( GUIEditor.window[1] ) ) 
   showCursor ( guiGetVisible ( GUIEditor.window[1] ) ) 
end 
bindKey ( "F5", "down", open ) 
  
addEventHandler ( "onClientGUIClick",root, 
function () 
if source == buttonclose then 
    guiSetVisible ( GUIEditor.window[1], false ) 
    showCursor( false ) 
end 
end 
) 
  
    addEventHandler('onClientGUIClick', root, 
    function() 
        if ( source == fix ) then 
            triggerServerEvent("fix",localPlayer,localPlayer) 
        elseif ( source == color ) then 
            triggerServerEvent("color",localPlayer,localPlayer) 
        elseif ( source == engine ) then 
            triggerServerEvent("engine",localPlayer,localPlayer) 
        elseif ( source == lock ) then 
            triggerServerEvent("lock",localPlayer,localPlayer) 
        elseif ( source == light ) then 
            triggerServerEvent("light",localPlayer,localPlayer) 
        end  
    end 
    ) 

Link to comment
GUIEditor = { 
    button = {}, 
    window = {}, 
    label = {} 
} 
addEventHandler("onClientResourceStart", resourceRoot, 
    function() 
        GUIEditor.window[1] = guiCreateWindow(309, 220, 212, 194, "Cars Panel", false) 
        guiWindowSetSizable(GUIEditor.window[1], false) 
  
        fix = guiCreateButton(15, 30, 79, 39, "fix", false, GUIEditor.window[1]) 
        guiSetProperty(fix, "NormalTextColour", "FF3B00FF") 
        color = guiCreateButton(113, 30, 79, 39, "color", false, GUIEditor.window[1]) 
        guiSetProperty(color, "NormalTextColour", "FF3B00FF") 
        engine = guiCreateButton(15, 84, 79, 39, "engine", false, GUIEditor.window[1]) 
        guiSetProperty(engine, "NormalTextColour", "FF3B00FF") 
        lock = guiCreateButton(113, 84, 79, 39, "lock", false, GUIEditor.window[1]) 
        guiSetProperty(lock, "NormalTextColour", "FF3B00FF") 
        light = guiCreateButton(59, 135, 79, 39, "light", false, GUIEditor.window[1]) 
        guiSetProperty(light, "NormalTextColour", "FF3B00FF") 
        GUIEditor.label[1] = guiCreateLabel(8, 140, 46, 22, "Panel By", false, GUIEditor.window[1]) 
        guiLabelSetColor(GUIEditor.label[1], 254, 0, 0) 
        GUIEditor.label[2] = guiCreateLabel(8, 164, 46, 18, "Mr.eKoO", false, GUIEditor.window[1]) 
        guiLabelSetColor(GUIEditor.label[2], 44, 251, 3) 
        GUIEditor.button[6] = guiCreateButton(207, 132, 0, 18, "", false, GUIEditor.window[1]) 
        buttonclose = guiCreateButton(166, 150, 21, 20, "x", false, GUIEditor.window[1])     
    end 
) 
function open(   ) 
   guiSetVisible ( GUIEditor.window[1], not guiGetVisible ( GUIEditor.window[1] ) ) 
   showCursor ( guiGetVisible ( GUIEditor.window[1] ) ) 
end 
bindKey ( "F5", "down", open ) 
  
addEventHandler('onClientGUIClick', root, 
    function() 
        if ( source == fix ) then 
            triggerServerEvent("fix",localPlayer,localPlayer) 
        elseif ( source == color ) then 
            triggerServerEvent("color",localPlayer,localPlayer) 
        elseif ( source == engine ) then 
            triggerServerEvent("engine",localPlayer,localPlayer) 
        elseif ( source == lock ) then 
            triggerServerEvent("lock",localPlayer,localPlayer) 
        elseif ( source == light ) then 
            triggerServerEvent("light",localPlayer,localPlayer) 
        elseif ( source == buttonclose ) then 
            guiSetVisible ( GUIEditor.window[1],false ) 
            showCursor ( false ) 
        end  
    end 
) 

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