-
Posts
484 -
Joined
-
Last visited
Everything posted by isa_Khamdan
-
there is a problem in the line 1461 but I didn't find out how to fix it so can anyone help me? function guiCreateWindow(x2, y2, width2, height2, titleBarText2, relative2) local mainBackground = guiCreateStaticImage(x2, y2, width2, height2, "Nexus.png", relative2) local mainBackgroundLabel = guiCreateLabel(0, 0, 0, 0, titleBarText2, false, mainBackground2) guiSetEnabled(mainBackgroundLabel, false) return mainBackground end CONTROL_MARGIN_RIGHT = 5 LINE_MARGIN = 5 LINE_HEIGHT = 16 g_Root = getRootElement() g_ResRoot = getResourceRootElement(getThisResource()) g_Me = getLocalPlayer() server = createServerCallInterface() guiSetInputMode("no_binds_when_editing") --------------------------- -- Set skin window --------------------------- function skinInit() setControlNumber(wndSkin, 'skinid', getElementModel(g_Me)) end function showSkinID(leaf) if leaf.id then setControlNumber(wndSkin, 'skinid', leaf.id) end end function applySkin() local skinID = getControlNumber(wndSkin, 'skinid') if skinID then server.setMySkin(skinID) fadeCamera(true) end end wndSkin = { 'wnd', text = 'Set skin', width = 250, x = -20, y = 0.3, controls = { { 'lst', id='skinlist', width=230, height=290, columns={ {text='Skin', attr='name'} }, rows={xml='skins.xml', attrs={'id', 'name'}}, onitemclick=showSkinID, onitemdoubleclick=applySkin }, {'txt', id='skinid', text='', width=50}, {'btn', id='set', onclick=applySkin}, {'btn', id='close', closeswindow=true} }, oncreate = skinInit } function setSkinCommand(cmd, skin) skin = skin and tonumber(skin) if skin then server.setMySkin(skin) fadeCamera(true) closeWindow(wndSpawnMap) closeWindow(wndSetPos) end end addCommandHandler('', setSkinCommand) addCommandHandler('', setSkinCommand) --------------------------- --- Set animation window --------------------------- function applyAnimation(leaf) if type(leaf) ~= 'table' then leaf = getSelectedGridListLeaf(wndAnim, 'animlist') if not leaf then return end end server.setPedAnimation(g_Me, leaf.parent.name, leaf.name, true, true) end function stopAnimation() server.setPedAnimation(g_Me, false) end wndAnim = { 'wnd', text = 'Set animation', width = 250, x = -20, y = 0.3, controls = { { 'lst', id='animlist', width=230, height=290, columns={ {text='Animation', attr='name'} }, rows={xml='animations.xml', attrs={'name'}}, expandlastlevel=false, onitemdoubleclick=applyAnimation }, {'btn', id='set', onclick=applyAnimation}, {'btn', id='stop', onclick=stopAnimation}, {'btn', id='close', closeswindow=true} } } addCommandHandler('', function(command, lib, name) server.setPedAnimation(g_Me, lib, name, true, true) end ) --------------------------- -- Weapon window --------------------------- function addWeapon(leaf, amount) if type(leaf) ~= 'table' then leaf = getSelectedGridListLeaf(wndWeapon, 'weaplist') amount = getControlNumber(wndWeapon, 'amount') if not amount or not leaf then return end end server.giveMeWeapon(leaf.id, amount) end wndWeapon = { 'wnd', text = 'Give weapon', width = 250, controls = { { 'lst', id='weaplist', width=230, height=280, columns={ {text='Weapon', attr='name'} }, rows={xml='weapons.xml', attrs={'id', 'name'}}, onitemdoubleclick=function(leaf) addWeapon(leaf, 500) end }, {'br'}, {'txt', id='amount', text='500', width=60}, {'btn', id='add', onclick=addWeapon}, {'btn', id='close', closeswindow=true} } } function giveWeaponCommand(cmd, weapon, amount) weapon = tonumber(weapon) or getWeaponIDFromName(weapon) if not weapon then return end amount = amount and tonumber(amount) or 500 server.giveMeWeapon(math.floor(weapon), amount) end addCommandHandler('', giveWeaponCommand) addCommandHandler('', giveWeaponCommand) --------------------------- -- Fighting style --------------------------- addCommandHandler('setstyle', function(cmd, style) style = style and tonumber(style) if style then server.setPedFightingStyle(g_Me, style) end end ) --------------------------- -- Clothes window --------------------------- function clothesInit() if getElementModel(g_Me) ~= 0 then errMsg('You must have the CJ skin set in order to apply clothes.') closeWindow(wndClothes) return end if not g_Clothes then triggerServerEvent('onClothesInit', g_Me) end end addEvent('onClientClothesInit', true) addEventHandler('onClientClothesInit', g_Root, function(clothes) g_Clothes = clothes.allClothes for i,typeGroup in ipairs(g_Clothes) do for j,cloth in ipairs(typeGroup.children) do if not cloth.name then cloth.name = cloth.model .. ' - ' .. cloth.texture end cloth.wearing = clothes.playerClothes[typeGroup.type] and clothes.playerClothes[typeGroup.type].texture == cloth.texture and clothes.playerClothes[typeGroup.type].model == cloth.model or false end table.sort(typeGroup.children, function(a, b) return a.name < b.name end) end bindGridListToTable(wndClothes, 'clothes', g_Clothes, false) end ) function clothListClick(cloth) setControlText(wndClothes, 'addremove', cloth.wearing and 'remove' or 'add') end function applyClothes(cloth) if not cloth then cloth = getSelectedGridListLeaf(wndClothes, 'clothes') if not cloth then return end end if cloth.wearing then cloth.wearing = false setControlText(wndClothes, 'addremove', 'add') server.removePlayerClothes(g_Me, cloth.parent.type) else local prevClothIndex = table.find(cloth.siblings, 'wearing', true) if prevClothIndex then cloth.siblings[prevClothIndex].wearing = false end cloth.wearing = true setControlText(wndClothes, 'addremove', 'remove') server.addPedClothes(g_Me, cloth.texture, cloth.model, cloth.parent.type) end end wndClothes = { 'wnd', text = 'Clothes', x =
-
Thanks for your help
-
---Server Side addEventHandler("onPlayerLogin",root, function (_,acc) if isObjectInACLGroup("user." .. getAccountName(acc),aclGetGroup("Police")) then outputChatBox("* Welcome Admin Man Press n To Open Admin Panel",source,255,255,255,true) end end ) addEvent( "destroy", true) ----destroy car addEventHandler( "destroy", getRootElement(), function ( PlayerNick ) local toWho = getPlayerFromName ( PlayerNick ) local name = getPlayerName ( source ) local theVehicle = getPedOccupiedVehicle ( toWho ) if ( isElement(theVehicle) ) then destroyElement ( theVehicle ) outputChatBox("* Your vehicle has been destroyed by ".. name .."", toWho, 255, 0, 0, true ) else outputChatBox("* he don't have a car !!", source, 255, 0, 0, true ) end end ) --------------- addEvent("slap", true) function slap( PlayerNick ) local toWho = getPlayerFromName ( PlayerNick ) local name = getPlayerName ( source ) data = 100 if ( getElementHealth ( toWho ) > 0 ) and ( not isPedDead ( toWho ) ) then if ( tonumber ( data ) > getElementHealth ( toWho ) ) then setTimer ( killPed, 50, 1, toWho ) else setElementHealth ( toWho, getElementHealth ( toWho ) - data ) end local x, y, z = getElementVelocity ( toWho ) setElementVelocity ( toWho, x , y, z + 0.2 ) outputChatBox("* [ #ffff00".. PlayerNick .."#ff0000 ] #999999 has been slapped by#ff0000 [ #ffff00" .. name .."#ff0000 ]", root, 255, 0, 0, true ) end end addEventHandler("slap", getRootElement(),slap) ------------------ function loggedOut ( ) triggerClientEvent ( source, "police", source, false ) end addEventHandler( "onPlayerLogout", getRootElement(), loggedOut ) function polstart ( player ) local accName = getAccountName ( getPlayerAccount ( player ) ) if ( hasObjectPermissionTo ( player, "function.kickPlayer", false ) ) then triggerClientEvent ( player, "police", player, true ) end end addEvent( "polstart", true ) addEventHandler( "polstart", getRootElement(), polstart ) function onPlayerLogin ( ) polstart ( source ) end addEventHandler("onPlayerLogin", getRootElement(), onPlayerLogin )
-
ok I have a panel and I want it to be visible for people in police group only so I made this code but when I tested it it didn't work the panel can be opened by anyone have the access to the admin panel [lua]addEventHandler("onPlayerLogin",root, function (_,acc) if isObjectInACLGroup("user." .. getAccountName(acc),aclGetGroup("Police")) then outputChatBox("* Press n To Open Police Panel",source,255,255,255,true) end end ) [/lua]
-
Hello , I have tag system with a function that replace bad words in the list with "*" but I want to change it so it remove the whole text and replace it with another text like when you say you are bitch it will remove the whole text and replace it with "Insult isn't allowed" That's the code addEventHandler("onPlayerChat", getRootElement(), function(text, msgtype) local result = SQLS3D.qury("SELECT * FROM Tags_System") if ( type ( result ) == "table" and #result == 0 or not result ) then return end local account = getAccountName(getPlayerAccount(source)) local name = getPlayerName(source) local new = "" local iter = 0 msg = string.gsub(text,"ـ","") for word in msg:gmatch("%S+") do iter = iter + 1 for i,swr in ipairs(words) do local src = word:lower():gsub("%s","") local src = src:gsub("#%x%x%x%x%x%x","") local src = src:gsub("%c","") local src = src:gsub("%p","") local pat = swr:lower():gsub("%s","") if src:find(pat) then local replaceString = "" for x=1,word:gsub("#%x%x%x%x%x%x",""):len() do replaceString = replaceString.."*" end word = word:gsub(word,replaceString) end end if iter == 1 and word:len() > 2 then word = word:gsub("%a",string.upper,1) end new = new..word.." " end
-
hmm can you show me an example? that's the whole script --Server Side LastMessage = "" function wla(player,cmd,...) local accName = getAccountName (getPlayerAccount(player)) if isObjectInACLGroup("user." .. accName, aclGetGroup("Admin1")) or isObjectInACLGroup("user." .. accName, aclGetGroup("Console")) then local veve = {...} local message = table.concat(veve, " ") LastMessage = message triggerClientEvent("new", getRootElement(),message) end end addCommandHandler("AM", wla) function onLoad() for _,v in ipairs(getElementsByType("Player")) do local acc = getPlayerAccount(v) if isObjectInACLGroup("user."..getAccountName(acc), aclGetGroup("Admin1")) or isObjectInACLGroup("user."..getAccountName(acc), aclGetGroup("Console")) then bindKey(v,"u","down","chatbox","AM") end end end addEventHandler("onResourceStart", resourceRoot, onLoad) addEventHandler("onPlayerLogin",root, function(_,acc) if isObjectInACLGroup("user."..getAccountName(acc), aclGetGroup("Admin1")) or isObjectInACLGroup("user."..getAccountName(acc), aclGetGroup("Console")) then bindKey(source,"u","down","chatbox","AM") triggerClientEvent("new", getRootElement(),LastMessage) end end) function justme(thePlayer) if ( hasObjectPermissionTo (thePlayer, "command.shutdown", true) ) then triggerClientEvent(thePlayer, "openWindow1", getRootElement()) else outputChatBox ("This for admin only", thePlayer, 193, 13, 13) end end addCommandHandler("xxx", justme) ---Client Side function rgbTo (Nu9aif_1, Nu9aif_1_1, Nu9aif_2) local Nu9aif = "#" Nu9aif_1 = string.format("%X", Nu9aif_1) Nu9aif = Nu9aif .. (string.len(Nu9aif_1) == 1 and "0" .. Nu9aif_1 or Nu9aif_1) Nu9aif_1_1 = string.format("%X", Nu9aif_1_1) Nu9aif = Nu9aif .. (string.len(Nu9aif_1_1) == 1 and "0" .. Nu9aif_1_1 or Nu9aif_1_1) Nu9aif_2 = string.format("%X", Nu9aif_2) Nu9aif = Nu9aif .. (string.len(Nu9aif_2) == 1 and "0" .. Nu9aif_2 or Nu9aif_2) return Nu9aif end function dxDrawColorText(str, ax, ay, bx, by, color, scale, font, alignX, alignY) bx, by, color, scale, font = bx or ax, by or ay, color or tocolor(255,255,255,255), scale or 1, font or "default" if alignX then if alignX == "center" then ax = ax + (bx - ax - dxGetTextWidth(str:gsub("#%x%x%x%x%x%x",""), scale, font))/2 elseif alignX == "right" then ax = bx - dxGetTextWidth(str:gsub("#%x%x%x%x%x%x",""), scale, font) end end if alignY then if alignY == "center" then ay = ay + (by - ay - dxGetFontHeight(scale, font))/2 elseif alignY == "bottom" then ay = by - dxGetFontHeight(scale, font) end end local alpha = string.format("%08X", color):sub(1,2) local pat = "(.-)#(%x%x%x%x%x%x)" local s, e, cap, col = str:find(pat, 1) local last = 1 while s do if cap == "" and col then color = tocolor(getColorFromString("#"..col..alpha)) end if s ~= 1 or cap ~= "" then local w = dxGetTextWidth(cap, scale, font) dxDrawText(cap, ax, ay, ax + w, by, color, scale, font) ax = ax + w color = tocolor(getColorFromString("#"..col..alpha)) end last = e + 1 s, e, cap, col = str:find(pat, last) end if last <= #str then cap = str:sub(last) dxDrawText(cap, ax, ay, ax + dxGetTextWidth(cap, scale, font), by, color, scale, font) end end GTN_Window = {} GTN_Button = {} GTN_Checkbox = {} GTN_Label = {} GTN_Edit = {} GTN_Grid = {} GTN_Window[1] = guiCreateWindow(130,237,267,180,"Text Color",false) guiSetVisible(GTN_Window[1], false) guiWindowSetSizable(GTN_Window[1], false) guiSetFont(GTN_Window[1], "default-bold-small") GTN_Label[2] = guiCreateLabel(070,040,16,15,"R",false,GTN_Window[1]) guiLabelSetColor(GTN_Label[2],255,0,0) GTN_Label[3] = guiCreateLabel(118,039,21,14,"G",false,GTN_Window[1]) guiLabelSetColor(GTN_Label[3],0,255,0) GTN_Label[4] = guiCreateLabel(167,038,24,15,"B",false,GTN_Window[1]) guiLabelSetColor(GTN_Label[4],0,0,255) GTN_Edit[2] = guiCreateEdit(060,058,40,22,"",false,GTN_Window[1]) GTN_Edit[3] = guiCreateEdit(110,058,40,22,"",false,GTN_Window[1]) GTN_Edit[4] = guiCreateEdit(154,58,40,22,"",false,GTN_Window[1]) GTN_Button[2] = guiCreateButton(110,089,74,27,"OK",false,GTN_Window[1]) GTN_Label[6] = guiCreateLabel(017,101,77,17,"Color of the Text",false,GTN_Window[1]) guiLabelSetColor(GTN_Label[6],255,255,255) GTN_Label[7] = guiCreateLabel(038,132,187,17,"All Copyrights Reversed To Nu9aiF",false,GTN_Window[1]) guiLabelSetColor(GTN_Label[7],255,255,0) function onGuiClick (button, state, absoluteX, absoluteY) if (source == GTN_Button[2]) then getrpxr = guiGetText(GTN_Edit[2]) getrpxg = guiGetText(GTN_Edit[3]) getrpxb = guiGetText(GTN_Edit[4]) guiLabelSetColor ( GTN_Label[6], getrpxr, getrpxg, getrpxb ) end end addEventHandler("onClientGUIClick", getRootElement(), onGuiClick ) function setTextColorPanel () if (guiGetVisible(GTN_Window[1]) == true) then guiSetVisible(GTN_Window[1], false) showCursor(false) else guiSetVisible(GTN_Window[1], true) showCursor(true) end end addEvent("openWindow1",true) addEventHandler("openWindow1", getRootElement(), setTextColorPanel) message = "" function start(msg) message = msg CodColor = msg end addEvent("new", true ) addEventHandler("new", getRootElement(), start) function as() local r, g, b = getPlayerNametagColor(getLocalPlayer()) local r1, g1, b1 = guiLabelGetColor (GTN_Label[6]) dxDrawText("Admin : ",13.0,220.0,61.0,206.0,tocolor(255,0,0,255),1.0,"default-bold","left","top",false,false,false) dxDrawColorText (""..rgbTo(r, g, b)..""..getPlayerName(getLocalPlayer()).. " :".. rgbTo(r1, g1, b1).." ".. message,55.0,220.0,264.0,226.0,tocolor(255,255,0,255),1.0,"default-bold","left","top",false,false,false) end addEventHandler("onClientRender", getRootElement(), as)
-
ok I have this admin msg script but it have one problem , it show the player name instead of the name of the admin who sent the message so can someone tell me how to fix it? function as() local r, g, b = getPlayerNametagColor(getLocalPlayer()) local r1, g1, b1 = guiLabelGetColor (GTN_Label[6]) dxDrawText("Admin : ",13.0,220.0,61.0,206.0,tocolor(255,0,0,255),1.0,"default-bold","left","top",false,false,false) dxDrawColorText (""..rgbTo(r, g, b)..""..getPlayerName(getLocalPlayer()).. " :".. rgbTo(r1, g1, b1).." ".. message,55.0,220.0,264.0,226.0,tocolor(255,255,0,255),1.0,"default-bold","left","top",false,false,false) end addEventHandler("onClientRender", getRootElement(), as)
-
1.- Open the gui what u want to edit 2.- Start guieditor resource 3.- type /guied 4.- Load the gui what u want to edit (right click then load) 5 .- "Click somewhere out of the window, and then output" Take a look here if u need more help in guieditor... viewtopic.php?f=108&t=22831 are you sure this will work?
-
hmm what about other GUI's how can I load them? like the business system on the community
-
I want to edit the design only not the other functions and stuffs
-
ok I have a freeroam script how can I edit it using the GUI editor?
-
Hello , I used GUI Editor and it works very well but I didn't find out how to save my work after finishing so can anyone who have used it how can I do that?
-
Works fine now Thanks a lot
-
Where should I place the country names code?
-
like this? countryNames = { ["IT"]="Italy", ["MX"]="Mexico", ["SA"]="SAUDI ARBIA", ["EG"]="EGYPT" } addEventHandler("onPlayerJoin", getRootElement(), function() local country = exports['admin']:getPlayerCountry(source) if country then setElementData(source, "Country", country) local thecountry = countryNames[country] exports.killmessages:outputMessage("* #FFFF00[ ".. getPlayerName(source) .." #FFFF00] #6E6A6BHas Joined The Server From #FF8900[' .. tostring(thecountry) .. '] ', getRootElement(), 2, 255, 2, true) end end)
-
How can I add country name when a player join the server? addEventHandler("onPlayerJoin", getRootElement(), function() exports.killmessages:outputMessage("* #FFFF00[ ".. getPlayerName(source) .." #FFFF00] #6E6A6BHas Joined The Server", root,0,255,0) end)
-
How can I make this Function Repeat Every 2 Minutes? function max() exports.killmessages:outputMessage("* Online Players : ".. getPlayerCount() .."/".. getMaxPlayers() .."", root,250,250,0) end setTimer (max, 1000,1)
-
so they are in these two files?