Jump to content

[HELP][WIP] Train driver job


Recommended Posts

  • 2 weeks later...
  • 2 weeks later...

--SERVER

local jobMarker = createMarker (1942.57, 2184.79, 9.82, "cylinder", 1, 255, 0, 0, 127) 
  
local team = createTeam ( "Conductori de Locomotiva",255,255,0 ); 
  
addEventHandler ("onMarkerHit", jobMarker, 
function  (hitPlayer) 
  if (getElementType(hitPlayer) == "player") then 
    triggerClientEvent ("viewGUI",source) 
    outputChatBox ("Bun venit la gara Romana CFR.", hitPlayer, 255, 0, 0) 
  end 
end 
) 
  
addEvent("onAskToSetTeamAndSkin",true); 
addEventHandler("onAskToSetTeamAndSkin",root, function () 
spawnPlayer(source,-1937.09765625, 161.8310546875, 26.273441314697,0,61,0,0,team); 
        end 
); 

--CLIENT

GUIEditor = { 
    memo = {}, 
    button = {}, 
    window = {}, 
    radiobutton = {}, 
    tab = {}, 
    label = {}, 
    tabpanel = {}, 
} 
addEventHandler("onClientResourceStart", resourceRoot, 
    function() 
        GUIEditor.window[1] = guiCreateWindow(684, 215, 491, 334, "CFR - Sofer De Tren", false) 
            guiSetVisible ( GUIEditor.window[1], false ) 
        guiWindowSetSizable(GUIEditor.window[1], false) 
        guiSetAlpha(GUIEditor.window[1], 0.75) 
  
        GUIEditor.button[1] = guiCreateButton(52, 169, 136, 65, "Angajeaza-te", false, GUIEditor.window[1]) 
        guiSetFont(GUIEditor.button[1], "default-bold-small") 
        GUIEditor.button[2] = guiCreateButton(299, 169, 136, 65, "Demisioneaza", false, GUIEditor.window[1]) 
        guiSetFont(GUIEditor.button[2], "default-bold-small") 
        GUIEditor.button[3] = guiCreateButton(299, 259, 136, 65, "Închide", false, GUIEditor.window[1]) 
        guiSetFont(GUIEditor.button[3], "default-bold-small") 
        GUIEditor.memo[1] = guiCreateMemo(206, 180, 76, 85, "", false, GUIEditor.window[1]) 
        GUIEditor.label[1] = guiCreateLabel(252, 119, 70, 54, "", false, GUIEditor.window[1]) 
        GUIEditor.memo[2] = guiCreateMemo(46, 35, 393, 124, "                              Bun venit la gara CFR!\nCautamt conductori de locomotiva, tot ce trebuie sa faci este sa conduci trenul si sa iei pasageri. Ia o colomotiva, o poti gasii pe sine, si incepeti slujba.\n\n                                                   Mult Succes!", false, GUIEditor.window[1]) 
        guiMemoSetReadOnly(GUIEditor.memo[2], true) 
  
        GUIEditor.tabpanel[1] = guiCreateTabPanel(178, 196, 60, 57, false, GUIEditor.memo[2]) 
  
        GUIEditor.tab[1] = guiCreateTab("Tab", GUIEditor.tabpanel[1]) 
  
  
        GUIEditor.radiobutton[1] = guiCreateRadioButton(191, 271, 75, 44, "", false, GUIEditor.window[1]) 
        guiRadioButtonSetSelected(GUIEditor.radiobutton[1], true)     
    end 
) 
  
addEvent ("viewGUI", true) 
addEventHandler( "viewGUI" , root, 
function  () 
            guiSetVisible ( GUIEditor.window[1], true ) 
            showCursor ( true ) 
    end 
) 
  
addEventHandler("onClientGUIClick", root, 
function() 
if ( source == GUIEditor.button[3] ) then 
guiSetVisible(GUIEditor.window[1], false) 
showCursor(false) 
end 
end 
) 
  
addEventHandler("onClientGUIClick",GUIEditor.button[1], 
function () 
triggerServerEvent("onAskToSetTeamAndSkin",localPlayer); 
       end 
); 

Sorry for the late post, but I had a virus and I had to reinstall my windows.

PS: I am a bit scared that people will steal the code, what can I do to protect it? :/

Link to comment

why you put the

addEventHandler ("onMarkerHit", jobMarker, 
function  (hitPlayer) 
  if (getElementType(hitPlayer) == "player") then 
    triggerClientEvent ("viewGUI",source) 
    outputChatBox ("Bun venit la gara Romana CFR.", hitPlayer, 255, 0, 0) 
  end 
end 
) 

in the serverside,, put it in the clientside , and you wil be discard the

triggerClientEvent 

Link to comment

clientside

  
GUIEditor = { 
    memo = {}, 
    button = {}, 
    window = {}, 
    radiobutton = {}, 
    tab = {}, 
    label = {}, 
    tabpanel = {}, 
} 
addEventHandler("onClientResourceStart", resourceRoot, 
    function() 
        GUIEditor.window[1] = guiCreateWindow(684, 215, 491, 334, "CFR - Sofer De Tren", false) 
            guiSetVisible ( GUIEditor.window[1], false ) 
        guiWindowSetSizable(GUIEditor.window[1], false) 
        guiSetAlpha(GUIEditor.window[1], 0.75) 
  
        GUIEditor.button[1] = guiCreateButton(52, 169, 136, 65, "Angajeaza-te", false, GUIEditor.window[1]) 
        guiSetFont(GUIEditor.button[1], "default-bold-small") 
        GUIEditor.button[2] = guiCreateButton(299, 169, 136, 65, "Demisioneaza", false, GUIEditor.window[1]) 
        guiSetFont(GUIEditor.button[2], "default-bold-small") 
        GUIEditor.button[3] = guiCreateButton(299, 259, 136, 65, "Închide", false, GUIEditor.window[1]) 
        guiSetFont(GUIEditor.button[3], "default-bold-small") 
        GUIEditor.memo[1] = guiCreateMemo(206, 180, 76, 85, "", false, GUIEditor.window[1]) 
        GUIEditor.label[1] = guiCreateLabel(252, 119, 70, 54, "", false, GUIEditor.window[1]) 
        GUIEditor.memo[2] = guiCreateMemo(46, 35, 393, 124, "                              Bun venit la gara CFR!\nCautamt conductori de locomotiva, tot ce trebuie sa faci este sa conduci trenul si sa iei pasageri. Ia o colomotiva, o poti gasii pe sine, si incepeti slujba.\n\n                                                   Mult Succes!", false, GUIEditor.window[1]) 
        guiMemoSetReadOnly(GUIEditor.memo[2], true) 
  
        GUIEditor.tabpanel[1] = guiCreateTabPanel(178, 196, 60, 57, false, GUIEditor.memo[2]) 
  
        GUIEditor.tab[1] = guiCreateTab("Tab", GUIEditor.tabpanel[1]) 
  
  
        GUIEditor.radiobutton[1] = guiCreateRadioButton(191, 271, 75, 44, "", false, GUIEditor.window[1]) 
        guiRadioButtonSetSelected(GUIEditor.radiobutton[1], true)     
    end 
) 
  
local jobMarker = createMarker (1942.57, 2184.79, 9.82, "cylinder", 1, 255, 0, 0, 127) 
 addEventHandler ("onMarkerHit", jobMarker, 
function  (hitPlayer) 
  if (getElementType(hitPlayer) == "player") then 
    outputChatBox ("Bun venit la gara Romana CFR.", hitPlayer, 255, 0, 0) 
    guiSetVisible ( GUIEditor.window[1], true ) 
    howCursor ( true ) 
  end 
end 
) 
  
  
addEventHandler("onClientGUIClick", root, 
function() 
if ( source == GUIEditor.button[3] ) then 
guiSetVisible(GUIEditor.window[1], false) 
showCursor(false) 
end 
end 
) 
  
addEventHandler("onClientGUIClick",GUIEditor.button[1], 
function () 
triggerServerEvent("onAskToSetTeamAndSkin",localPlayer); 
       end 
); 

serverside

local jobMarker = createMarker (1942.57, 2184.79, 9.82, "cylinder", 1, 255, 0, 0, 127) 
  
local team = createTeam ( "Conductori de Locomotiva",255,255,0 ); 
  
  
addEvent("onAskToSetTeamAndSkin",true); 
addEventHandler("onAskToSetTeamAndSkin",root, function () 
spawnPlayer(source,-1937.09765625, 161.8310546875, 26.273441314697,0,61,0,0,team); 
        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...