Jump to content

King12

Members
  • Posts

    437
  • Joined

  • Last visited

Everything posted by King12

  1. GUIEditor = { label = {}, window = {}, edit = {}, staticimage = {} } addEventHandler("onClientResourceStart", resourceRoot, function() GUIEditor.staticimage[1] = guiCreateStaticImage(0.22, -0.02, 0.55, 0.99, "images/news.png", true) guiSetVisible(GUIEditor.staticimage[1],false) GUIEditor.staticimage[2] = guiCreateStaticImage(0.17, 0.03, 0.67, 0.97, "images/hand.png", false, GUIEditor.staticimage[1]) GUIEditor.edit[1] = guiCreateEdit(46, 36, 308, 22, "", false, GUIEditor.window[1]) end ) addEventHandler("onClientGUIClick", guiRoot, function() if source == GUIEditor.staticimage[2] then setTimer(triggerServerEvent, 500, 1, "send", resourceRoot, tonumber(guiGetText(GUIEditor.edit[1]))) end end ) -- server side addEvent("send", true) addEventHandler("send", resourceRoot, function ( number ) -- blabla.. end )
  2. على كذا نستخدم الايفنت حق client-side addEventHandler("onClientPlayerWeaponSwitch", root, function () toggleControl ( 'next_weapon', false ) toggleControl ( 'previous_weapon', false ) outputChatBox( "Weapons are not permitted!", 255, 0, 0) setPedWeaponSlot( localPlayer, 0 ) end) "onClientPreRender" المفروض ماتستخدمها لأنه فيه أحداث مخصصة لهذي الأمور.
  3. addEventHandler("onPlayerWeaponSwitch", root, function () takeAllWeapons (source) toggleControl ( source, 'fire', false ) outputChatBox( "Weapons are not permitted!", source, 255, 0, 0) end) وخلصنا.
  4. Use Dutchman101's script and learn about textures. https://community.multitheftauto.com/?p=resources&s=details&id=14907
  5. -- Client side addEventHandler("onClientResourceStart", resourceRoot, function() window1 = guiCreateWindow(509, 175, 311, 452, "Revive Panel", false) guiWindowSetSizable(window1, false) guiSetVisible( window1 ,false) gridlist = guiCreateGridList(13, 26, 288, 341, false, window1) guiGridListAddColumn(gridlist, "Players", 0.9) Button1 = guiCreateButton(17, 379, 139, 63, "Revive Player", false, window1) Button2 = guiCreateButton(166, 379, 135, 63, "Close", false, window1) guiGridListClear(gridlist) end ) addCommandHandler('rp', function () guiSetVisible(window1,not guiGetVisible(window1)) showCursor(guiGetVisible(window1)) changeGridListToPlayersAround ( gridlist, 1, 5 ) end ) -- Close button addEventHandler ( "onClientGUIClick",root, function () if (source == Button2) then guiSetVisible( window1 ,false) showCursor(false) end end ) -- Health button addEventHandler ( "onClientGUIClick", resourceRoot, function () if (source == Button1) then local gRow, gColumn =( guiGridListGetSelectedItem ( gridlist ) ) if gRow >= 0 then local PlayerName = guiGridListGetSelectedItemText ( gridlist ) local target = getPlayerFromName(PlayerName) triggerServerEvent("onPlayerHealed", resourceRoot, target) guiSetVisible( window1 ,false) showCursor(false) else outputChatBox("Select a player to heal!", 0, 255, 0) end end end) -- [[ Useful functions ]] -- function guiGridListGetSelectedItemText ( gridList, column ) local item = guiGridListGetSelectedItem ( gridList ) if item then return guiGridListGetItemText ( gridList, item, column or 1 ) end return false end function isElementInRange(ele, x, y, z, range) if isElement(ele) and type(x) == "number" and type(y) == "number" and type(z) == "number" and type(range) == "number" then return getDistanceBetweenPoints3D(x, y, z, getElementPosition(ele)) <= range -- returns true if it the range of the element to the main point is smaller than (or as big as) the maximum range. end return false end function changeGridListToPlayersAround ( gridlist, column, range ) if type ( column ) == 'number' and type ( range ) == 'number' and getElementType ( gridlist ) == 'gui-gridlist' then guiGridListClear ( gridlist ) for i,v in ipairs ( getElementsByType ( 'player' ) ) do if ( v ~= localPlayer ) then local x, y, z = getElementPosition ( localPlayer ) if isElementInRange ( v, x, y, z, range ) then local row = guiGridListAddRow ( gridlist ) return guiGridListSetItemText ( gridlist, row, column, getPlayerName ( v ), false, false ) end end end else return false end end function refreshgirdlist () for _,v in ipairs ( getElementsByType ( "player" ) ) do x,y,z = getElementPosition(localPlayer) x1,y1,z1 = getElementPosition(v) Distance = getDistanceBetweenPoints3D (x,y,z,x1,y1,z1) if Distance <= 50 then end end end -- Server side addEvent("onPlayerHealed", true) addEventHandler("onPlayerHealed", resourceRoot, function (target) if isElement (target) then outputChatBox( string.gsub(getPlayerName(target), "#%x%x%x%x%x%x", "") .. " has been healed.", client, 0, 255, 0, true) setElementHealth( target, 100 ) end end) ما تأكدت من سالفة المسافة لكن المفروض أن حركتك تضبط زي ماسويتها أنت, وبالنسبه للوحة تفتح عندي بدون مشاكل.
  6. -- Client side exports.killmessages:outputMessage ( message, r, g, b, font ) -- Server side exports.killmessages:outputMessage ( message, visibleTo, r, g, b, font ) addEventHandler("onPlayerQuit", root, function (quitType) local name = string.gsub(getPlayerName(source), "#%x%x%x%x%x%x", "") exports.killmessages:outputMessage ( name.. "has left the server. [" ..quitType.. "]", root, 255, 255, 255, "default" ) end ) Try using the killmessages functions.
  7. Add the useful function in your code then. function isPlayerInTeam(player, team) assert(isElement(player) and getElementType(player) == "player", "Bad argument 1 @ isPlayerInTeam [player expected, got " .. tostring(player) .. "]") assert((not team) or type(team) == "string" or (isElement(team) and getElementType(team) == "team"), "Bad argument 2 @ isPlayerInTeam [nil/string/team expected, got " .. tostring(team) .. "]") return getPlayerTeam(player) == (type(team) == "string" and getTeamFromName(team) or (type(team) == "userdata" and team or (getPlayerTeam(player) or true))) end
  8. فرق قوة اللغة اللي تستخدمها متا لحالها تكفي.
  9. لو انه غلط كان مانزلته.
  10. addEventHandler("onPlayerJoin", root, function () local teams = getElementsByType ( "team" ) for ID, team in pairs (teams) do local teamID = math.random ( 0, ID ) local match = teams[teamID] if match then setPlayerTeam ( source, team ) end end end)
  11. محد لاحظ أن الفلوس سترنق, المفروض تحولونها لرقم في givePlayerMoney وفي triggerClientEvent, الارقمنت الثالث لازم يكون الالمنت اللي بنربطه للاعب اللي هو ال Resource. Client side: GUIEditor = { scrollpane = {}, edit = {}, button = {}, window = {}, label = {}, memo = {} } addEventHandler("onClientResourceStart", resourceRoot, function () GUIEditor.window[1] = guiCreateWindow(552, 195, 502, 539, "Panel Give Money By iz3[!a]G @", false) guiWindowSetMovable(GUIEditor.window[1], false) guiSetVisible( GUIEditor.window[1], false ) guiSetProperty(GUIEditor.window[1], "CaptionColour", "FF03FB8F") GUIEditor.button[1] = guiCreateButton(0.61, 0.78, 0.05, 0.03, "إغلآق", true, GUIEditor.window[1]) GUIEditor.button[2] = guiCreateButton(904, 342, 140, 64, "إعطاء للكل", false, GUIEditor.window[1]) guiSetProperty(GUIEditor.button[2], "NormalTextColour", "FF051CF8") GUIEditor.label[1] = guiCreateLabel(755, 369, 99, 27, "ضع المآل هنا : ", false, GUIEditor.window[1]) guiLabelSetColor(GUIEditor.label[1], 53, 243, 9) guiLabelSetHorizontalAlign(GUIEditor.label[1], "left", true) GUIEditor.memo[1] = guiCreateMemo(552, 588, 350, 136, "السلآم عليكم ورحمة الله وبركاته , تعريف عن المود : \n\nمود عبارة عن لوحة توزع فلوس ( المال ) \n\nلاعطاء لكل الاعبين اضغط على ( إعطاء للكل )\n\nالفراغ هو لوضع مبلغ للمال :))\n\nان وزعت للكل سيتم كتابة في شات انا الكونسل \n\nقام بتوزيع \n\n\niTz iz3aG 2017 - 2018 _ @", false, GUIEditor.window[1]) GUIEditor.edit[1] = guiCreateEdit(728, 397, 152, 29, "", false, GUIEditor.window[1]) GUIEditor.scrollpane[1] = guiCreateScrollPane(272, 328, 25, 26, false, GUIEditor.window[1]) end) function welcome () if source == GUIEditor.button[2] then triggerServerEvent ( 'walykm', resourceRoot, guiGetText (GUIEditor.edit[1]) ) guiSetVisible ( GUIEditor.window[1], false ) showCursor ( guiGetVisible ( GUIEditor.window[1] ) ) guiSetInputEnabled ( guiGetVisible ( GUIEditor.window[1] ) ) elseif source == GUIEditor.button[1] then guiSetVisible ( GUIEditor.window[1], false ) showCursor ( guiGetVisible ( GUIEditor.window[1] ) ) guiSetInputEnabled ( guiGetVisible ( GUIEditor.window[1] ) ) end end addEventHandler ('onClientGUIClick', resourceRoot, welcome) addEvent ('onGUIOpenRequested', true) addEventHandler('onGUIOpenRequested', getResourceRootElement(), function () guiSetVisible ( GUIEditor.window[1], not guiGetVisible ( GUIEditor.window[1] ) ); showCursor ( guiGetVisible ( GUIEditor.window[1] ) ); guiSetInputEnabled ( guiGetVisible ( GUIEditor.window[1] ) ); end) Server side: addCommandHandler("open", function (admin) local account = getAccountName ( getPlayerAccount ( admin ) ) if isObjectInACLGroup ( 'user.' .. account, aclGetGroup ( 'Console' ) ) then triggerClientEvent ( admin, 'onGUIOpenRequested', resourceRoot) end end) addEvent ( 'walykm', true ) addEventHandler ( 'walykm', resourceRoot, function (amount) for g, thePlayers in ipairs ( getElementsByType ( 'player' ) ) do givePlayerMoney ( thePlayers, tonumber(amount) ) outputChatBox ( '#ff0000 : ( '.. amount ..'$ ) :بتوزيع المال لكل الاعبين : ( '.. getPlayerName(client):gsub("#%x%x%x%x%x%x","") ..' ) :لقد قام الكونسل *', thePlayers, 255, 127, 0, true ) end end)
  12. "onPlayerSpawn" -- بدلاً من "onPlayerJoin"
  13. function math.round(number, decimals, method) decimals = decimals or 0 local factor = 10 ^ decimals if (method == "ceil" or method == "floor") then return math[method](number * factor) / factor else return tonumber(("%."..decimals.."f"):format(number)) end end usage: math.round(10.4) -- output: 10
  14. هذا مصمم داخل اللعبة, ما اتوقع تقدر تجيب الكود.
  15. one last question. is it possible to mute someone by console if he joins using. executeCommandHandler("mute",source , name.." "..reason.." "..seconds) source here returns the player who joined, so that means if he doesn't have permission to /mute , he will not be muted. any idea how to mute that person by console?
  16. I apologize for the bump, but I can't update my replies. I've added a check to see if the serial is in table then it should just update it, but the fact I can't select a column, it updates all columns for xDuration as seen in the images. addCommandHandler("update", root, function (player, cmd, duration) executeSQLQuery("UPDATE Xofflinemuts SET xDuration=?", duration ) outputChatBox("Updated Duration", player, 0, 255, 0) end )
  17. fixed it, one last question. is it possible to mute someone by console if he joins using. executeCommandHandler("mute",source , name.." "..reason.." "..seconds) source here returns the player who joined, so that means if he doesn't have /mute permission, he will not be muted. so, any idea how to mute that person by console?
  18. Note: You can only execute commands created by Lua. You cannot execute MTA harcoded commands due to security reasons. From the wiki.
  19. What am I doing wrong? [Sorry if it looks stupid, but I'm still learning so] attempt to index field '?' (a nil value) [Line 5] addEventHandler('onPlayerLogin', root, function () local serialofJoiner = getPlayerSerial(source) local checkSerial = executeSQLQuery("SELECT * FROM `offlinemutes` WHERE playerSerial = ?", serial ) if serialofJoiner == checkSerial[1]['playerSerial'] then if not ( type ( checkSerial ) == 'table' and #checkSerial == 0 or not checkSerial ) then outputChatBox("You should be muted") else return end else return end end )
  20. Hello there, let's say, I've inserted a random serial in SQL, and wanted to load it when player joins and compare if his serial matches the one in the database. How can I compare it? i'm still learning on SQL, would be great if you offer help. [Note: the random serial is a string inserted from a command]
  21. King12

    antiban

    Ohh, wasn't aware of banPointer. =d well, It's obviously the admin panel that is causing the ban, so you can't really stop/cancel it because admin panel is using "Console" to ban.
  22. King12

    antiban

    It's possible. You can even use two groups. elseif ( action == "ban" ) then if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(player)), aclGetGroup("Admin") ) or isObjectInACLGroup("user."..getAccountName(getPlayerAccount(player)), aclGetGroup("Console") ) then
  23. King12

    antiban

    Code should be like this: elseif ( action == "ban" ) then if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(player)), aclGetGroup("Admin")) then outputChatBox( getPlayerName(source):gsub("#%x%x%x%x%x%x","").." has tried to ban you.", player, 255, 0, 0) local banner = getPlayerSerial (source) outputChatBox( getPlayerName(source):gsub("#%x%x%x%x%x%x","").." has been banned. [Reason: trying to ban staff member]", root, 255, 0, 0) setTimer ( function () addBan ( nil, nil, banner , root, "You were banned for trying to ban a staff member") end, 500, 1) return false end local reason = data or "" local seconds = tonumber(additional) and tonumber(additional) > 0 and tonumber(additional) local bUseSerial = additional2 local isAnonAdmin = getElementData(source, "AnonAdmin") -- etc..
×
×
  • Create New...