Jump to content

Spawn GUI


GerardWay

Recommended Posts

Posted

This Spawn GUI is not showing, I'd appreciate any help, thanks.

client.lua

  
GUIEditor = { 
     
button = {}, 
     
window = {}, 
     
edit = {} 
} 
  
addEventHandler("onClientResourceStart", resourceRoot, 
     
function() 
         
GUIEditor.window[1] = guiCreateWindow(5, 122, 1366, 498, "Backup Server - Spawn System", false) 
         
guiWindowSetSizable(GUIEditor.window[1], false) 
  
         
GUIEditor.button[1] = guiCreateButton(54, 96, 558, 137, "Military", false, GUIEditor.window[1]) 
         
guiSetProperty(GUIEditor.button[1], "NormalTextColour", "FF00FE06") 
         
GUIEditor.button[2] = guiCreateButton(749, 96, 558, 137, "Resistance", false, GUIEditor.window[1]) 
         
guiSetProperty(GUIEditor.button[2], "NormalTextColour", "FFFE0000") 
         
GUIEditor.edit[1] = guiCreateEdit(45, 265, 567, 223, "Players spawned in the Military Class must protect the people of SA from the Zombie Infection.", false, GUIEditor.window[1]) 
         
GUIEditor.edit[2] = guiCreateEdit(744, 260, 567, 223, "Players spawned in the Resistance Class must destroy the Military Troops, and take control of SA.", false, GUIEditor.window[1])     
     
showCursor(true) 
end 
  
) 
  
  
showCursor (false) 
  
addEventHandler("onClientGUIClick", root, 
function() 
  if source == GUIEditor.button[1] then 
    triggerServerEvent("Military", source) 
guiSetVisible(GUIEditor_window[1], false) 
showCursor(false) 
else 
if source == GUIEditor.button[2] then 
triggerServerEvent("Resistance", source) 
guiSetVisible(GUIEditor_window[1], false) 
showCursor(false) 
  
addEvent("setSpawnVisible",true) 
addEventHandler("setSpawnVisible",root, 
function () 
guiSetVisible( GUIEditor_window[1], true ) 
setTimer( function () showCursor( true ) end, 1000,1) 
end 
) 

server.lua

addEvent("Military", true) 
addEventHandler("Military", root, 
function() 
team1 = createTeam ("Military Forces", 0, 255, 0) 
setPlayerTeam (source, team1) 
     
spawnPlayer (source, 207.90919, 1865.12842, 13.14063, 196, 0, 0) 
  
setElementModel (source, 196) 
  
setPlayerNametagColor (source, 0, 255, 0) 
     
fadeCamera (source, true) 
setCameraTarget (source, source) 
  
giveWeapon (source, 28, 2000) 
  
giveWeapon (source, 23, 2000) 
end 
) 
  
addEvent("Resistance", true) 
addEventHandler("Resistance", root, 
function() 
resisteam = createTeam ("Resistances", 255, 0, 0) 
setPlayerTeam (source, resisteam) 
spawnPlayer (source, 1091.63159, 2111.34351, 15.35040, 7, 0, 0) 
outputChatBox ( "You have spawned as a 'Resistance Member'!", source, 255, 0, 0, true ) 
setElementModel (source, 7) 
setPlayerNametagColor (source, 255, 0, 0) 
    fadeCamera (source, true) 
    setCameraTarget (source,source) 
giveWeapon (source, 28, 2000,true) 
giveWeapon (source, 23, 2000) 
end 
) 
  
addEventHandler ( "onPlayerLogin", root, 
addEventHandler ( "onPlayerWasted", root, 
    function ( ) 
        triggerClientEvent ( source, "setSpawnVisible", source, true ) 
    end 
) 
  

560x95_FFFFFF_FF9900_000000_000000.png
Posted
GUIEditor = { 
    
button = {}, 
    
window = {}, 
    
edit = {} 
} 
  
addEventHandler("onClientResourceStart", resourceRoot, 
    
function() 
        
GUIEditor.window[1] = guiCreateWindow(5, 122, 1366, 498, "Backup Server - Spawn System", false) 
        
guiWindowSetSizable(GUIEditor.window[1], false) 
  
        
GUIEditor.button[1] = guiCreateButton(54, 96, 558, 137, "Military", false, GUIEditor.window[1]) 
        
guiSetProperty(GUIEditor.button[1], "NormalTextColour", "FF00FE06") 
        
GUIEditor.button[2] = guiCreateButton(749, 96, 558, 137, "Resistance", false, GUIEditor.window[1]) 
        
guiSetProperty(GUIEditor.button[2], "NormalTextColour", "FFFE0000") 
        
GUIEditor.edit[1] = guiCreateEdit(45, 265, 567, 223, "Players spawned in the Military Class must protect the people of SA from the Zombie Infection.", false, GUIEditor.window[1]) 
        
GUIEditor.edit[2] = guiCreateEdit(744, 260, 567, 223, "Players spawned in the Resistance Class must destroy the Military Troops, and take control of SA.", false, GUIEditor.window[1])     
    
showCursor(true) 
end 
  
) 
  
  
showCursor ( false ) 
  
addEventHandler ( "onClientGUIClick", root, 
    function ( ) 
        if ( source == GUIEditor.button[1] ) then 
            triggerServerEvent ( "Military", localPlayer ) 
            guiSetVisible ( GUIEditor_window[1], false ) 
            showCursor ( false ) 
        elseif ( source == GUIEditor.button[2] ) then 
            triggerServerEvent ( "Resistance", localPlayer ) 
            guiSetVisible ( GUIEditor_window[1], false ) 
            showCursor ( false ) 
        end 
    end 
) 
  
addEvent("setSpawnVisible",true) 
addEventHandler("setSpawnVisible",root, 
function () 
guiSetVisible( GUIEditor_window[1], true ) 
setTimer( function () showCursor( true ) end, 1000,1) 
end 
) 

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted
  
GUIEditor = { 
    
button = {}, 
    
window = {}, 
    
edit = {} 
} 
  
addEventHandler("onClientResourceStart", resourceRoot, 
    
function() 
        
GUIEditor.window[1] = guiCreateWindow(5, 122, 1366, 498, "Backup Server - Spawn System", false) 
  
guiSetVisible( GUIEditor_window[1], false ) 
        
guiWindowSetSizable(GUIEditor.window[1], false) 
  
        
GUIEditor.button[1] = guiCreateButton(54, 96, 558, 137, "Military", false, GUIEditor.window[1]) 
        
guiSetProperty(GUIEditor.button[1], "NormalTextColour", "FF00FE06") 
        
GUIEditor.button[2] = guiCreateButton(749, 96, 558, 137, "Resistance", false, GUIEditor.window[1]) 
        
guiSetProperty(GUIEditor.button[2], "NormalTextColour", "FFFE0000") 
        
GUIEditor.edit[1] = guiCreateEdit(45, 265, 567, 223, "Players spawned in the Military Class must protect the people of SA from the Zombie Infection.", false, GUIEditor.window[1]) 
        
GUIEditor.edit[2] = guiCreateEdit(744, 260, 567, 223, "Players spawned in the Resistance Class must destroy the Military Troops, and take control of SA.", false, GUIEditor.window[1])     
  
addEventHandler("onClientGUIClick", root, 
function() 
  if source == GUIEditor.button[1] then 
    triggerServerEvent("Military", source) 
    guiSetVisible(GUIEditor_window[1], false) 
   showCursor(false) 
  elseif source == GUIEditor.button[2] then 
    triggerServerEvent("Resistance", source) 
    guiSetVisible(GUIEditor_window[1], false) 
    showCursor(false) 
  end 
 end) 
  
end  
) 
  
  
addEvent("setSpawnVisible",true) 
  
addEventHandler("setSpawnVisible",root, 
function () 
guiSetVisible( GUIEditor_window[1], true ) 
setTimer( function () showCursor( true ) end, 1000,1) 
end 
) 

Did not test it tho.

Posted

-- client side:

GUIEditor = { 
    button = { }, 
    window = { }, 
    edit = { } 
} 
  
addEventHandler ( "onClientResourceStart", resourceRoot, 
        function ( ) 
        GUIEditor.window[1] = guiCreateWindow(5, 122, 1366, 498, "Backup Server - Spawn System", false) 
        guiSetVisible ( GUIEditor.window[1], false ) 
        guiWindowSetSizable(GUIEditor.window[1], false) 
        GUIEditor.button[1] = guiCreateButton(54, 96, 558, 137, "Military", false, GUIEditor.window[1]) 
        guiSetProperty(GUIEditor.button[1], "NormalTextColour", "FF00FE06") 
        GUIEditor.button[2] = guiCreateButton(749, 96, 558, 137, "Resistance", false, GUIEditor.window[1]) 
        guiSetProperty(GUIEditor.button[2], "NormalTextColour", "FFFE0000")        
        GUIEditor.edit[1] = guiCreateEdit(45, 265, 567, 223, "Players spawned in the Military Class must protect the people of SA from the Zombie Infection.", false, GUIEditor.window[1]) 
        GUIEditor.edit[2] = guiCreateEdit(744, 260, 567, 223, "Players spawned in the Resistance Class must destroy the Military Troops, and take control of SA.", false, GUIEditor.window[1])     
    end 
) 
  
addEventHandler ( "onClientGUIClick", root, 
    function ( ) 
        if ( source == GUIEditor.button[1] ) then 
            triggerServerEvent ( "Military", localPlayer ) 
            guiSetVisible ( GUIEditor_window[1], false ) 
            showCursor ( false ) 
        elseif ( source == GUIEditor.button[2] ) then 
            triggerServerEvent ( "Resistance", localPlayer ) 
            guiSetVisible ( GUIEditor_window[1], false ) 
            showCursor ( false ) 
        end 
    end 
) 
  
addEvent ( "setSpawnVisible", true ) 
addEventHandler ( "setSpawnVisible",root, 
    function ( ) 
        guiSetVisible ( GUIEditor_window[1], true ) 
        setTimer ( 
            function ( ) 
                showCursor ( true ) 
            end 
            ,1000, 1 
        ) 
    end 
) 

-- server side:

addEvent("Military", true) 
addEventHandler("Military", root, 
function() 
team1 = createTeam ("Military Forces", 0, 255, 0) 
setPlayerTeam (source, team1) 
    
spawnPlayer (source, 207.90919, 1865.12842, 13.14063, 196, 0, 0) 
  
setElementModel (source, 196) 
  
setPlayerNametagColor (source, 0, 255, 0) 
    
fadeCamera (source, true) 
setCameraTarget (source, source) 
  
giveWeapon (source, 28, 2000) 
  
giveWeapon (source, 23, 2000) 
end 
) 
  
addEvent("Resistance", true) 
addEventHandler("Resistance", root, 
function() 
resisteam = createTeam ("Resistances", 255, 0, 0) 
setPlayerTeam (source, resisteam) 
spawnPlayer (source, 1091.63159, 2111.34351, 15.35040, 7, 0, 0) 
outputChatBox ( "You have spawned as a 'Resistance Member'!", source, 255, 0, 0, true ) 
setElementModel (source, 7) 
setPlayerNametagColor (source, 255, 0, 0) 
    fadeCamera (source, true) 
    setCameraTarget (source,source) 
giveWeapon (source, 28, 2000,true) 
giveWeapon (source, 23, 2000) 
end 
) 
  
function showSpawn ( ) 
    triggerClientEvent ( source, "setSpawnVisible", source, true ) 
end 
addEventHandler ( "onPlayerWasted", root, showSpawn ) 
addEventHandler ( "onPlayerLogin", root, showSpawn ) 

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

Any errors on the server side?

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

Nope, there was a malformed number error in Client, but it was because there was a 'c' next to one of the numbers, must have been put in there by mistake, still didn't fix anything though

560x95_FFFFFF_FF9900_000000_000000.png
Posted
addEvent ( "setSpawnVisible", true ) 
addEventHandler ( "setSpawnVisible",root, 
    function ( state ) 
        guiSetVisible ( GUIEditor.window[1], state ) -- You had put 'GUIEditor_Window' 
        setTimer ( 
            function ( ) 
                showCursor ( state ) 
            end 
            ,1000, 1 
        ) 
    end 
) 

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

What do you mean by nothing? I tested it and it works fine, it shows the spawn when I die.

Post the client side script.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

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