Jump to content

wtf???help tiggerClientEvent


golanu21

Recommended Posts

local Key = "0" 

-- this is the key

client Side

--start window 
addEvent("GUI", true) 
function caine () 
            guiSetVisible(fereastra, true) 
            showCursor(true) 
             guiLabelSetColor(GUIEditor.label[5],math.random(0, 255), math.random(0, 255), math.random(0, 255)) 
end 
addEventHandler("GUI", root, caine) 
bindKey("Key","down", caine) 

server side

--adminsOnly 
addEventHandler( 'onPlayerLogin', root,  
function(  ) 
    if isObjectInACLGroup( 'user.'..getAccountName( acc ), aclGetGroup( "Admin" ) ) then 
        triggerClientEvent(source, "GUI", source) 
    else 
        outputChatBox("You are not an admin") 
    end 
end 
) 

no errors in debugscript

don't work

[14:13:07] WARNING: Gamemode\vehicles\server.lua:4: Bad argument @ 'getAccountName' [Expected account at argument 1, got nil] 
[14:13:07] ERROR: Gamemode\vehicles\server.lua:4: attempt to concatenate a boolean value 

Link to comment

-- Client --

  
bindKey (Key, "down", 
    function() 
        if getElementData( localPlayer, 'Show_GUI') ~= nil then  
            guiSetVisible(fereastra, not guiGetVisible(fereastra)) 
            showCursor(guiGetVisible(fereastra)) 
        end 
    end  
) 
  
addEvent( 'LogOutSetVisible', true ) 
addEventHandler( 'LogOutSetVisible', root,  
function() 
    if guiGetVisible(fereastra) then 
        guiSetVisible( fereastra, false ) 
        showCursor( false ) 
    end  
end 
) 

-- Server --

addEventHandler ( "onResourceStart", resourceRoot, 
    function ( ) 
                for i, player in ipairs( getElementsByType( 'player' ) ) do 
            if isObjectInACLGroup( 'user.'..getAccountName( getPlayerAccount( player ) ), aclGetGroup( "allowedGroup" ) ) then 
                setElementData( player, 'Show_GUI', true) 
            else 
                setElementData( player, 'Show_GUI', nil) 
            end 
        end  
end 
) 
  
  
addEventHandler( 'onPlayerJoin', root, function() 
    setElementData( source, 'Show_GUI', nil) 
end 
 ) 
  
addEventHandler( 'onPlayerLogin', root, function( _, acc ) 
    if isObjectInACLGroup( 'user.'..getAccountName( acc ), aclGetGroup( allowedGroup ) ) then 
        setElementData( source, 'Show_GUI', true) 
    else 
        setElementData( source, 'Show_GUI', nil)     
    end 
end 
) 
addEventHandler( 'onPlayerLogout', root, function( _, acc ) 
    triggerClientEvent( source, 'LogOutSetVisible', root) 
    setElementData( source, 'Show_GUI', nil)  
end  
) 

Try it -_-"

Link to comment
--adminsOnly 
addEventHandler( 'onPlayerLogin', root, 
function( _, acc ) 
    if isObjectInACLGroup( 'user.'..acc, aclGetGroup( "Admin" ) ) then 
        triggerClientEvent(source, "GUI", source) 
    else 
        outputChatBox("You are not an admin", source) 
    end 
end 
) 

Link to comment
--adminsOnly 
addEventHandler( 'onPlayerLogin', root, 
function( _, acc ) 
    if isObjectInACLGroup( 'user.'..acc, aclGetGroup( "Admin" ) ) then 
        triggerClientEvent(source, "GUI", source) 
    else 
        outputChatBox("You are not an admin", source) 
    end 
end 
) 

addEventHandler( 'onPlayerLogin', root, 
    function( _, acc ) 
        if isObjectInACLGroup( 'user.'..getAccountName ( acc ), aclGetGroup( "Admin" ) ) then 
            triggerClientEvent(source, "GUI", source) 
        else 
            outputChatBox("You are not an admin", source) 
        end 
    end 
) 

NOTE : this will make the GUI appear to an Admin when he loges in !, Better use Mr.Pres[T]ege code ..

Link to comment
-- Client --

  
bindKey (Key, "down", 
    function() 
        if getElementData( localPlayer, 'Show_GUI') ~= nil then  
            guiSetVisible(fereastra, not guiGetVisible(fereastra)) 
            showCursor(guiGetVisible(fereastra)) 
        end 
    end  
) 
  
addEvent( 'LogOutSetVisible', true ) 
addEventHandler( 'LogOutSetVisible', root,  
function() 
    if guiGetVisible(fereastra) then 
        guiSetVisible( fereastra, false ) 
        showCursor( false ) 
    end  
end 
) 

-- Server --

addEventHandler ( "onResourceStart", resourceRoot, 
    function ( ) 
                for i, player in ipairs( getElementsByType( 'player' ) ) do 
            if isObjectInACLGroup( 'user.'..getAccountName( getPlayerAccount( player ) ), aclGetGroup( "allowedGroup" ) ) then 
                setElementData( player, 'Show_GUI', true) 
            else 
                setElementData( player, 'Show_GUI', nil) 
            end 
        end  
end 
) 
  
  
addEventHandler( 'onPlayerJoin', root, function() 
    setElementData( source, 'Show_GUI', nil) 
end 
 ) 
  
addEventHandler( 'onPlayerLogin', root, function( _, acc ) 
    if isObjectInACLGroup( 'user.'..getAccountName( acc ), aclGetGroup( allowedGroup ) ) then 
        setElementData( source, 'Show_GUI', true) 
    else 
        setElementData( source, 'Show_GUI', nil)     
    end 
end 
) 
addEventHandler( 'onPlayerLogout', root, function( _, acc ) 
    triggerClientEvent( source, 'LogOutSetVisible', root) 
    setElementData( source, 'Show_GUI', nil)  
end  
) 

Try it -_-"

i use your code... but BAD ARGUMENT:20: @ aclGetGroup( allowedGroup ) -- SERVER SIDE

Link to comment
Make it a string :
( 'allowedGroup' ) 

Sorry -_- :

addEventHandler ( "onResourceStart", resourceRoot, 
    function ( ) 
                for i, player in ipairs( getElementsByType( 'player' ) ) do 
            if isObjectInACLGroup( 'user.'..getAccountName( getPlayerAccount( player ) ), aclGetGroup( "Admin" ) ) then 
                setElementData( player, 'Show_GUI', true) 
            else 
                setElementData( player, 'Show_GUI', nil) 
            end 
        end  
end 
) 
  
  
addEventHandler( 'onPlayerJoin', root, function() 
    setElementData( source, 'Show_GUI', nil) 
end 
 ) 
  
addEventHandler( 'onPlayerLogin', root, function( _, acc ) 
    if isObjectInACLGroup( 'user.'..getAccountName( acc ), aclGetGroup( "Admin" ) ) then 
        setElementData( source, 'Show_GUI', true) 
    else 
        setElementData( source, 'Show_GUI', nil)     
    end 
end 
) 
addEventHandler( 'onPlayerLogout', root, function( _, acc ) 
    triggerClientEvent( source, 'LogOutSetVisible', root) 
    setElementData( source, 'Show_GUI', nil)  
end  
) 
  

Link to comment

clientside

--gui 
GUIEditor = { 
    label = {}, 
} 
fereastra = guiCreateWindow(773, 239, 607, 576, "Admin Panel", false) 
guiWindowSetSizable(fereastra, false) 
  
Close = guiCreateButton(415, 475, 183, 92, "Close", false, fereastra) 
guiSetProperty(Close, "NormalTextColour", "FFAAAAAA") 
pos = guiCreateGridList(9, 357, 239, 210, false, fereastra) 
poscol = guiGridListAddColumn(pos, "Posibilites", 0.9) 
kick = guiCreateGridList(10, 145, 238, 211, false, fereastra) 
guiGridListAddColumn(kick, "Kick Player", 0.9) 
kickbtn = guiCreateButton(248, 145, 124, 59, "Kick Him", false, fereastra) 
guiSetProperty(kick, "NormalTextColour", "FFAAAAAA") 
set = guiCreateButton(250, 427, 134, 59, "set", false, fereastra) 
guiSetProperty(set, "NormalTextColour", "FFAAAAAA") 
ban = guiCreateButton(248, 298, 124, 58, "Ban Him", false, fereastra) 
guiSetProperty(ban, "NormalTextColour", "FFAAAAAA") 
freeze = guiCreateButton(248, 204, 124, 94, "Freeze Him", false, fereastra) 
guiSetProperty(freeze, "NormalTextColour", "FFAAAAAA") 
vehicles = guiCreateGridList(379, 145, 219, 208, false, fereastra) 
guiGridListAddColumn(vehicles, "Vehicles", 0.9) 
giveveh = guiCreateButton(426, 356, 144, 55, "Give", false, fereastra) 
guiSetProperty(giveveh, "NormalTextColour", "FFAAAAAA") 
GUIEditor.label[1] = guiCreateLabel(9, 21, 36, 15, "Name:", false, fereastra) 
GUIEditor.label[2] = guiCreateLabel(10, 42, 39, 15, "Health:", false, fereastra) 
GUIEditor.label[3] = guiCreateLabel(10, 62, 44, 15, "Armour:", false, fereastra) 
GUIEditor.label[5] = guiCreateLabel(248, 50, 326, 57, "Admin Panel", false, fereastra) 
guiSetFont(GUIEditor.label[5], "sa-header") 
guiLabelSetColor(GUIEditor.label[5], 0, 0, 0) 
numele = guiCreateLabel(46, 21, 120, 15, "", false, fereastra) 
viata = guiCreateLabel(49, 42, 117, 15, "", false, fereastra) 
armura = guiCreateLabel(59, 62, 114, 15, "", false, fereastra) 
  
  
guiSetVisible(fereastra, false ) 
  
  
-- Script -- 
  
--close button 
addEventHandler("onClientGUIClick",Close, 
function () 
    guiSetVisible(fereastra, false ) 
    showCursor(false) 
end 
) 
--start window 
bindKey ("0", "down", 
    function() 
        if getElementData( localPlayer, 'Show_GUI') ~= nil then  
            guiSetVisible(fereastra, not guiGetVisible(fereastra)) 
            showCursor(guiGetVisible(fereastra)) 
        end 
    end  
) 
  
addEvent( 'LogOutSetVisible', true ) 
addEventHandler( 'LogOutSetVisible', root, 
function() 
    if guiGetVisible(fereastra) then 
        guiSetVisible( fereastra, false ) 
        showCursor( false ) 
    end  
end 
) 

serverside

--adminsOnly 
addEventHandler ( "onResourceStart", resourceRoot, 
    function ( ) 
                for i, player in ipairs( getElementsByType( 'player' ) ) do 
            if isObjectInACLGroup( 'user.'..getAccountName( getPlayerAccount( player ) ), aclGetGroup( "Admin" ) ) then 
                setElementData( player, 'Show_GUI', true) 
            else 
                setElementData( player, 'Show_GUI', nil) 
            end 
        end 
end 
) 
  
  
addEventHandler( 'onPlayerJoin', root, function() 
    setElementData( source, 'Show_GUI', nil) 
end 
 ) 
  
addEventHandler( 'onPlayerLogin', root, function( _, acc ) 
    if isObjectInACLGroup( 'user.'..getAccountName( acc ), aclGetGroup( "Admin" ) ) then 
       setElementData( source, 'Show_GUI', true) 
   else 
       setElementData( source, 'Show_GUI', nil)     
   end 
end 
) 
addEventHandler( 'onPlayerLogout', root, function( _, acc ) 
   triggerClientEvent( source, 'LogOutSetVisible', root) 
   setElementData( source, 'Show_GUI', nil) 
end 
) 

Link to comment

-- Server --

--adminsOnly 
addEventHandler ( "onResourceStart", resourceRoot, 
    function ( ) 
                for i, player in ipairs( getElementsByType( 'player' ) ) do 
            if isObjectInACLGroup( 'user.'..getAccountName( getPlayerAccount( player ) ), aclGetGroup( "Admin" ) ) then 
                setElementData( player, 'Show_GUI', true) 
            else 
                setElementData( player, 'Show_GUI', nil) 
            end 
        end 
end 
) 
  
  
addEventHandler( 'onPlayerLogin', root, function( _, acc ) 
    if isObjectInACLGroup( 'user.'..getAccountName( acc ), aclGetGroup( "Admin" ) ) then 
       setElementData( source, 'Show_GUI', true) 
   else 
       setElementData( source, 'Show_GUI', nil)     
   end 
end 
) 
addEventHandler( 'onPlayerLogout', root, function( _, acc ) 
   triggerClientEvent( source, 'LogOutSetVisible', root) 
   setElementData( source, 'Show_GUI', nil) 
end 
) 

-- Client --

--gui 
GUIEditor = { 
    label = {}, 
} 
fereastra = guiCreateWindow(773, 239, 607, 576, "Admin Panel", false) 
guiWindowSetSizable(fereastra, false) 
  
Close = guiCreateButton(415, 475, 183, 92, "Close", false, fereastra) 
guiSetProperty(Close, "NormalTextColour", "FFAAAAAA") 
pos = guiCreateGridList(9, 357, 239, 210, false, fereastra) 
poscol = guiGridListAddColumn(pos, "Posibilites", 0.9) 
kick = guiCreateGridList(10, 145, 238, 211, false, fereastra) 
guiGridListAddColumn(kick, "Kick Player", 0.9) 
kickbtn = guiCreateButton(248, 145, 124, 59, "Kick Him", false, fereastra) 
guiSetProperty(kick, "NormalTextColour", "FFAAAAAA") 
set = guiCreateButton(250, 427, 134, 59, "set", false, fereastra) 
guiSetProperty(set, "NormalTextColour", "FFAAAAAA") 
ban = guiCreateButton(248, 298, 124, 58, "Ban Him", false, fereastra) 
guiSetProperty(ban, "NormalTextColour", "FFAAAAAA") 
freeze = guiCreateButton(248, 204, 124, 94, "Freeze Him", false, fereastra) 
guiSetProperty(freeze, "NormalTextColour", "FFAAAAAA") 
vehicles = guiCreateGridList(379, 145, 219, 208, false, fereastra) 
guiGridListAddColumn(vehicles, "Vehicles", 0.9) 
giveveh = guiCreateButton(426, 356, 144, 55, "Give", false, fereastra) 
guiSetProperty(giveveh, "NormalTextColour", "FFAAAAAA") 
GUIEditor.label[1] = guiCreateLabel(9, 21, 36, 15, "Name:", false, fereastra) 
GUIEditor.label[2] = guiCreateLabel(10, 42, 39, 15, "Health:", false, fereastra) 
GUIEditor.label[3] = guiCreateLabel(10, 62, 44, 15, "Armour:", false, fereastra) 
GUIEditor.label[5] = guiCreateLabel(248, 50, 326, 57, "Admin Panel", false, fereastra) 
guiSetFont(GUIEditor.label[5], "sa-header") 
guiLabelSetColor(GUIEditor.label[5], 0, 0, 0) 
numele = guiCreateLabel(46, 21, 120, 15, "", false, fereastra) 
viata = guiCreateLabel(49, 42, 117, 15, "", false, fereastra) 
armura = guiCreateLabel(59, 62, 114, 15, "", false, fereastra) 
  
  
guiSetVisible(fereastra, false ) 
  
  
-- Script -- 
  
--close button 
addEventHandler("onClientGUIClick",Close, 
function () 
    guiSetVisible(fereastra, false ) 
    showCursor(false) 
end 
) 
--start window 
bindKey ("0", "down", 
    function() 
        if getElementData( localPlayer, 'Show_GUI') ~= nil then  
            guiSetVisible(fereastra, not guiGetVisible(fereastra)) 
            showCursor(guiGetVisible(fereastra)) 
        end 
    end  
) 
  
addEvent( 'LogOutSetVisible', true ) 
addEventHandler( 'LogOutSetVisible', root, 
function() 
    if guiGetVisible(fereastra) then 
        guiSetVisible( fereastra, false ) 
        showCursor( false ) 
    end  
end 
) 

Press number 0 and work

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