Jump to content

onPlayerLogin showgui&dx


toptional

Recommended Posts

Posted

WIth this script, i'm trying to get when a player logs in to the server the gui and the dx line and dx text shows

It's not working getting no errors

addEventHandler("onPlayerLogin", root, 
    function() 
        GUIEditor.window[1] = guiCreateWindow(0, 0, 763, 741, "Zombie Apocalypse Spawn Menu", true) 
        guiWindowSetSizable(GUIEditor.window[1], true) 
        guiSetAlpha(GUIEditor.window[1], 1.00) 
  
        GUIEditor.edit[1] = guiCreateEdit(1008, 588, 322, 137, "Class Information:", true, GUIEditor.window[1]) 
        guiSetProperty(GUIEditor.edit[1], "NormalTextColour", "FFAB0000") 
        guiEditSetReadOnly(GUIEditor.edit[1], true) 
        GUIEditor.button[2] = guiCreateButton(152, 626, 455, 105, "Spawn", true, GUIEditor.window[1]) 
        guiSetFont(GUIEditor.button[2], "sa-gothic")     
        addEventHandler("onClientRender", root, 
    function  ()  
        dxDrawText("Class", 518, 99, 671, 144, tocolor(255, 255, 255, 255), 2, "pricedown", "left", "top", false, false, true, false, false) 
        dxDrawText("", 615, 411, 618, 411, tocolor(255, 255, 255, 255), 2, "default", "left", "top", false, false, true, false, false) 
        dxDrawText("Category", 51, 89, 255, 158, tocolor(255, 255, 255, 255), 2, "pricedown", "left", "top", false, false, true, false, false) 
        dxDrawLine(391, 71, 391, 626, tocolor(255, 255, 255, 255), 1, true) 
    end 
) 
  
    end 
) 
  
  
  

Posted

onPlayerLogin is serverside.

If you need an Intermediate scripter feel free to PM me as I will accept "almost" any job, STATUS: UNAVAILABLE

SCOTLAND, my hometown, and the Home of GTA!

Posted

Server

  
  
addEventHandler( 'onPlayerLogin', root,  
    function( _, acc ) 
            triggerClientEvent(source,"ShowLoginWindow",source) 
    end  
) 
  
  
  

Client

  
  
GUIEditor = { 
window = {}, 
edit = {}, 
button = {}, 
} 
  
GUIEditor.window[1] = guiCreateWindow(0, 0, 763, 741, "Zombie Apocalypse Spawn Menu", true) 
guiWindowSetSizable(GUIEditor.window[1], true) 
guiSetAlpha(GUIEditor.window[1], 1.00) 
GUIEditor.edit[1] = guiCreateEdit(1008, 588, 322, 137, "Class Information:", true, GUIEditor.window[1]) 
guiSetProperty(GUIEditor.edit[1], "NormalTextColour", "FFAB0000") 
guiEditSetReadOnly(GUIEditor.edit[1], true) 
GUIEditor.button[2] = guiCreateButton(152, 626, 455, 105, "Spawn", true, GUIEditor.window[1]) 
guiSetFont(GUIEditor.button[2], "sa-gothic")   
guiSetVisible(GUIEditor.window[1], not guiGetVisible(GUIEditor.window[1])) 
         
addEvent("ShowLoginWindow", true) 
addEventHandler("ShowLoginWindow", root, 
    function()       
        guiSetVisible(GUIEditor.window[1], not guiGetVisible(GUIEditor.window[1])) 
        showCursor(guiGetVisible(GUIEditor.window[1])) 
    end 
) 
  
addEventHandler("onClientRender", root, 
    function  () 
        dxDrawText("Class", 518, 99, 671, 144, tocolor(255, 255, 255, 255), 2, "pricedown", "left", "top", false, false, true, false, false) 
        dxDrawText("", 615, 411, 618, 411, tocolor(255, 255, 255, 255), 2, "default", "left", "top", false, false, true, false, false) 
        dxDrawText("Category", 51, 89, 255, 158, tocolor(255, 255, 255, 255), 2, "pricedown", "left", "top", false, false, true, false, false) 
        dxDrawLine(391, 71, 391, 626, tocolor(255, 255, 255, 255), 1, true) 
    end 
) 
  
  

Welcom to my server Q.5

Current game type in my server Drift

350x20_FFFFFF_FFFFFF_000000_000000.png

my Email : [email protected]

Programming level: 90%

Posted
Server
  
  
addEventHandler( 'onPlayerLogin', root,  
    function( _, acc ) 
            triggerClientEvent(source,"ShowLoginWindow",source) 
    end  
) 
  
  
  

Client

  
  
GUIEditor = { 
window = {}, 
edit = {}, 
button = {}, 
} 
  
GUIEditor.window[1] = guiCreateWindow(0, 0, 763, 741, "Zombie Apocalypse Spawn Menu", true) 
guiWindowSetSizable(GUIEditor.window[1], true) 
guiSetAlpha(GUIEditor.window[1], 1.00) 
GUIEditor.edit[1] = guiCreateEdit(1008, 588, 322, 137, "Class Information:", true, GUIEditor.window[1]) 
guiSetProperty(GUIEditor.edit[1], "NormalTextColour", "FFAB0000") 
guiEditSetReadOnly(GUIEditor.edit[1], true) 
GUIEditor.button[2] = guiCreateButton(152, 626, 455, 105, "Spawn", true, GUIEditor.window[1]) 
guiSetFont(GUIEditor.button[2], "sa-gothic")   
guiSetVisible(GUIEditor.window[1], not guiGetVisible(GUIEditor.window[1])) 
         
addEvent("ShowLoginWindow", true) 
addEventHandler("ShowLoginWindow", root, 
    function()       
        guiSetVisible(GUIEditor.window[1], not guiGetVisible(GUIEditor.window[1])) 
        showCursor(guiGetVisible(GUIEditor.window[1])) 
    end 
) 
  
addEventHandler("onClientRender", root, 
    function  () 
        dxDrawText("Class", 518, 99, 671, 144, tocolor(255, 255, 255, 255), 2, "pricedown", "left", "top", false, false, true, false, false) 
        dxDrawText("", 615, 411, 618, 411, tocolor(255, 255, 255, 255), 2, "default", "left", "top", false, false, true, false, false) 
        dxDrawText("Category", 51, 89, 255, 158, tocolor(255, 255, 255, 255), 2, "pricedown", "left", "top", false, false, true, false, false) 
        dxDrawLine(391, 71, 391, 626, tocolor(255, 255, 255, 255), 1, true) 
    end 
) 
  
  

Thanks but the dxDrawLine and dxDrawText shows as soon as the resource starts, but the gui stuff shows when you login

Posted

Thats because you have onClientRender, change that.

If you need an Intermediate scripter feel free to PM me as I will accept "almost" any job, STATUS: UNAVAILABLE

SCOTLAND, my hometown, and the Home of GTA!

Posted
  
GUIEditor = { 
window = {}, 
edit = {}, 
button = {}, 
} 
  
GUIEditor.window[1] = guiCreateWindow(0, 0, 763, 741, "Zombie Apocalypse Spawn Menu", true) 
guiWindowSetSizable(GUIEditor.window[1], true) 
guiSetAlpha(GUIEditor.window[1], 1.00) 
GUIEditor.edit[1] = guiCreateEdit(1008, 588, 322, 137, "Class Information:", true, GUIEditor.window[1]) 
guiSetProperty(GUIEditor.edit[1], "NormalTextColour", "FFAB0000") 
guiEditSetReadOnly(GUIEditor.edit[1], true) 
GUIEditor.button[2] = guiCreateButton(152, 626, 455, 105, "Spawn", true, GUIEditor.window[1]) 
guiSetFont(GUIEditor.button[2], "sa-gothic")   
guiSetVisible(GUIEditor.window[1], not guiGetVisible(GUIEditor.window[1])) 
        
addEvent("ShowLoginWindow", true) 
addEventHandler("ShowLoginWindow", root, 
    function()      
        guiSetVisible(GUIEditor.window[1], not guiGetVisible(GUIEditor.window[1])) 
        showCursor(guiGetVisible(GUIEditor.window[1])) 
    end 
) 
  
function showRender() 
    dxDrawText("Class", 518, 99, 671, 144, tocolor(255, 255, 255, 255), 2, "pricedown", "left", "top", false, false, true, false, false) 
    dxDrawText("", 615, 411, 618, 411, tocolor(255, 255, 255, 255), 2, "default", "left", "top", false, false, true, false, false) 
    dxDrawText("Category", 51, 89, 255, 158, tocolor(255, 255, 255, 255), 2, "pricedown", "left", "top", false, false, true, false, false) 
    dxDrawLine(391, 71, 391, 626, tocolor(255, 255, 255, 255), 1, true) 
end 
  
  
  

Use this

  
  
addEventHandler("onClientRender", root showRender) --- To show dx 
removeEventHandler("onClientRender", root showRender) --- to remvoe 

Welcom to my server Q.5

Current game type in my server Drift

350x20_FFFFFF_FFFFFF_000000_000000.png

my Email : [email protected]

Programming level: 90%

Posted
Thats because you have onClientRender, change that.

dxText needs onClientRender

I know, I mean change that just like the way MR.S3D has done.

If you need an Intermediate scripter feel free to PM me as I will accept "almost" any job, STATUS: UNAVAILABLE

SCOTLAND, my hometown, and the Home of GTA!

Posted
I'm rather confused, mind putting it all together?

Do you wan't it shown when the Login, or join for the dxDrawText?

If you need an Intermediate scripter feel free to PM me as I will accept "almost" any job, STATUS: UNAVAILABLE

SCOTLAND, my hometown, and the Home of GTA!

Posted
addEventHandler("onClientRender", root showRender) --- To show dx 
removeEventHandler("onClientRender", root showRender) --- to remvoe  dx 

Welcom to my server Q.5

Current game type in my server Drift

350x20_FFFFFF_FFFFFF_000000_000000.png

my Email : [email protected]

Programming level: 90%

Posted
I'm rather confused, mind putting it all together?

Do you wan't it shown when the Login, or join for the dxDrawText?

i want the dx stuff the gui stuff all to show when the player logins!

Posted

-- client side:

GUIEditor = { 
window = {}, 
edit = {}, 
button = {}, 
} 
  
GUIEditor.window[1] = guiCreateWindow(0, 0, 763, 741, "Zombie Apocalypse Spawn Menu", true) 
guiWindowSetSizable(GUIEditor.window[1], true) 
guiSetAlpha(GUIEditor.window[1], 1.00) 
GUIEditor.edit[1] = guiCreateEdit(1008, 588, 322, 137, "Class Information:", true, GUIEditor.window[1]) 
guiSetProperty(GUIEditor.edit[1], "NormalTextColour", "FFAB0000") 
guiEditSetReadOnly(GUIEditor.edit[1], true) 
GUIEditor.button[2] = guiCreateButton(152, 626, 455, 105, "Spawn", true, GUIEditor.window[1]) 
guiSetFont(GUIEditor.button[2], "sa-gothic")   
guiSetVisible(GUIEditor.window[1], not guiGetVisible(GUIEditor.window[1])) 
        
addEvent("showSpawnWindow", true) 
addEventHandler("showSpawnWindow", root, 
    function()     
        guiSetVisible(GUIEditor.window[1], true) 
        showCursor(true) 
        addEventHandler("onClientRender", root, showRender) 
    end 
) 
  
function showRender() 
    dxDrawText("Class", 518, 99, 671, 144, tocolor(255, 255, 255, 255), 2, "pricedown", "left", "top", false, false, true, false, false) 
    dxDrawText("", 615, 411, 618, 411, tocolor(255, 255, 255, 255), 2, "default", "left", "top", false, false, true, false, false) 
    dxDrawText("Category", 51, 89, 255, 158, tocolor(255, 255, 255, 255), 2, "pricedown", "left", "top", false, false, true, false, false) 
    dxDrawLine(391, 71, 391, 626, tocolor(255, 255, 255, 255), 1, true) 
end 

-- server side:

addEventHandler ( "onPlayerLogin", root, 
    function ( ) 
        triggerClientEvent ( source, "showSpawnWindow", source ) 
    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

I get these 2 errors

WARNING : Loading scripted failed AP_Spawn\client.lua:22: ')' expected near 'showRender'

ERROR: server triggered clientside event showSpawnWindow, but event is not added clientside

Posted

Copy the client side again.

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

You're welcome.

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