Jump to content

some problem in my script


ChoTax

Recommended Posts

hello Community..

i have problem in my script pls help me !

server

addEvent ("text", true ) 
 addEventHandler( "text", getRootElement(), 
 function () 
 local accName = getAccountName ( getPlayerAccount ( source ) ) -- get his account name 
 if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Admin" ) ) then 
 else 
 cancelEvent () 
 end 
    end ) 

client

GUIEditor_Label = {} 
GUIEditor_Window = {} 
GUIEditor_Button = {} 
GUIEditor_Edit = {} 
  
GUIEditor_Label[1] = guiCreateLabel(218,558,387,41,"",false) 
guiLabelSetColor(GUIEditor_Label[1],255,255,255) 
guiLabelSetVerticalAlign(GUIEditor_Label[1],"top") 
guiLabelSetHorizontalAlign(GUIEditor_Label[1],"left",false) 
GUIEditor_Window[1] = guiCreateWindow(221,83,310,341,"",false) 
guiSetVisible ( GUIEditor_Window[1] , false ) 
GUIEditor_Edit[1] = guiCreateEdit(10,25,287,47,"",false,GUIEditor_Window[1]) 
GUIEditor_Button[1] = guiCreateButton(9,295,126,35,"Send Text",false,GUIEditor_Window[1]) 
close = guiCreateButton(173,294,126,35,"Close",false,GUIEditor_Window[1]) 
  
  
addCommandHandler ( "text", 
function () 
guiSetVisible ( GUIEditor_Window[1], true ) 
showCursor ( true ) 
  
end ) 
-------------------- 
 addEventHandler ( "onClientGUIClick", root,  
 function () 
 local send = guiGetText(GUIEditor_Edit[1]) 
 if ( source == GUIEditor_Button[1] ) then  
 guiSetText ( GUIEditor_Label[1], " admin : "..send) 
 guiSetFont(GUIEditor_Label[1], guiCreateFont("font.ttf", 12)) 
 guiLabelSetColor ( GUIEditor_Label[1], 255, 0, 0 ) 
 triggerServerEvent("text", localPlayer, accName ) 
 end 
    end ) 
   
 ----------------- 
  addEventHandler ( "onClientGUIClick", root,  
 function () 
 if ( source == close ) then  
 guiSetVisible ( GUIEditor_Window[1], false ) 
 showCursor ( false ) 
 end 
    end ) 

i want only admin can use it !

Link to comment
addEvent ("text", true ) 
     addEventHandler( "text", getRootElement(), 
     function () 
     local accName = getAccountName ( getPlayerAccount ( source ) ) -- get his account name 
     if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Admin" ) ) then 
     else 
     cancelEvent () 
     end 
        end 

Link to comment
addEvent ("text", true ) 
     addEventHandler( "text", getRootElement(), 
     function () 
     local accName = getAccountName ( getPlayerAccount ( source ) ) -- get his account name 
     if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Admin" ) ) then 
     else 
     cancelEvent () 
     end 
        end 

You forgot to close the event handler

Link to comment
addEvent ("text", true ) 
     addEventHandler( "text", getRootElement(), 
     function () 
     local accName = getAccountName ( getPlayerAccount ( source ) ) -- get his account name 
     if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Admin" ) ) then 
     else 
     cancelEvent () 
     end 
        end 

You forgot to close the event handler

I see
    addEvent ("text", true ) 
         addEventHandler( "text", getRootElement(), 
         function () 
         local accName = getAccountName ( getPlayerAccount ( source ) ) -- get his account name 
         if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Admin" ) ) then 
         else 
         cancelEvent () 
         end 
     end 
     ) 

Link to comment
addEvent ("text", true ) 
     addEventHandler( "text", getRootElement(), 
     function () 
     local accName = getAccountName ( getPlayerAccount ( source ) ) -- get his account name 
     if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Admin" ) ) then 
     else 
     cancelEvent () 
     end 
        end 

what you're changed ?

Link to comment

you put ")" into same line as end

EDIT :

    addEvent ("text", true ) 
         addEventHandler( "text", getRootElement(), 
         function () 
         local accName = getAccountName ( getPlayerAccount ( source ) ) -- get his account name 
         if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Admin" ) ) then 
         else 
         cancelEvent () 
         end 
     end 
     ) 

Link to comment
you put ")" into same line as end

EDIT :

    addEvent ("text", true ) 
         addEventHandler( "text", getRootElement(), 
         function () 
         local accName = getAccountName ( getPlayerAccount ( source ) ) -- get his account name 
         if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Admin" ) ) then 
         else 
         cancelEvent () 
         end 
     end 
     ) 

not work ;(

Link to comment
addEvent ("text", true ) 
             function text() 
             local accName = getAccountName ( getPlayerAccount ( source ) ) -- get his account name 
             if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Admin" ) ) then 
             else 
             cancelEvent () 
             end 
         end 
addEventHandler ( "text", getRootElement(), text ) 

try this

Link to comment
addEvent ("text", true ) 
             function text() 
             local accName = getAccountName ( getPlayerAccount ( source ) ) -- get his account name 
             if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Admin" ) ) then 
             else 
             cancelEvent () 
             end 
         end 
addEventHandler ( "text", getRootElement(), text ) 

try this

not work :cry:

Link to comment

-- server side

addCommandHandler( "text", 
function( ) 
    for _, player in ipairs ( getElementsByType ( "player" ) ) do 
        local accName = getAccountName ( getPlayerAccount( player ) ) -- get his account 
        if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Admin" ) ) then 
        triggerClientEvent( player, "text", root ) 
        end 
    end 
end  
) 

-- client side

GUIEditor_Label = {} 
GUIEditor_Window = {} 
GUIEditor_Button = {} 
GUIEditor_Edit = {} 
  
GUIEditor_Label[1] = guiCreateLabel(218,558,387,41,"",false) 
guiLabelSetColor(GUIEditor_Label[1],255,255,255) 
guiLabelSetVerticalAlign(GUIEditor_Label[1],"top") 
guiLabelSetHorizontalAlign(GUIEditor_Label[1],"left",false) 
GUIEditor_Window[1] = guiCreateWindow(221,83,310,341,"",false) 
guiSetVisible ( GUIEditor_Window[1] , false ) 
GUIEditor_Edit[1] = guiCreateEdit(10,25,287,47,"",false,GUIEditor_Window[1]) 
GUIEditor_Button[1] = guiCreateButton(9,295,126,35,"Send Text",false,GUIEditor_Window[1]) 
close = guiCreateButton(173,294,126,35,"Close",false,GUIEditor_Window[1]) 
  
  
addEvent ("text", true ) 
addEventHandler( "text", root, 
function () 
    guiSetVisible ( GUIEditor_Window[1], true ) 
    showCursor ( true ) 
end  
) 
  
-------------------- 
  
addEventHandler ( "onClientGUIClick", root, 
function () 
    local send = guiGetText(GUIEditor_Edit[1]) 
    if ( source == GUIEditor_Button[1] ) then 
    guiSetText ( GUIEditor_Label[1], " admin : "..send) 
    guiSetFont(GUIEditor_Label[1], guiCreateFont("font.ttf", 12)) 
    guiLabelSetColor ( GUIEditor_Label[1], 255, 0, 0 ) 
    end 
end  
) 
  
----------------- 
  
addEventHandler ( "onClientGUIClick", root, 
function () 
    if ( source == close ) then 
    guiSetVisible ( GUIEditor_Window[1], false ) 
    showCursor ( false ) 
    end 
end  
) 

Link to comment
-- server side
addCommandHandler( "text", 
function( ) 
    for _, player in ipairs ( getElementsByType ( "player" ) ) do 
        local accName = getAccountName ( getPlayerAccount( player ) ) -- get his account 
        if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Admin" ) ) then 
        triggerClientEvent( player, "text", root ) 
        end 
    end 
end  
) 

-- client side

GUIEditor_Label = {} 
GUIEditor_Window = {} 
GUIEditor_Button = {} 
GUIEditor_Edit = {} 
  
GUIEditor_Label[1] = guiCreateLabel(218,558,387,41,"",false) 
guiLabelSetColor(GUIEditor_Label[1],255,255,255) 
guiLabelSetVerticalAlign(GUIEditor_Label[1],"top") 
guiLabelSetHorizontalAlign(GUIEditor_Label[1],"left",false) 
GUIEditor_Window[1] = guiCreateWindow(221,83,310,341,"",false) 
guiSetVisible ( GUIEditor_Window[1] , false ) 
GUIEditor_Edit[1] = guiCreateEdit(10,25,287,47,"",false,GUIEditor_Window[1]) 
GUIEditor_Button[1] = guiCreateButton(9,295,126,35,"Send Text",false,GUIEditor_Window[1]) 
close = guiCreateButton(173,294,126,35,"Close",false,GUIEditor_Window[1]) 
  
  
addEvent ("text", true ) 
addEventHandler( "text", root, 
function () 
    guiSetVisible ( GUIEditor_Window[1], true ) 
    showCursor ( true ) 
end  
) 
  
-------------------- 
  
addEventHandler ( "onClientGUIClick", root, 
function () 
    local send = guiGetText(GUIEditor_Edit[1]) 
    if ( source == GUIEditor_Button[1] ) then 
    guiSetText ( GUIEditor_Label[1], " admin : "..send) 
    guiSetFont(GUIEditor_Label[1], guiCreateFont("font.ttf", 12)) 
    guiLabelSetColor ( GUIEditor_Label[1], 255, 0, 0 ) 
    end 
end  
) 
  
----------------- 
  
addEventHandler ( "onClientGUIClick", root, 
function () 
    if ( source == close ) then 
    guiSetVisible ( GUIEditor_Window[1], false ) 
    showCursor ( false ) 
    end 
end  
) 

same problem !

not work

Link to comment

-- client side:

GUIEditor_Label = {} 
GUIEditor_Window = {} 
GUIEditor_Button = {} 
GUIEditor_Edit = {} 
  
GUIEditor_Label[1] = guiCreateLabel(218,558,387,41,"",false) 
guiLabelSetColor(GUIEditor_Label[1],255,255,255) 
guiLabelSetVerticalAlign(GUIEditor_Label[1],"top") 
guiLabelSetHorizontalAlign(GUIEditor_Label[1],"left",false) 
GUIEditor_Window[1] = guiCreateWindow(221,83,310,341,"",false) 
guiSetVisible ( GUIEditor_Window[1] , false ) 
GUIEditor_Edit[1] = guiCreateEdit(10,25,287,47,"",false,GUIEditor_Window[1]) 
GUIEditor_Button[1] = guiCreateButton(9,295,126,35,"Send Text",false,GUIEditor_Window[1]) 
close = guiCreateButton(173,294,126,35,"Close",false,GUIEditor_Window[1]) 
font = guiCreateFont("font.ttf", 12) 
  
addEvent ( "showWindow", true ) 
addEventHandler ( "showWindow", root, 
    function ( ) 
        guiSetVisible ( GUIEditor_Window[1], true ) 
        showCursor ( true )  
    end 
) 
  
addEventHandler ( "onClientGUIClick", root, 
    function ( ) 
        if ( source == GUIEditor_Button[1] ) then 
            local text = guiGetText(GUIEditor_Edit[1]) 
            triggerServerEvent ( "sendText", localPlayer, text ) 
        elseif ( source == close ) then 
            guiSetVisible ( GUIEditor_Window[1], false ) 
            showCursor ( false ) 
        end 
    end 
) 
  
addEvent ( "returnText", true ) 
addEventHandler ( "returnText", root, 
    function ( text ) 
        guiSetText ( GUIEditor_Label[1], " admin : "..text ) 
        guiSetFont(GUIEditor_Label[1], font) 
        guiLabelSetColor ( GUIEditor_Label[1], 255, 0, 0 ) 
    end 
) 

-- server side:

addCommandHandler ( "text", 
    function ( thePlayer ) 
        local accName = getAccountName ( getPlayerAccount ( thePlayer ) ) -- get his account name 
        if isObjectInACLGroup ( "user.".. accName, aclGetGroup ( "Admin" ) ) then 
            triggerClientEvent ( thePlayer, "showWindow", thePlayer ) 
        end 
    end 
) 
  
addEvent ( "sendText", true ) 
addEventHandler ( "sendText", root, 
    function ( text ) 
        triggerClientEvent ( "returnText", root, text ) 
    end 
) 

Link to comment
-- client side:
GUIEditor_Label = {} 
GUIEditor_Window = {} 
GUIEditor_Button = {} 
GUIEditor_Edit = {} 
  
GUIEditor_Label[1] = guiCreateLabel(218,558,387,41,"",false) 
guiLabelSetColor(GUIEditor_Label[1],255,255,255) 
guiLabelSetVerticalAlign(GUIEditor_Label[1],"top") 
guiLabelSetHorizontalAlign(GUIEditor_Label[1],"left",false) 
GUIEditor_Window[1] = guiCreateWindow(221,83,310,341,"",false) 
guiSetVisible ( GUIEditor_Window[1] , false ) 
GUIEditor_Edit[1] = guiCreateEdit(10,25,287,47,"",false,GUIEditor_Window[1]) 
GUIEditor_Button[1] = guiCreateButton(9,295,126,35,"Send Text",false,GUIEditor_Window[1]) 
close = guiCreateButton(173,294,126,35,"Close",false,GUIEditor_Window[1]) 
font = guiCreateFont("font.ttf", 12) 
  
addEvent ( "showWindow", true ) 
addEventHandler ( "showWindow", root, 
    function ( ) 
        guiSetVisible ( GUIEditor_Window[1], true ) 
        showCursor ( true )  
    end 
) 
  
addEventHandler ( "onClientGUIClick", root, 
    function ( ) 
        if ( source == GUIEditor_Button[1] ) then 
            local text = guiGetText(GUIEditor_Edit[1]) 
            triggerServerEvent ( "sendText", localPlayer, text ) 
        elseif ( source == close ) then 
            guiSetVisible ( GUIEditor_Window[1], false ) 
            showCursor ( false ) 
        end 
    end 
) 
  
addEvent ( "returnText", true ) 
addEventHandler ( "returnText", root, 
    function ( text ) 
        guiSetText ( GUIEditor_Label[1], " admin : "..text ) 
        guiSetFont(GUIEditor_Label[1], font) 
        guiLabelSetColor ( GUIEditor_Label[1], 255, 0, 0 ) 
    end 
) 

-- server side:

addCommandHandler ( "text", 
    function ( thePlayer ) 
        local accName = getAccountName ( getPlayerAccount ( thePlayer ) ) -- get his account name 
        if isObjectInACLGroup ( "user.".. accName, aclGetGroup ( "Admin" ) ) then 
            triggerClientEvent ( thePlayer, "showWindow", thePlayer ) 
        end 
    end 
) 
  
addEvent ( "sendText", true ) 
addEventHandler ( "sendText", root, 
    function ( text ) 
        triggerClientEvent ( "returnText", root, text ) 
    end 
) 

not work :P

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