Jump to content

Ask for Some thing


X-SHADOW

Recommended Posts

Hi i want to Make a script that if the player joined the server then dont let him play move him to spectator team

and if source == button 1 then Play sound servergroup_assigned then he can Play in server move him to any team

and if source == button 2 then removeAccountData and then always move him to spectator team if he join the server and if admin press button 2

i just made the half of it

GUIEditor_Window = {} 
GUIEditor_Button = {} 
GUIEditor_Grid = {} 
GUIEditor_Image = {} 
  
GUIEditor_Window[1] = guiCreateWindow(448,205,604,391,"[servergroup] v1.0",false) 
guiWindowSetMovable(GUIEditor_Window[1],false) 
guiWindowSetSizable(GUIEditor_Window[1],false) 
GUIEditor_Grid[1] = guiCreateGridList(9,18,190,409,false,GUIEditor_Window[1]) 
guiGridListSetSelectionMode(GUIEditor_Grid[1],2) 
  
guiGridListAddColumn(GUIEditor_Grid[1],"Players",0.2) 
  
for i = 1, 1 do 
    guiGridListAddRow(GUIEditor_Grid[1]) 
end 
GUIEditor_Button[1] = guiCreateButton(200,25,158,42,"servergroup_assigned",false,GUIEditor_Window[1]) 
guiSetFont(GUIEditor_Button[1],"clear-normal") 
GUIEditor_Button[2] = guiCreateButton(425,28,170,40,"servergroup_revoked",false,GUIEditor_Window[1]) 
guiSetFont(GUIEditor_Button[2],"clear-normal") 
GUIEditor_Image[1] = guiCreateStaticImage(262,118,318,264,"images/mtalogo.png",false,GUIEditor_Window[1]) 
  
function loadPlayersToGrid() 
    guiGridListClear(GUIEditor_Grid[1]) 
    for index, player in ipairs(getElementsByType("player")) do 
        local row = guiGridListAddRow(GUIEditor_Grid[1]) 
        guiGridListSetItemText(GUIEditor_Grid[1],row,1,tostring(getPlayerName(player)),false,false) 
    end 
end 
loadPlayersToGrid() 
addEventHandler("onClientPlayerJoin",root,loadPlayersToGrid) 
addEventHandler("onClientPlayerQuit",root,loadPlayersToGrid) 
addEventHandler("onClientPlayerChangeNick",root,loadPlayersToGrid) 
  
addEventHandler("onClientGUIClick",root, 
function () 
    if (source == GUIEditor_Button[1]) then 
        local row,col = guiGridListGetSelectedItem(GUIEditor_Grid[1]) 
        if (row and col and row ~= -1 and col ~= -1) then 
            local playerName = guiGridListGetItemText(GUIEditor_Grid[1], row, 1) 
            local player = getPlayerFromName(playerName) 
            outputChatBox(" [serverGroup_assigned ] !",source, 255,255,0) 
            playSound("sounds/servergroup_assigned.wav") 
            outputChatBox(getPlayerName(player) .. " [serverGroup assigned ] !",255,255,0) 
            end 
        elseif (source == GUIEditor_Button[2]) then 
        local row,col = guiGridListGetSelectedItem(GUIEditor_Grid[1]) 
        if (row and col and row ~= -1 and col ~= -1) then 
            local playerName = guiGridListGetItemText(GUIEditor_Grid[1], row, 1) 
            local player = getPlayerFromName(playerName) 
            local what = getTeamFromName ( "spectator" ) 
            if ( what ) then 
            setPlayerTeam ( source, what ) 
            outputChatBox("[serverGroup_revoked] !",source, 255,255,0) 
            playSound("sounds/servergroup_revoked.wav") 
            outputChatBox(getPlayerName(player) .. "[ servergroup_revoked] !",0,255,255) 
         
end 
end 
end 
end) 
  
function toggleGUI() 
    if guiGetVisible(GUIEditor_Window[1]) == true then 
        guiSetVisible(GUIEditor_Window[1],false) 
        showCursor(false) 
    else 
        guiSetVisible(GUIEditor_Window[1],true) 
        showCursor(true) 
    end 
end 
addEvent("toggleGUI",true) 
addEventHandler("toggleGUI",root,toggleGUI) 

Edited by Guest
Link to comment

i dont need SpawnPlayer iam using BaseMode

:)

Hi i want to Make a script that if the player joined the server then dont let him play move him to spectator team

and if source == button 1 then Play sound servergroup_assigned then he can Play in server move him to any team

and if source == button 2 then removeAccountData and then always move him to spectator team if he join the server and if admin press button 2

Link to comment

No Man there is team in BaseMode Name spectator i want i admin press button 2 then move the Player to this team and remove his a Account

 

  
GUIEditor_Window = {} 
GUIEditor_Button = {} 
GUIEditor_Grid = {} 
GUIEditor_Image = {} 
  
GUIEditor_Window[1] = guiCreateWindow(448,205,604,391,"[servergroup] Panel  v1.0",false) 
guiWindowSetMovable(GUIEditor_Window[1],false) 
guiWindowSetSizable(GUIEditor_Window[1],false) 
GUIEditor_Grid[1] = guiCreateGridList(9,18,190,409,false,GUIEditor_Window[1]) 
guiGridListSetSelectionMode(GUIEditor_Grid[1],2) 
  
guiGridListAddColumn(GUIEditor_Grid[1],"Players",0.6) 
  
for i = 1, 1 do 
    guiGridListAddRow(GUIEditor_Grid[1]) 
end 
GUIEditor_Button[1] = guiCreateButton(200,25,158,42,"servergroup_assigned",false,GUIEditor_Window[1]) 
guiSetFont(GUIEditor_Button[1],"clear-normal") 
GUIEditor_Button[2] = guiCreateButton(425,28,170,40,"servergroup_revoked",false,GUIEditor_Window[1]) 
guiSetFont(GUIEditor_Button[2],"clear-normal") 
GUIEditor_Image[1] = guiCreateStaticImage(262,118,318,264,"images/mtalogo.png",false,GUIEditor_Window[1]) 
  
function loadPlayersToGrid() 
    guiGridListClear(GUIEditor_Grid[1]) 
    for index, player in ipairs(getElementsByType("player")) do 
        local row = guiGridListAddRow(GUIEditor_Grid[1]) 
        guiGridListSetItemText(GUIEditor_Grid[1],row,1,tostring(getPlayerName(player)),false,false) 
    end 
end 
loadPlayersToGrid() 
addEventHandler("onClientPlayerJoin",root,loadPlayersToGrid) 
addEventHandler("onClientPlayerQuit",root,loadPlayersToGrid) 
addEventHandler("onClientPlayerChangeNick",root,loadPlayersToGrid) 
  
addEventHandler("onClientGUIClick",root, 
function () 
    if (source == GUIEditor_Button[1]) then 
        local row,col = guiGridListGetSelectedItem(GUIEditor_Grid[1]) 
        if (row and col and row ~= -1 and col ~= -1) then 
            local playerName = guiGridListGetItemText(GUIEditor_Grid[1], row, 1) 
            local player = getPlayerFromName(playerName) 
            outputChatBox(" [ ServerGroup_assigned ] !",source, 255,255,0) 
            playSound("sounds/servergroup_assigned.wav") 
            outputChatBox(getPlayerName(player) .. " [ serverGroup_assigned] ! ",255,255,0) 
            end 
        elseif (source == GUIEditor_Button[2]) then 
        local row,col = guiGridListGetSelectedItem(GUIEditor_Grid[1]) 
        if (row and col and row ~= -1 and col ~= -1) then 
            local playerName = guiGridListGetItemText(GUIEditor_Grid[1], row, 1) 
            local player = getPlayerFromName(playerName) 
            playSound("sounds/servergroup_revoked.wav") 
            outputChatBox(getPlayerName(player) .. " [ servergroup_revoked] ! ",255,0,0) 
            local what = getTeamFromName ( "spectator" ) 
            if ( what ) then 
            setPlayerTeam ( source, what ) 
         
end 
end 
end 
end) 
  
function toggleGUI() 
    if guiGetVisible(GUIEditor_Window[1]) == true then 
        guiSetVisible(GUIEditor_Window[1],false) 
        showCursor(false) 
    else 
        guiSetVisible(GUIEditor_Window[1],true) 
        showCursor(true) 
    end 
end 
addEvent("toggleGUI",true) 
addEventHandler("toggleGUI",root,toggleGUI) 

Link to comment

https://wiki.multitheftauto.com/wiki/RemoveAccount

so the server can remmeber him if he registerd then he can play else move him to team ..

and Remove his Account

i have add small things see

GUIEditor_Window = {} 
GUIEditor_Button = {} 
GUIEditor_Grid = {} 
GUIEditor_Image = {} 
  
GUIEditor_Window[1] = guiCreateWindow(448,205,604,391,"[servergroup] Panel  v1.0",false) 
guiWindowSetMovable(GUIEditor_Window[1],false) 
guiWindowSetSizable(GUIEditor_Window[1],false) 
GUIEditor_Grid[1] = guiCreateGridList(9,18,190,409,false,GUIEditor_Window[1]) 
guiGridListSetSelectionMode(GUIEditor_Grid[1],2) 
  
guiGridListAddColumn(GUIEditor_Grid[1],"Players",0.6) 
  
for i = 1, 1 do 
    guiGridListAddRow(GUIEditor_Grid[1]) 
end 
GUIEditor_Button[1] = guiCreateButton(200,25,158,42,"servergroup_assigned",false,GUIEditor_Window[1]) 
guiSetFont(GUIEditor_Button[1],"clear-normal") 
GUIEditor_Button[2] = guiCreateButton(425,28,170,40,"servergroup_revoked",false,GUIEditor_Window[1]) 
guiSetFont(GUIEditor_Button[2],"clear-normal") 
GUIEditor_Image[1] = guiCreateStaticImage(262,118,318,264,"images/mtalogo.png",false,GUIEditor_Window[1]) 
  
function loadPlayersToGrid() 
    guiGridListClear(GUIEditor_Grid[1]) 
    for index, player in ipairs(getElementsByType("player")) do 
        local row = guiGridListAddRow(GUIEditor_Grid[1]) 
        guiGridListSetItemText(GUIEditor_Grid[1],row,1,tostring(getPlayerName(player)),false,false) 
    end 
end 
loadPlayersToGrid() 
addEventHandler("onClientPlayerJoin",root,loadPlayersToGrid) 
addEventHandler("onClientPlayerQuit",root,loadPlayersToGrid) 
addEventHandler("onClientPlayerChangeNick",root,loadPlayersToGrid) 
  
addEventHandler("onClientGUIClick",root, 
function () 
    if (source == GUIEditor_Button[1]) then 
        local row,col = guiGridListGetSelectedItem(GUIEditor_Grid[1]) 
        if (row and col and row ~= -1 and col ~= -1) then 
            local playerName = guiGridListGetItemText(GUIEditor_Grid[1], row, 1) 
            local player = getPlayerFromName(playerName) 
            outputChatBox(" [ ServerGroup_assigned ] !",source, 255,255,0) 
            playSound("sounds/servergroup_assigned.wav") 
            outputChatBox(getPlayerName(player) .. " [ serverGroup_assigned] ! ",255,255,0) 
            setElementData(source,"why","Registred !") 
            end 
        elseif (source == GUIEditor_Button[2]) then 
        local row,col = guiGridListGetSelectedItem(GUIEditor_Grid[1]) 
        if (row and col and row ~= -1 and col ~= -1) then 
            local playerName = guiGridListGetItemText(GUIEditor_Grid[1], row, 1) 
            local player = getPlayerFromName(playerName) 
            local why = getElementData(source,"Account") 
            playSound("sounds/servergroup_revoked.wav") 
            outputChatBox(getPlayerName(player) .. " [ servergroup_revoked] ! ",255,0,0) 
            setElementData(source,"why" ,"Blocked !") 
            triggerClientEvent(source,"move",source) 
         
end 
end 
end 
) 
  
function toggleGUI() 
    if guiGetVisible(GUIEditor_Window[1]) == true then 
        guiSetVisible(GUIEditor_Window[1],false) 
        showCursor(false) 
    else 
        guiSetVisible(GUIEditor_Window[1],true) 
        showCursor(true) 
    end 
end 
addEvent("toggleGUI",true) 
addEventHandler("toggleGUI",root,toggleGUI) 

exports.scoreboard:addScoreboardColumn('Account') 
  
function wow () 
local what = getTeamFromName ( "spectator" ) 
    if ( what ) then 
        setPlayerTeam ( source, what ) 
end 
end 
addEvent("move",true) 
addEventHandler("move",source,move) 

Link to comment

-- client side:

GUIEditor_Window = {} 
GUIEditor_Button = {} 
GUIEditor_Grid = {} 
GUIEditor_Image = {} 
  
GUIEditor_Window[1] = guiCreateWindow(448,205,604,391,"[servergroup] Panel  v1.0",false) 
guiWindowSetMovable(GUIEditor_Window[1],false) 
guiWindowSetSizable(GUIEditor_Window[1],false) 
GUIEditor_Grid[1] = guiCreateGridList(9,18,190,409,false,GUIEditor_Window[1]) 
guiGridListAddColumn(GUIEditor_Grid[1],"Players",0.6) 
GUIEditor_Button[1] = guiCreateButton(200,25,158,42,"servergroup_assigned",false,GUIEditor_Window[1]) 
guiSetFont(GUIEditor_Button[1],"clear-normal") 
GUIEditor_Button[2] = guiCreateButton(425,28,170,40,"servergroup_revoked",false,GUIEditor_Window[1]) 
guiSetFont(GUIEditor_Button[2],"clear-normal") 
GUIEditor_Image[1] = guiCreateStaticImage(262,118,318,264,"images/mtalogo.png",false,GUIEditor_Window[1]) 
  
function loadPlayersToGrid() 
    guiGridListClear(GUIEditor_Grid[1]) 
    for index, player in ipairs(getElementsByType("player")) do 
        local row = guiGridListAddRow(GUIEditor_Grid[1]) 
        guiGridListSetItemText(GUIEditor_Grid[1],row,1,tostring(getPlayerName(player)),false,false) 
    end 
end 
loadPlayersToGrid() 
addEventHandler("onClientPlayerJoin",root,loadPlayersToGrid) 
addEventHandler("onClientPlayerQuit",root,loadPlayersToGrid) 
addEventHandler("onClientPlayerChangeNick",root,loadPlayersToGrid) 
  
addEventHandler("onClientGUIClick",root, 
    function () 
        if (source == GUIEditor_Button[1]) then 
            local row,col = guiGridListGetSelectedItem(GUIEditor_Grid[1]) 
            if (row and col and row ~= -1 and col ~= -1) then 
                local playerName = guiGridListGetItemText(GUIEditor_Grid[1], row, 1) 
                local player = getPlayerFromName(playerName) 
                if (player) then 
                    playSound("sounds/servergroup_assigned.wav") 
                    outputChatBox(getPlayerName(player) .. " [ serverGroup_assigned] ! ",255,255,0) 
                    triggerServerEvent("assignGroup",localPlayer,player,true) 
                end 
            end 
        elseif (source == GUIEditor_Button[2]) then 
            local row,col = guiGridListGetSelectedItem(GUIEditor_Grid[1]) 
            if (row and col and row ~= -1 and col ~= -1) then 
                local playerName = guiGridListGetItemText(GUIEditor_Grid[1], row, 1) 
                local player = getPlayerFromName(playerName) 
                if (player) then 
                    playSound("sounds/servergroup_revoked.wav") 
                    outputChatBox(getPlayerName(player) .. " [ servergroup_revoked] ! ",255,0,0)                 
                    triggerServerEvent("assignGroup",localPlayer,player,false) 
                end 
            end 
        end 
    end 
) 
  
function toggleGUI() 
    if guiGetVisible(GUIEditor_Window[1]) == true then 
        guiSetVisible(GUIEditor_Window[1],false) 
        showCursor(false) 
    else 
        guiSetVisible(GUIEditor_Window[1],true) 
        showCursor(true) 
    end 
end 
addEvent("toggleGUI",true) 
addEventHandler("toggleGUI",root,toggleGUI) 

-- server side:

addEvent("assignGroup",true) 
addEventHandler("assignGroup",root, 
    function (player, assign) 
        if (player) then 
            if (assign) then 
                setElementData(player,"why","Registred !") 
                outputChatBox(" [ ServerGroup_assigned ] !",player,255,255,0) 
                if getTeamFromName ( "spectator" ) then 
                     setPlayerTeam(player, getTeamFromName ( "spectator" )) 
                end                 
            else 
                setElementData(player,"why" ,"Blocked !") 
                setPlayerTeam(player, nil) 
                local account = getPlayerAccount(player) 
                if (account) then 
                    removeAccount(account) 
                end 
            end 
        end 
    end 
) 

Link to comment

this what i want

client side

GUIEditor_Window = {} 
GUIEditor_Button = {} 
GUIEditor_Grid = {} 
GUIEditor_Image = {} 
  
GUIEditor_Window[1] = guiCreateWindow(448,205,604,391,"[servergroup] Panel  v1.0",false) 
guiWindowSetMovable(GUIEditor_Window[1],false) 
guiWindowSetSizable(GUIEditor_Window[1],false) 
GUIEditor_Grid[1] = guiCreateGridList(9,18,190,409,false,GUIEditor_Window[1]) 
guiGridListAddColumn(GUIEditor_Grid[1],"Players",0.6) 
GUIEditor_Button[1] = guiCreateButton(200,25,158,42,"servergroup_assigned",false,GUIEditor_Window[1]) 
guiSetFont(GUIEditor_Button[1],"clear-normal") 
GUIEditor_Button[2] = guiCreateButton(425,28,170,40,"servergroup_revoked",false,GUIEditor_Window[1]) 
guiSetFont(GUIEditor_Button[2],"clear-normal") 
GUIEditor_Image[1] = guiCreateStaticImage(262,118,318,264,"images/mtalogo.png",false,GUIEditor_Window[1]) 
  
function loadPlayersToGrid() 
    guiGridListClear(GUIEditor_Grid[1]) 
    for index, player in ipairs(getElementsByType("player")) do 
        local row = guiGridListAddRow(GUIEditor_Grid[1]) 
        guiGridListSetItemText(GUIEditor_Grid[1],row,1,tostring(getPlayerName(player)),false,false) 
    end 
end 
loadPlayersToGrid() 
addEventHandler("onClientPlayerJoin",root,loadPlayersToGrid) 
addEventHandler("onClientPlayerQuit",root,loadPlayersToGrid) 
addEventHandler("onClientPlayerChangeNick",root,loadPlayersToGrid) 
  
addEventHandler("onClientGUIClick",root, 
    function () 
        if (source == GUIEditor_Button[1]) then 
            local row,col = guiGridListGetSelectedItem(GUIEditor_Grid[1]) 
            if (row and col and row ~= -1 and col ~= -1) then 
                local playerName = guiGridListGetItemText(GUIEditor_Grid[1], row, 1) 
                local player = getPlayerFromName(playerName) 
                if (player) then 
                    playSound("sounds/servergroup_assigned.wav") 
                    triggerServerEvent("assignGroup",localPlayer,player,false) 
                end 
            end 
        elseif (source == GUIEditor_Button[2]) then 
            local row,col = guiGridListGetSelectedItem(GUIEditor_Grid[1]) 
            if (row and col and row ~= -1 and col ~= -1) then 
                local playerName = guiGridListGetItemText(GUIEditor_Grid[1], row, 1) 
                    playSound("sounds/servergroup_revoked.wav")             
                    triggerServerEvent("RevokedGroup",localPlayer,player,false) 
                end 
            end 
        end 
    end 
) 
  
function toggleGUI() 
    if guiGetVisible(GUIEditor_Window[1]) == true then 
        guiSetVisible(GUIEditor_Window[1],false) 
        showCursor(false) 
    else 
        guiSetVisible(GUIEditor_Window[1],true) 
        showCursor(true) 
    end 
end 
addEvent("toggleGUI",true) 
addEventHandler("toggleGUI",root,toggleGUI) 

serverSide ..

addEvent("assignGroup",true) --- the good guy 
addEventHandler("assignGroup",root,  --- the good guy 
    function (player, assign) 
        if (player) then 
            if (assign) then 
                setElementData(player,"Account","Registred !") -- set the Cloumn data on scoreboard 
                outputChatBox(getPlayerName(player) .. " [ serverGroup_assigned] ! ",255,255,0) 
                local teams = getElementsByType("team") 
                for i,team in ipairs(teams) do --- i want get any team but Spectator 
            local teamName = getTeamName(team) -- get the other teams 
            setPlayerTeam(player,teamName) --- set any team but Spectator and get his account to save his team  
end 
                 
addEvent("RevokedGroup",true)  --- the Bad guy 
addEventHandler("RevokedGroup",root,  --- the Bad guy 
function (player, Revoked) 
    if (player) then 
    if (Revoked) then 
    setElementData(player,"Account"," Revoked !")  -- set the Cloumn data on scoreboard 
    outputChatBox(getPlayerName(player) .. " [ serverGroup_Revoked !] ! ",255,255,0) 
    if getTeamFromName ( "Spectator" ) then 
    setPlayerTeam(player, getTeamFromName ( "Spectator" )) --- always if he join set him this team unless if he assigned  
    local account = getPlayerAccount(player) 
    if (account) then 
    removeAccount(account) -- remove his account to  
end 
  
addEventHandler("onPlayerJoin",root, 
function () 
    bindKey(source,"F3","down",showGUI) 
end) 
  
addEventHandler("onResourceStart",resourceRoot, 
function () 
    for index, player in ipairs(getElementsByType("player")) do 
        bindKey(player,"F3","down",showGUI) 
    end 
end) 
  
function showGUI(thePlayer) 
    if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(thePlayer)),aclGetGroup("Admin")) then 
        triggerClientEvent(thePlayer,"toggleGUI",thePlayer) 
    else 
        outputChatBox("You must be an Admin",thePlayer,255,0,0) 
    end 
end 
  
exports.dxscoreboard:scoreboardAddColumn( "Account" ) 

Link to comment

You need to use end to end each block.

Server:

addEvent("assignGroup",true) --- the good guy 
addEventHandler("assignGroup",root,  --- the good guy 
    function (player, assign) 
        if (player) then 
            if (assign) then 
                setElementData(player,"Account","Registred !") -- set the Cloumn data on scoreboard 
                outputChatBox(getPlayerName(player) .. " [ serverGroup_assigned] ! ",255,255,0) 
                local teams = getElementsByType("team") 
                for i,team in ipairs(teams) do --- i want get any team but Spectator 
                    local teamName = getTeamName(team) -- get the other teams 
                    setPlayerTeam(player,teamName) --- set any team but Spectator and get his account to save his team  
                end 
            end 
        end 
    end 
) 
                
addEvent("RevokedGroup",true)  --- the Bad guy 
addEventHandler("RevokedGroup",root,  --- the Bad guy 
function (player, Revoked) 
    if (player) then 
    if (Revoked) then 
    setElementData(player,"Account"," Revoked !")  -- set the Cloumn data on scoreboard 
    outputChatBox(getPlayerName(player) .. " [ serverGroup_Revoked !] ! ",255,255,0) 
    if getTeamFromName ( "Spectator" ) then 
    setPlayerTeam(player, getTeamFromName ( "Spectator" )) --- always if he join set him this team unless if he assigned  
    local account = getPlayerAccount(player) 
    if (account) then 
    removeAccount(account) -- remove his account to  
    end 
    end 
    end 
    end 
end) 
  
addEventHandler("onPlayerJoin",root, 
function () 
    bindKey(source,"F3","down",showGUI) 
end) 
  
addEventHandler("onResourceStart",resourceRoot, 
function () 
    for index, player in ipairs(getElementsByType("player")) do 
        bindKey(player,"F3","down",showGUI) 
    end 
end) 
  
function showGUI(thePlayer) 
    if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(thePlayer)),aclGetGroup("Admin")) then 
        triggerClientEvent(thePlayer,"toggleGUI",thePlayer) 
    else 
        outputChatBox("You must be an Admin",thePlayer,255,0,0) 
    end 
end 
  
exports.dxscoreboard:scoreboardAddColumn( "Account" ) 

Client:

GUIEditor_Window = {} 
GUIEditor_Button = {} 
GUIEditor_Grid = {} 
GUIEditor_Image = {} 
  
GUIEditor_Window[1] = guiCreateWindow(448,205,604,391,"[servergroup] Panel  v1.0",false) 
guiWindowSetMovable(GUIEditor_Window[1],false) 
guiWindowSetSizable(GUIEditor_Window[1],false) 
GUIEditor_Grid[1] = guiCreateGridList(9,18,190,409,false,GUIEditor_Window[1]) 
guiGridListAddColumn(GUIEditor_Grid[1],"Players",0.6) 
GUIEditor_Button[1] = guiCreateButton(200,25,158,42,"servergroup_assigned",false,GUIEditor_Window[1]) 
guiSetFont(GUIEditor_Button[1],"clear-normal") 
GUIEditor_Button[2] = guiCreateButton(425,28,170,40,"servergroup_revoked",false,GUIEditor_Window[1]) 
guiSetFont(GUIEditor_Button[2],"clear-normal") 
GUIEditor_Image[1] = guiCreateStaticImage(262,118,318,264,"images/mtalogo.png",false,GUIEditor_Window[1]) 
  
function loadPlayersToGrid() 
    guiGridListClear(GUIEditor_Grid[1]) 
    for index, player in ipairs(getElementsByType("player")) do 
        local row = guiGridListAddRow(GUIEditor_Grid[1]) 
        guiGridListSetItemText(GUIEditor_Grid[1],row,1,tostring(getPlayerName(player)),false,false) 
    end 
end 
loadPlayersToGrid() 
addEventHandler("onClientPlayerJoin",root,loadPlayersToGrid) 
addEventHandler("onClientPlayerQuit",root,loadPlayersToGrid) 
addEventHandler("onClientPlayerChangeNick",root,loadPlayersToGrid) 
  
addEventHandler("onClientGUIClick",root, 
    function () 
        if (source == GUIEditor_Button[1]) then 
            local row,col = guiGridListGetSelectedItem(GUIEditor_Grid[1]) 
            if (row and col and row ~= -1 and col ~= -1) then 
                local playerName = guiGridListGetItemText(GUIEditor_Grid[1], row, 1) 
                local player = getPlayerFromName(playerName) 
                if (player) then 
                    playSound("sounds/servergroup_assigned.wav") 
                    triggerServerEvent("assignGroup",localPlayer,player,false) 
                end 
            end 
        elseif (source == GUIEditor_Button[2]) then 
            local row,col = guiGridListGetSelectedItem(GUIEditor_Grid[1]) 
            if (row and col and row ~= -1 and col ~= -1) then 
                local playerName = guiGridListGetItemText(GUIEditor_Grid[1], row, 1) 
                    playSound("sounds/servergroup_revoked.wav")             
                    triggerServerEvent("RevokedGroup",localPlayer,player,false) 
                end 
            end 
        end 
) 
  
function toggleGUI() 
    if guiGetVisible(GUIEditor_Window[1]) == true then 
        guiSetVisible(GUIEditor_Window[1],false) 
        showCursor(false) 
    else 
        guiSetVisible(GUIEditor_Window[1],true) 
        showCursor(true) 
    end 
end 
addEvent("toggleGUI",true) 
addEventHandler("toggleGUI",root,toggleGUI) 

Link to comment

Server:

addEvent("assignGroup",true) --- the good guy 
addEventHandler("assignGroup",root,  --- the good guy 
    function (player, assign) 
        if (player) then 
            if (assign) then 
                setElementData(player,"Account","Registred !") -- set the Cloumn data on scoreboard 
                outputChatBox(getPlayerName(player) .. " [ serverGroup_assigned] ! ",255,255,0) 
                local teams = getElementsByType("team") 
                for i,team in ipairs(teams) do --- i want get any team but Spectator 
                    setPlayerTeam(player,team) 
                end 
            end 
        end 
    end 
) 
                
addEvent("RevokedGroup",true)  --- the Bad guy 
addEventHandler("RevokedGroup",root,  --- the Bad guy 
function (player, Revoked) 
    if (player) then 
    if (Revoked) then 
    setElementData(player,"Account"," Revoked !")  -- set the Cloumn data on scoreboard 
    outputChatBox(getPlayerName(player) .. " [ serverGroup_Revoked !] ! ",255,255,0) 
    if getTeamFromName ( "Spectator" ) then 
    setPlayerTeam(player, getTeamFromName ( "Spectator" )) 
    local account = getPlayerAccount(player) 
    if (account) then 
    removeAccount(account) -- remove his account to 
    end 
    end 
    end 
    end 
end) 
  
addEventHandler("onPlayerJoin",root, 
function () 
    bindKey(source,"F3","down",showGUI) 
end) 
  
addEventHandler("onResourceStart",resourceRoot, 
function () 
    for index, player in ipairs(getElementsByType("player")) do 
        bindKey(player,"F3","down",showGUI) 
    end 
end) 
  
function showGUI(thePlayer) 
    if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(thePlayer)),aclGetGroup("Admin")) then 
        triggerClientEvent(thePlayer,"toggleGUI",thePlayer) 
    else 
        outputChatBox("You must be an Admin",thePlayer,255,0,0) 
    end 
end 
  
exports.scoreboard:addScoreboardColumn( "Account" ) 

You have too much errors in your code.

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