Jump to content

Problems


Jaysds1

Recommended Posts

  • Replies 365
  • Created
  • Last Reply

Top Posters In This Topic

You want to show a gui for 1 player only just like castillo you trigger a client event for the player like this:

--server side 
triggerClientEvent(player, 'showGUI', player) 
  
--client side 
addEvent('showGUI', true) 
addEventHandler('showGUI', root, 
    function() 
        guiSetVisible(gui, true) 
    end 
) 

player is the player you want to show him the gui

Link to comment

How do you make a script on, when a admin login and automatically adds "{SERVERNAME}" at the beginning of the admin name?

My server-side script:

  
function iamAdmin(player) 
local account = getPlayerAccount(player) 
if not account then return end 
local accountName = getAccountName(account) 
if isObjectInACLGroup ( "user." .. accountName, aclGetGroup ( "Admin" ) ) then 
            local tag = "{JWORLD}" 
            local oldName = getPlayerName ( client ) 
            local newName = tag .. oldName 
            setPlayerName (source, newName) 
            setPlayerTeam" class="kw6">setPlayerTeam (source, teamA) 
            ouputChatBox ("ADMIN ON LINE") 
end 
if isObjectInACLGroup ( "user." .. accountName, aclGetGroup ( "Moderator" ) ) then 
            local tag = "{JWORLD MODERATOR}" 
            local oldName = getPlayerName ( client ) 
            local newName = tag .. oldName 
            setPlayerName (source, newName) 
            setPlayerTeam" class="kw6">setPlayerTeam (source, teamM) 
            ouputChatBox ("MODERATOR ON LINE") 
end 
end 
addEventHandler("onPlyerLogin", getRootElement(), iamAdmin) 
  

Link to comment

[/lua]

function iamAdmin()

local account = getPlayerAccount(source)

if not account then return end

local accountName = getAccountName(source)

if isObjectInACLGroup ( "user." .. accountName, aclGetGroup ( "Admin" ) ) then

setPlayerNametagText (source, "{JWORLD}..getPlayerName(source))

setPlayerTeam (source, teamA)

ouputChatBox ("* INFO: Admin have logged in!")

end

if isObjectInACLGroup ( "user." .. accountName, aclGetGroup ( "Moderator" ) ) then

setPlayerNametagText (source, "{JWORLDMOD}..getPlayerName(source))

setPlayerTeam (source, teamM)

ouputChatBox ("" INFO: Moderator have logged in!")

end

end

addEventHandler("onPlyerLogin", getRootElement(), iamAdmin)[/lua]

when you chat, then you will see the tag,

Link to comment

What's that TurboCow? getAccountName(source) o,O? also.. when you chat your nametag text is not shown in the chat without the script to do that. You have a lot of mistakes in this script. Here's what Jaysd1 wanted:

function iamAdmin() 
    local account = getPlayerAccount(source) 
    local accountName = getAccountName(account) 
    if isObjectInACLGroup ( "user." .. accountName, aclGetGroup ( "Sr.Admin" ) ) then 
    setPlayerTeam (source, teamA) 
    setPlayerName(source, "{JWORLD}"..getPlayerName(source)) 
    ouputChatBox ("* INFO: Admin have logged in!") 
    elseif isObjectInACLGroup ( "user." .. accountName, aclGetGroup ( "Moderator" ) ) then 
    setPlayerName(source, "{JWORLD}"..getPlayerName(source)) 
    setPlayerTeam (source, teamM) 
    ouputChatBox ("INFO: Moderator have logged in!") 
  end 
end 
addEventHandler("onPlayerLogin", getRootElement(), iamAdmin) 

Link to comment

I made this script, when a person change there nick to our beginning nick (ex. {SANL}....) it cancels the event but when an admin logs in it tries to cancel the Event but still goes through.

Here is my script:

client-side only

  
function removeHEX(oldNick,newNick) 
        if (string.find(newNick,"{JWORLD}")) then 
            local account = getPlayerAccount(source) 
            local accountName = getAccountName(account) 
            if isObjectInACLGroup ( "user." .. accountName, aclGetGroup ( "Admin" ) ) then 
            triggerEvent() 
            end 
        else 
            outputChatBox("You can't have our beginning nick.", source, 255, 0, 0) 
            cancelEvent() 
        end  
end 
addEventHandler("onPlayerChangeNick",getRootElement(),removeHEX) 
  

Link to comment
function removeHEX(oldNick,newNick) 
        if (string.find(newNick,"{JWORLD}")) then 
            local account = getPlayerAccount(source) 
            local accountName = getAccountName(account) 
            if not isObjectInACLGroup ( "user." .. accountName, aclGetGroup ( "Admin" ) ) then 
            outputChatBox("You can't have our beginning nick.", source, 255, 0, 0) 
            cancelEvent() 
            end 
      end 
end 
addEventHandler("onPlayerChangeNick",getRootElement(),removeHEX) 

Link to comment

I have a problem with my rule/help gui.

When I press f2 the window is not in the center, all the gui elements/buttons and memo are in the left corner then when i press f2 again, it opens up more windows.

I want the window to be in the center, same with the elements and the button to close the gui.

Here is my script:

Server-side

  
  
addEventHandler("onPlayerJoin", getRootElement(), 
function() 
    bindKey (source, "f2", "down", serverWin ) 
end 
) 
  
  
addEventHandler ( "onResourceStart", getResourceRootElement(getThisResource()), 
function() 
    for index, player in pairs(getElementsByType("player")) do 
    unbindKey ( source, "f2", "down", serverWin ) 
    end 
end 
) 
function serverWin() 
    triggerClientEvent ( "server", getRootElement()) 
end 
  

Client-side

  
  
function CreateRule() 
  
GUIEditor_Window = {} 
GUIEditor_Button = {} 
  
rules = guiCreateWindow(194,108,426,400,"J World: Freeroam Service Window",false) 
--Buttons 
chg_pss = guiCreateButton(15,33,70,40,"change password",false,GUIEditor_Window[1]) 
chg_nick = guiCreateButton(95,35,70,40,"change nick",false,GUIEditor_Window[1]) 
lout = guiCreateButton(178,36,70,40,"Logout",false,GUIEditor_Window[1]) 
--Text 
read_only = guiCreateMemo(17,92,398,100,"                            Welcome to J World: Freeroam\n\n                             There is no rules on this server.\n\n          All we ask is to be respectful to others and have FUN.",false,GUIEditor_Window[1]) 
guiMemoSetReadOnly(read_only,true) 
guiCreateLabel(20,231,371,145,"COMING SOON!!!",false,GUIEditor_Window[1]) 
end 
  

Link to comment

How the window variable is rules? and your parent for all the buttons and memo is GUIEditor_Window[1]??

Replace GUIEditor_Window[1] with rules.

And, i don't see the event added, and you probably create the rule window each time the player press F2

create it on resource start, hide it, then show it when needed.

Here: client side

function CreateRule() 
GUIEditor_Button = {} 
  
rules = guiCreateWindow(194,108,426,400,"J World: Freeroam Service Window",false) 
--Buttons 
chg_pss = guiCreateButton(15,33,70,40,"change password",false,rules) 
chg_nick = guiCreateButton(95,35,70,40,"change nick",false,rules) 
lout = guiCreateButton(178,36,70,40,"Logout",false,rules) 
--Text 
read_only = guiCreateMemo(17,92,398,100,"                            Welcome to J World: Freeroam\n\n                             There is no rules on this server.\n\n          All we ask is to be respectful to others and have FUN.",false,rules) 
guiMemoSetReadOnly(read_only,true) 
guiCreateLabel(20,231,371,145,"COMING SOON!!!",false,rules) 
guiSetVisible(rules, false) 
end 
  
addEventHandler('onClientResourceStart', resourceRoot, 
function() 
CreateRule() 
end 
) 
  
addEvent('server', true) 
addEventHandler('server', root, 
    function() 
        guiSetVisible(rules, not guiGetVisible(rules)) 
        showCursor(not isCursorShowing()) 
    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...