-
Posts
2,947 -
Joined
-
Last visited
Everything posted by JR10
-
uShapeArea = createColRectangle( 41.2666015625, -2812.1865234375, 2900, 2200 ) setElementDimension( uShapeArea,0 ) setElementInterior( uShapeArea,0 ) function fLeaveShape( uShape, bDim ) setTimer(function(source) if uShape == uShapeArea and bDim and getElementInterior( source ) == 0 then outputChatBox( "Nu ai voie sa iesi din LS!", source, 255, 255, 255 ) killPed ( source ) end end, 2000, 1,source) end addEventHandler( 'onElementColShapeLeave', root, fLeaveShape )
-
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.
-
function onClientGUIChanged() local name = guiGetText(source) for index, player in pairs(getElementsByType("player")) do if string.find(getPlayerName(player):lower(), name:lower()) then --CODE end end end addEventHandler("onClientGUIChanged", guiEdit, onClientGUIChanged)
-
No, it's a resource that comes with MTA 1.2+ (I think), and it does that.
-
Probably he didn't know it's not a resource.
-
zhuo stop bumping topics, check the last post date, it was 2009.
-
Start the 'voice' resource.
-
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)
-
colArea = createColRectangle( 41.2666015625, -2812.1865234375,2900,2200 ) setElementDimension(colArea,0) setElementInterior(colArea,0) function elementColShapeLeave( colShapeLeft ) if colShapeLeft == colArea and getElementInterior(source) == 0 then outputChatBox( "Nu ai voie sa iesi din LS!",source,255,255,255 ) killPed ( source) end end addEventHandler( "onElementColShapeLeave", getRootElement(), elementColShapeLeave )
-
Oh it will work, but it should be: local width,height = guiGetScreenSize() function createText() local playerTeam = getPlayerTeam(localPlayer) if playerTeam then local team = getTeamName(playerTeam) dxDrawText ("Team: "..team, width - 210, height - 41, width, height, tocolor ( 0, 0, 0, 255 ), 1.02, "pricedown" ) else dxDrawText ("Team: None", width - 210, height - 41, width, height, tocolor ( 0, 0, 0, 255 ), 1.02, "pricedown" ) end end addEventHandler ( "onClientRender", root, createText )
-
Yes, when it's executed it will get all teams, whatever they name is.
-
Huh? Maybe: function chatbox(text, msgtype) local account = getAccountName(getPlayerAccount(source)) local name = getPlayerName(source) local tag = getElementData(source, "ID") or 0 local r, g, b = getPlayerNametagColor(source) if (msgtype == 0) then if isObjectInACLGroup("user." .. account, aclGetGroup("HeadAdmin")) then cancelEvent(true) outputChatBox(" #cccccc[".. tag .."] #8B1A1A[HEADADMIN] ".. name ..":".. text, root, r, g, b, true) outputServerLog("CHAT: [HEADADMIN] " .. name .. ": " .. text) elseif isObjectInACLGroup("user." .. account, aclGetGroup("Admin")) then cancelEvent(true) outputChatBox("#cccccc[".. tag .."] #FF0000[ADMIN] " .. name ..":" .. text, root, r, g, b, true) outputServerLog("CHAT: [ADMIN] " .. name .. ": " .. text) elseif isObjectInACLGroup("user." .. account, aclGetGroup("Moderator")) then cancelEvent(true) outputChatBox("#cccccc[".. tag .."] #00FF00[MODERATOR] " .. name .. ":" .. text, root, r, g, b, true) outputServerLog("CHAT: [MODERATOR] " .. name .. ": " .. text) elseif isObjectInACLGroup("user." .. account, aclGetGroup("Everyone")) then cancelEvent(true) outputChatBox("#cccccc[".. tag .."] #FFFFFF" .. name .. ": #FFFFFF" .. text, root, 255, 255, 255, true) outputServerLog("CHAT: " .. name .. ": " .. text) end end end addEventHandler("onPlayerChat", root, chatbox) Stop using bold text, my eyes.
-
73 video tutorials just on C++, this guy is great! Thanks CapY for posting this.
-
That won't work, onClientRender doesn't have a player argument.
-
The problem is the green text when you're logged out? function chatbox(text, msgtype) local account = getAccountName(getPlayerAccount(source)) local name = getPlayerName(source) local tag = getElementData(source, "ID") or 0 local r, g, b = getPlayerNametagColor(source) if (msgtype == 0) then if isObjectInACLGroup("user." .. account, aclGetGroup("HeadAdmin")) then cancelEvent(true) outputChatBox(" #cccccc[".. tag .."] #8B1A1A[HEADADMIN] ".. name ..":#FFFFFF".. text, root, r, g, b, true) outputServerLog("CHAT: [HEADADMIN] " .. name .. ": " .. text) elseif isObjectInACLGroup("user." .. account, aclGetGroup("Admin")) then cancelEvent(true) outputChatBox("#cccccc[".. tag .."] #FF0000[ADMIN] " .. name ..":#FFFFFF " .. text, root, r, g, b, true) outputServerLog("CHAT: [ADMIN] " .. name .. ": " .. text) elseif isObjectInACLGroup("user." .. account, aclGetGroup("Moderator")) then cancelEvent(true) outputChatBox("#cccccc[".. tag .."] #00FF00[MODERATOR] " .. name .. ":#FFFFFF " .. text, root, r, g, b, true) outputServerLog("CHAT: [MODERATOR] " .. name .. ": " .. text) elseif isObjectInACLGroup("user." .. account, aclGetGroup("Everyone")) then cancelEvent(true) outputChatBox("#cccccc[".. tag .."] " .. name .. ": #FFFFFF" .. text, root, 255, 255, 255, true) outputServerLog("CHAT: " .. name .. ": " .. text) end end end addEventHandler("onPlayerChat", root, chatbox) Else explain better.
-
You need a team element to use with getTeamName, and you used the team's name already, so just type it in directly in dxDrawText.
-
That's what he showed you. Check the screenshot again. The voice resource that comes with MTA 1.3 should have that, here it does.
-
Boo.(Like always, how about that for a joke? lol)
-
You need to use end, to end each block. exports["scoreboard"]:addScoreboardColumn("joinTime") function saveTime(player, account) if (account and not isGuestAccount(account)) then local joinTime = getElementData(player,"joinTime") setAccountData(account,"joinTime",joinTime) end end addEventHandler("onPlayerLogout",root, function (prev) saveTime(source, prev) end ) addEventHandler("onPlayerQuit",root, function () saveTime(source, getPlayerAccount(source)) end ) addEventHandler("onPlayerLogin", root, function(_,account) local joinTime = getAccountData(account,"joinTime") if not joinTime then joinTime = 0 end setElementData(source,"joinTime",joinTime) end) This will make a scoreboard column with the online time of everyplayer.
-
Not necessarily, Castillo's code should work.