-
Posts
843 -
Joined
-
Last visited
-
Days Won
1
Everything posted by Bilal135
-
One more problem, only I can see the new name in the panel, why not others? Please help.
-
I added one more thing, and now always outputs: "Player not found". function adduser_func ( player, cmd, target ) local target = getPlayerFromPartialName ( target ) if target then local row = guiGridListAddRow(GUIEditor.gridlist[1]) guiGridListSetItemText(GUIEditor.gridlist[1], row, column, getPlayerName(target), false, false) guiGridListSetItemText(GUIEditor.gridlist[1], row, column1, "Warden", false, false) outputChatBox("Player has been added to F5 menu sucessfully.", 0, 255, 0) else outputChatBox("* Player not found.", 255, 0, 0) end end addCommandHandler ( "adduser", adduser_func )
-
GUIEditor = { gridlist = {}, window = {}, button = {} } addEventHandler("onClientResourceStart", root, function() GUIEditor.window[1] = guiCreateWindow(552, 217, 275, 289, "Important People", false) guiWindowSetSizable(GUIEditor.window[1], false) guiSetVisible(GUIEditor.window[1], false) GUIEditor.gridlist[1] = guiCreateGridList(9, 27, 256, 202, false, GUIEditor.window[1]) column = guiGridListAddColumn(GUIEditor.gridlist[1], "Name", 0.5) guiGridListAddColumn(GUIEditor.gridlist[1], "Rank", 0.5) for i = 1, 2 do guiGridListAddRow(GUIEditor.gridlist[1]) end guiGridListSetItemText(GUIEditor.gridlist[1], 0, 1, "[AV]Bilal", false, false) guiGridListSetItemText(GUIEditor.gridlist[1], 0, 2, "Admin", false, false) guiGridListSetItemText(GUIEditor.gridlist[1], 1, 1, "[immortal]Desik", false, false) guiGridListSetItemText(GUIEditor.gridlist[1], 1, 2, "Super Moderator", false, false) GUIEditor.button[1] = guiCreateButton(84, 239, 103, 38, "Close", false, GUIEditor.window[1]) guiSetVisible(GUIEditor.window[1], false) end ) function showTheGui() local v = guiGetVisible( GUIEditor.window[1] ) guiSetVisible(GUIEditor.window[1], not v ) showCursor ( not isCursorShowing ( ) ) end addCommandHandler("staff", showTheGui) bindKey("F5", "down", showTheGui) function onGuiClick() if (source == GUIEditor.button[1]) then guiSetVisible(GUIEditor.window[1], false) showCursor(false) end end addEventHandler("onClientGUIClick", root, onGuiClick) function getPlayerFromPartialName(name) local name = name and name:gsub("#%x%x%x%x%x%x", ""):lower() or nil if name then for _, player in ipairs(getElementsByType("player")) do local name_ = getPlayerName(player):gsub("#%x%x%x%x%x%x", ""):lower() if name_:find(name, 1, true) then return player end end end end function adduser_func ( player, cmd, target ) local target = getPlayerFromPartialName ( target ) if target then local row = guiGridListAddRow(GUIEditor.gridlist[1]) guiGridListSetItemText(GUIEditor.gridlist[1], row, column, getPlayerName(target), false, false) outputChatBox("Player has been added to F5 menu sucessfully.", player, 0, 255, 0) else outputChatBox("* Player not found.", player, 255, 0, 0) end end addCommandHandler ( "adduser", adduser_func ) I tried my best to fix it, but I couldn't. /adduser is not working. No errors in debugscript. Thanks in advance.
-
I even tried this, but still doesnt work. function destroyBlipAttachedTo(player) local attachedElements = getAttachedElements(player) if attachedElements then for i, attachedElement in ipairs(attachedElements) do if getElementType(attachedElement) == "blip" then destroyElement(attachedElement) end end end end addEventHandler("onPlayerQuit", root, destroyBlipAttachedTo)
-
When someone quits the game, his blip is still left there. I added this to the code: addEventHandler("onPlayerQuit", root, function() destroyBlipAttachedTo(source) end ) Still didn't work.
-
I really don't know how should I do that, since I am still learning. Can anyone fix my code so that I can learn?
-
I want the color of player's blips to be their team color, if they have a team, otherwise random. I tried editing the playerblips resource, but it just sets everyone's blip color to red. This is my code. function team(source) local r, g, b local playerTeam = getPlayerTeam( source ) if ( playerTeam ) then r, g, b = getTeamColor ( playerTeam ) setBlipColor(blip, r, g, b) end end addEventHandler("onPlayerLogin", resourceRoot, team) addEventHandler("onResourceStart", resourceRoot, team) -- Add console command to print out your team information addCommandHandler ( "teamInfo", teamInfo ) addEventHandler("onResourceStart", root, team) -- needs configurable blip colors, and team support root = getRootElement () color = { r, g, b } players = {} resourceRoot = getResourceRootElement ( getThisResource () ) function onResourceStart ( resource ) for id, player in ipairs( getElementsByType ( "player" ) ) do if ( players[player] ) then blip = createBlipAttachedTo ( player, 0, 2, players[source][1], players[source][2], players[source][3] ) else blip = createBlipAttachedTo ( player, 0, 2, color[1], color[2], color[3] ) end end end function onPlayerSpawn ( spawnpoint ) if ( players[source] ) then blip = createBlipAttachedTo ( source, 0, 2, players[source][1], players[source][2], players[source][3] ) else blip = createBlipAttachedTo ( source, 0, 2, color[1], color[2], color[3] ) end end function onPlayerQuit () destroyBlipsAttachedTo ( source ) end function onPlayerWasted ( totalammo, killer, killerweapon ) destroyBlipsAttachedTo ( source ) end function setBlipsColor ( source, commandName, r, g, b ) if ( tonumber ( b ) ) then color = { tonumber ( r ), tonumber ( g ), tonumber ( b ) } for id, player in ipairs( getElementsByType ( "player" ) ) do destroyBlipsAttachedTo ( player ) if ( players[player] ) then blip = createBlipAttachedTo ( player, 0, 2, players[source][1], players[source][2], players[source][3] ) else blip = createBlipAttachedTo ( player, 0, 2, color[1], color[2], color[3] ) end end end end function setBlipColor ( source, commandName, r, g, b ) if ( tonumber ( b ) ) then destroyBlipsAttachedTo ( source ) players[source] = { tonumber ( r ), tonumber ( g ), tonumber ( b ) } createBlipAttachedTo ( source, 0, 2, players[source][1], players[source][2], players[source][3] ) end end addCommandHandler ( "setblipscolor", setBlipsColor ) addCommandHandler ( "setblipcolor", setBlipColor ) addEventHandler ( "onResourceStart", resourceRoot, onResourceStart ) addEventHandler ( "onPlayerSpawn", root, onPlayerSpawn ) addEventHandler ( "onPlayerQuit", root, onPlayerQuit ) addEventHandler ( "onPlayerWasted", root, onPlayerWasted ) function destroyBlipsAttachedTo(player) local attached = getAttachedElements ( player ) if ( attached ) then for k,element in ipairs(attached) do if getElementType ( element ) == "blip" then destroyElement ( element ) end end end end Thanks in advance.
-
My GUI doesn't appear while it should. GUIEditor = { button = {}, window = {}, memo = {} } addEventHandler("onClientResourceStart", resourceRoot, function() GUIEditor.window[1] = guiCreateWindow(323, 178, 709, 429, "FGF Rules", false) guiWindowSetSizable(GUIEditor.window[1], false) guiSetAlpha(GUIEditor.window[1], 1.00) GUIEditor.button[1] = guiCreateButton(620, 386, 73, 28, "Close", false, GUIEditor.window[1]) GUIEditor.memo[1] = guiCreateMemo(12, 35, 681, 341, "Rules \n \nRule 1 Follow all public communication standards. \nRule 1.1 No speaking non-english in public chat. \nRule 1.2 No posting junk in public chat. \n \nFollowing all public communication standards is a main and most broken rule. Any non-english language should not be spoken into the global chat. Posting junk in public chat refers to non-sense posts, or which may make the chat look ugly, for example ajjajajaja or something slang. \n \nRule 2 No hacking or abusing. \nRule 2.1 No hacking. \nRule 2.2 No abusing. \nRule 2.3 No abusing no dm to disturb players. \n \nAny kind of trainers or illegal hacking tricks or hacking programs should not be used for own \nbenefits. Any FGF or MTA bug should not be abused or may lead to a ban or kick. Abusing no dm refers when you are using no dm just to disturb or irritate someone. \n \nRule 3 No annoying or trolling. \nRule 3.1 No annoying. \nRule 3.2 No trolling. \nRule 3.3 No provoking. \n \nAny annoying, trolling, or provoking behavior to any staff member or player will not be tolerated and may lead to long-time mutes. \n \nRule 4 No advertising other servers. \n \nRule 5 No disturbing neutral staff. \n \nDisturbing neutral staff means staying near them, hijacking their vehicles, or killing them without any reason. Please be noted that when any staff member is not shooting you, you must not shoot him, otherwise this rule applies. (Ban/kick) \n \nRule 6 No leeching from the server. \n \nLeeching from the server refers to any activity unbeneficial for FGF and its players, may lead to long duration bans and accounts being deleted.", false, GUIEditor.window[1]) guiSetVisible(GUIEditor.window[1], false) end ) Error: 13 line: Unfinished string near ""Rules'
-
dx_1 and dx_2 appears together (this is weird), and the third one appears alone (as it should be). Also if I set it to 1, it only appears once and never appears again. I want, for example, dx_1 to appear first, then it disappears and dx_2 appears, then it disappears and dx_3 appears. This process should continue.
-
function dx_1() dxDrawRectangle(459, 0, 428, 37, tocolor(0, 0, 0, 181), false) dxDrawText("*INFO*", 470, 4, 508, 23, tocolor(255, 255, 255, 255), 1.00, "default-bold", "left", "top", false, false, false, false, false) dxDrawText("Don't forget to check out the site zombie-stampede.enjin.com", 518, 4, 877, 23, tocolor(255, 255, 255, 255), 1.00, "default", "left", "top", false, false, false, false, false) end function dx_2() dxDrawRectangle(459, 0, 398, 53, tocolor(0, 0, 0, 181), false) dxDrawText("*INFO*", 470, 4, 508, 23, tocolor(255, 255, 255, 255), 1.00, "default-bold", "left", "top", false, false, false, false, false) dxDrawText("Lets keep the server running help support the server with a", 518, 4, 877, 23, tocolor(255, 255, 255, 255), 1.00, "default", "left", "top", false, false, false, false, false) dxDrawText("small donation. You will be rewarded.", 472, 28, 847, 47, tocolor(255, 255, 255, 255), 1.00, "default", "left", "top", false, false, false, false, false) end function dx_3() dxDrawRectangle(508, 0, 257, 33, tocolor(0, 0, 0, 181), false) dxDrawText("*INFO*", 518, 4, 556, 23, tocolor(255, 255, 255, 255), 1.00, "default-bold", "left", "top", false, false, false, false, false) dxDrawText("Remember to read the rules at F1.", 568, 4, 927, 23, tocolor(255, 255, 255, 255), 1.00, "default", "left", "top", false, false, false, false, false) end function dx1() addEventHandler("onClientRender", root, dx_1) setTimer(function() removeEventHandler("onClientRender", root, dx_1) end, 1000, 0) end dx1() function dx2() setTimer(function() addEventHandler("onClientRender", root, dx_2) end, 2000, 0) removeEventHandler("onClientRender", root, dx_2) end dx2() function dx3() setTimer(function() addEventHandler("onClientRender", root, dx_3) end, 3000, 0) removeEventHandler("onClientRender", root, dx_3) end dx3() Error: lua 30 and lua 38 : addEventHandler ['onClientRender' with this function is already handled]
-
deliveryBaseLV = createPickup(1463.8021240234,2823.7890625,10.8203125,3,1210,0,0) blip = createBlip(1463.8021240234,2823.7890625,100, 37, 2, 255, 255, 255, 255, 0, 400) function pickupMallete(player) destroyElement(deliveryBaseLV) destroyElement(blip) burger = createObject(1230, 0, 0, 0) blpmallete = createBlipAttachedTo(burger, 37) attachElements(burger, player, 12, 0, 0.1, 0.3, 0, 180, 0) triggerClientEvent(player, "delivery:gotJob", player) end addEventHandler("onPickupHit", deliveryBaseLV , pickupMallete)
-
function buttons() btn = guiCreateButton(430, 246, 218, 44, "", false) guiSetAlpha(btn, 0.00) guiSetProperty(btn, "Alpha", "0.000000") btn2 = guiCreateButton(430, 300, 218, 41, "", false) guiSetAlpha(btn2, 0.00) guiSetProperty(btn2, "Alpha", "0.000000") end So, now I removed "dx" thingy at the end of buttons, but it worked when I clicked all over the dx rectangle many times rapidly, and for once it really detected the click. But it doesn't happen always, mainly the problem is still there. Any help regarding this or how can I detect the click?
-
I created a dx rectangle all over a screen, created some dx rectangles and added some dx text in them (as buttons). Then I created some buttons on the dx rectangles, and set their alpha to 0. Now I made them fully functional in script, but when I click them IG, the next GUI doesn't appear. Here's how I created the buttons: function buttons() btn = guiCreateButton(430, 246, 218, 44, "", false, false, dx) guiSetAlpha(btn, 0.00) guiSetProperty(btn, "Alpha", "0.000000") btn2 = guiCreateButton(430, 300, 218, 41, "", false, false, dx) guiSetAlpha(btn2, 0.00) guiSetProperty(btn2, "Alpha", "0.000000") end Here's how I created the dx: function dx() dxDrawRectangle(0, 0, 1366, 768, tocolor(51, 51, 51, 254), false) dxDrawImage(664, 161, 378, 317, "images/mwmta.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) dxDrawRectangle(431, 247, 217, 43, tocolor(0, 0, 0, 126), false) dxDrawText("Multiplayer Campaign", 461, 257, 617, 280, tocolor(255, 255, 255, 255), 1.30, "default", "left", "top", false, false, false, false, false) dxDrawRectangle(431, 300, 217, 41, tocolor(0, 0, 0, 126), false) dxDrawText("Disconnect", 499, 310, 580, 329, tocolor(255, 255, 255, 255), 1.30, "default", "left", "top", false, false, false, false, false) end Here's how I made the DX appear: addEvent("onPlrLoginMan", true) addEventHandler("onPlrLoginMan", root, function() addEventHandler("onClientRender", root, dx) addEventHandler("onClientRender", root, buttons) end ) Here's how I detect click and other things: function onGuiClick() if ( source == btn ) then removeEventHandler("onClientRender", root, dx) removeEventHandler("onClientRender", root, buttons) triggerEvent("teamSelector", localPlayer) end if ( source == btn2 ) then kickPlayer(localPlayer, true) --My bad, I know this has to be done server sided. end end addEventHandler("onClientGUIClick", root, onGuiClick) Maybe its not detecting the click or maybe the button is created under the dx? But I remember I created it right on the dx rectangle. Any fix for this? Thanks in advance.
-
Untested. addEventHandler("onClientResourceStart", resourceRoot, function() window = guiCreateWindow(266, 121, 184, 287, "Skin Panel", false) guiWindowSetSizable(window, false) gridlist = guiCreateGridList(9, 20, 165, 257, false, window) column = guiGridListAddColumn(gridlist, "Skins", 0.9) for i = 1, 1 do guiGridListAddRow(window) end guiGridListSetItemText(gridlist, 0, 1, "Punk", false, false) --you need to create a button here as well. Name it something like "Select". guiSetVisible(window, false) end ) function showTheGui() local v = guiGetVisible( window ) guiSetVisible(window, not v ) showCursor ( not isCursorShowing ( ) ) end addCommandHandler("opengui", showTheGui) bindKey("F1", "down", showTheGui) function setTheSkin() if ( source == yourButtonElement ) then local row = guiGridListGetSelectedItem( gridlist ) local name = guiGridListGetItemText( window, row, column) if name == "Punk" then setElementModel(localPlayer, skinID) end end end addEventHandler("onClientGUIClick", root, setTheSkin) Next time, no one is going to make the whole code for you. Take it as an example and learn.
-
My question is that does setElementData and triggering events server side and client side frequently cause lags? or if we use setElementData frequently, will it cause some bugs or not work properly? Thanks in advance.
-
R.I.P English. Why would you comment on his English, when yours isn't so crash hot either? I could have written much better English but I was on a mobile device, so its hard to type.