Jump to content

abu5lf

Members
  • Posts

    2,193
  • Joined

  • Last visited

Posts posted by abu5lf

  1. I did not find the solution?

    News of the resource script, but does not support the Arabic language when I write seems to me just point!

    And also when I added the news directly from the server using the button u activated users can talk to me!

    Is there a solution?

    newsTicker_client.lua

    local w_newsTickerAnim = false 
    local s_tickerMsg = {" أهلا بك", 
      
      
    } 
    local currentItem = 1 
      
    addEventHandler ( "onClientResourceStart", getResourceRootElement(getThisResource()), function(name) 
        --Create the ticker GUI 
        local screenWidth, screenHeight = guiGetScreenSize () 
        w_newsTickerWidth = 500 
        w_newsTickerHeight = 50 
        w_newsTickerLeft = (( screenWidth / 4 ) - ( w_newsTickerWidth / 4 )) 
        w_newsTickerTop = -50 
      w_newsTickerMinWidth = 200 
        w_newsTicker = guiCreateWindow( w_newsTickerLeft, w_newsTickerTop, w_newsTickerWidth, w_newsTickerHeight, "News Ticker /hidenews /shownews", false ) 
      --w_newsTicker = guiCreateWindow( 0.5, 0, 0.35, 0.1, "News Ticker /hidenews /shownews", true ) 
      w, h = guiGetSize ( w_newsTicker, false ) 
      if ( w < w_newsTickerMinWidth ) then 
        w = w_newsTickerMinWidth 
      end 
      guiSetSize ( w_newsTicker, w, 20, false ) 
      guiSetPosition ( w_newsTicker, ( screenWidth / 2 ) - ( w / 2 ), -20, false ) 
      
        w_newsTickerName = guiCreateLabel ( w + 100, 25, w, 18, "News is loading... Please wait", false, w_newsTicker ) 
      
        guiSetAlpha ( w_newsTicker, 0.50 ) 
        guiWindowSetSizable ( w_newsTicker, false ) 
        local guiLength = guiLabelGetTextExtent ( w_newsTickerName ) 
         
        guiSetFont ( w_newsTickerName, "clear-normal" ) 
        guiLabelSetColor ( w_newsTickerName, 0, 255, 0 ) 
      
        guiSetSize ( w_newsTickerName, guiLength, 20, false ) 
        setTimer ( function() 
            if ( ( w_newsTickerAnim ) and ( w_newsTickerAnim:isPlaying() ) ) then 
                return 
            else 
                guiSetPosition ( w_newsTickerName, w, 25, false ) 
                guiSetText ( w_newsTickerName, s_tickerMsg[currentItem] ) 
                guiLength = guiLabelGetTextExtent ( w_newsTickerName ) 
                guiSetSize ( w_newsTickerName, guiLength, 18, false ) 
               --w_newsTickerAnim = Animation.createAndPlay(w_newsTickerName, Animation.presets.guiMoveResize(guiLength - guiLength - guiLength - 100, 25, guiLength, 18, 10000 + (tonumber(guiLength)*50.45))) 
                  w_newsTickerAnim = Animation.createAndPlay(w_newsTickerName, Animation.presets.guiMoveResize( -guiLength , 25, guiLength, 18, 8000 + (tonumber(guiLength)*50.45))) 
                currentItem = currentItem + 1 
                if ( currentItem > #s_tickerMsg ) then 
                    currentItem = 1 
                end 
            end 
        end, 1000, 0 ) 
    end) 
      
    function getPlayerCount() 
        return #getElementsByType("player") 
    end 
      
    function hideNews() 
        guiSetVisible ( w_newsTicker, false ) 
        outputChatBox ( "News Ticker hidden, you can show it again by typing /shownews", 50, 255, 50 ) 
    end 
      
    function showNews() 
        guiSetVisible ( w_newsTicker, true ) 
        outputChatBox ( "News Ticker shown, you can hide it again by typing /hidenews", 50, 255, 50 ) 
    end 
      
    addCommandHandler ( "hidenews", hideNews ) 
    addCommandHandler ( "HIDENEWS", hideNews ) 
    addCommandHandler ( "shownews", showNews ) 
    addCommandHandler ( "SHOWNEWS", showNews ) 
      
      
      
      
    addEvent("new", true ) 
    addEventHandler("new", getRootElement(), start) 
    function yana(getPlayerName,s_tickerMsg) 
        outputChatBox(getPlayerName,s_tickerMsg,getRootElement(),255,0,0,true) 
    end 
    addEvent("yanas", true ) 
    addEventHandler("yanas", getRootElement(), yana) 
    bindKey("u", "down", "chatbox","AM") 
    

    client_anim_util.lua

    function table.find(t, ...) 
        local args = { ... } 
        if #args == 0 then 
            for k,v in pairs(t) do 
                if v then 
                    return k 
                end 
            end 
            return false 
        end 
         
        local value = table.remove(args) 
        if value == '[nil]' then 
            value = nil 
        end 
        for k,v in pairs(t) do 
            for i,index in ipairs(args) do 
                if type(index) == 'function' then 
                    v = index(v) 
                else 
                    if index == '[last]' then 
                        index = #v 
                    end 
                    v = v[index] 
                end 
            end 
            if v == value then 
                return k 
            end 
        end 
        return false 
    end 
      
    function table.removevalue(t, val) 
        for i,v in ipairs(t) do 
            if v == val then 
                table.remove(t, i) 
                return i 
            end 
        end 
        return false 
    end 
    

    client_anim.lua

    Animation = {} 
    Animation.__index = Animation 
      
    Animation.collection = {} 
      
    function Animation.create(elem, ...) 
        local anim = setmetatable({ type = 'anim', elem = elem, phases = {...} }, Animation) 
        for i,phase in ipairs(anim.phases) do 
            if type(phase) == 'table' then 
                phase.from = phase.from or 0 
                phase.to = phase.to or 1 
                phase.time = phase.time or 0 
                phase.value = phase.from 
                phase.speed = phase.time > 0 and ((phase.to - phase.from) / phase.time) or 0 
            end 
        end 
        return anim 
    end 
      
    function Animation.createAndPlay(elem, ...) 
        local anim = Animation.create(elem, ...) 
        anim:play() 
        return anim 
    end 
      
    function Animation.createQueue(...) 
        local queue = setmetatable({ type = 'queue' }, Animation) 
        local args = { ... } 
        if type(args[1]) == 'string' then 
            queue.name = table.remove(args, 1) 
        end 
        for i,obj in ipairs(args) do 
            queue:add(obj) 
        end 
        return queue 
    end 
      
    function Animation.createQueueAndPlay(...) 
        local queue = Animation.createQueue(...) 
        queue:play() 
        return queue 
    end 
      
    function Animation.getQueue(name) 
        for i,obj in ipairs(Animation.collection) do 
            if obj:isQueue() and obj.name == name then 
                return obj 
            end 
        end 
        return false 
    end 
      
    function Animation.getOrCreateQueue(name) 
        local queue = Animation.getQueue(name) 
        if not queue then 
            queue = Animation.createQueue(name) 
        end 
        return queue 
    end 
      
    function Animation:isPlaying() 
        return self.playing or false 
    end 
      
    function Animation.playingAnimationsExist() 
        return table.find(Animation.collection, 'playing', true) and true 
    end 
      
    function Animation:add(anim) 
        if self:isQueue() then 
            if type(anim) == 'function' then 
                anim = setmetatable({ type = 'function', fn = anim }, Animation) 
            end 
            anim.queue = self 
            anim.playing = self.playing 
            table.insert(self, anim) 
        end 
    end 
      
    function Animation:remove() 
        if self.queue then 
            table.removevalue(self.queue, self) 
            if #self.queue == 0 then 
                self.queue:remove() 
            end 
        else 
            table.removevalue(Animation.collection, self) 
            if not Animation.playingAnimationsExist() then 
                removeEventHandler('onClientRender', getRootElement(), updateAnim) 
                Animation.prevTick = nil 
            end 
        end 
        self.playing = false 
    end 
      
    function Animation:isAnimation() 
        return self.type == 'anim' 
    end 
      
    function Animation:isQueue() 
        return self.type == 'queue' 
    end 
      
    function Animation:play() 
        if self:isPlaying() then 
            return 
        end 
        if self:isQueue() then 
            for i,anim in ipairs(self) do 
                anim.playing = true 
            end 
        end 
        if not table.find(Animation.collection, self) then 
            table.insert(Animation.collection, self) 
        end 
        if not Animation.playingAnimationsExist() then 
            Animation.prevTick = getTickCount() 
            addEventHandler('onClientRender', getRootElement(), updateAnim) 
        end 
        self.playing = true 
    end 
      
    function Animation:pause() 
        self.playing = false 
        if not Animation.playingAnimationsExist() then 
            removeEventHandler('onClientRender', getRootElement(), updateAnim) 
            Animation.prevTick = nil 
        end 
    end 
      
    function updateAnim() 
        local phase 
        local curTick = getTickCount() 
        local doRemove 
         
        for i,obj in ipairs(Animation.collection) do 
            if obj.playing then 
                if obj:isQueue() then 
                    obj = obj[1] 
                end 
                if not isElement(obj.elem) then 
                    obj:remove() 
                end 
            end 
            if obj.playing then 
                phase = obj.phases[1] 
                doRemove = false 
                if type(phase) == 'function' then 
                    phase(obj.elem) 
                    doRemove = true 
                else 
                    if not phase.starttick then 
                        phase.starttick = curTick 
                    end 
                    phase.prevpassed = phase.passed 
                    phase.passed = (curTick - phase.starttick) % phase.time 
                    if phase.prevpassed and phase.passed < phase.prevpassed then 
                        if phase.repeats and phase.repeats > 0 then 
                            phase.repeats = phase.repeats - 1 
                            doRemove = phase.repeats == 0 
                        elseif not phase.repeats then 
                            doRemove = true 
                        end 
                    end 
                end 
                if doRemove then 
                    table.remove(obj.phases, 1) 
                    phase = false 
                    if #obj.phases == 0 then 
                        obj:remove() 
                        obj = false 
                    end 
                end 
                if obj and phase then 
                    phase.value = phase.from + phase.speed*phase.passed 
                    if phase.fn then 
                        phase.fn(obj.elem, phase.transform and phase.transform(phase.value) or phase.value, phase) 
                    end 
                end 
            end 
        end 
    end 
      
    Animation.presets = {} 
      
    function Animation.presets.pulse(time, value, phase) 
        if not value then 
            return { from = 0, to = 2*math.pi, transform = math.sin, time = time, repeats = 0, fn = Animation.presets.pulse } 
        else 
            local elem = time 
            if not phase.width then 
                phase.width, phase.height = guiGetSize(elem, false) 
                phase.centerX, phase.centerY = guiGetPosition(elem, false) 
                phase.centerX = phase.centerX + math.floor(phase.width/2) 
                phase.centerY = phase.centerY + math.floor(phase.height/2) 
            end 
            local pct = 1 - (value+1)*0.1 
            local width = pct*phase.width 
            local height = pct*phase.height 
            local x = phase.centerX - math.floor(width/2) 
            local y = phase.centerY - math.floor(height/2) 
            guiSetPosition(elem, x, y, false) 
            guiSetSize(elem, width, height, false) 
        end 
    end 
      
    function Animation.presets.guiMoveResize(x, y, width, height, time) 
        if height then 
            return { from = -math.pi/2, to = math.pi/2, time = time or 1000, transform = math.sin, 
                     endX = x, endY = y, endWidth = width, endHeight = height, 
                     fn = Animation.presets.guiMoveResize } 
        else 
            local elem, value, phase = x, (y + 1)/2, width 
            if not phase.startX then 
                phase.startX, phase.startY = guiGetPosition(elem, false) 
                phase.startWidth, phase.startHeight = guiGetSize(elem, false) 
            end 
            guiSetPosition(elem, math.floor(phase.startX + value*(phase.endX - phase.startX)), math.floor(phase.startY + value*(phase.endY - phase.startY)), false) 
            guiSetSize(elem, math.floor(phase.startWidth + value*(phase.endWidth - phase.startWidth)), math.floor(phase.startHeight + value*(phase.endHeight - phase.startHeight)), false) 
        end 
    end 
      
    

  2. local from = get("from") 
    local to = get("to") 
      
      
    function consoleGiveCash (  )  
        local cx = math.random(5555,1005) 
        setPlayerMoney( getRootElement(), cx ) 
        outputChatBox(" Has Won "..cx.."$" ,root, 255, 255,0,true ) 
    end 
    setTimer ( consoleGiveCash, 1000, 1 ) 
    

    Giving money, but after the passage of time does not give him

  3. This has not succeeded

    exports.scoreboard:addScoreboardColumn('Country') 
      
    Country = { 
          ['AD'] = 'Andorra', 
        ['AE'] = 'United Arab Emirates', 
        ['AF'] = 'Afghanistan', 
        ['AG'] = 'Antigua and Barbuda', 
        ['AI'] = 'Anguilla', 
        ['AL'] = 'Albania', 
        ['AM'] = 'Armenia', 
        ['AO'] = 'Angola', 
        ['AP'] = 'ARIPO', 
        ['AR'] = 'Argentina', 
        ['AT'] = 'Austria', 
        ['AU'] = 'Australia', 
        ['AW'] = 'Aruba', 
        ['AZ'] = 'Azerbaijan', 
        ['BA'] = 'Bosnia and Herzegovina', 
        ['BB'] = 'Barbados', 
        ['BD'] = 'Bangladesh', 
        ['BE'] = 'Belgium', 
        ['BF'] = 'Burkina Faso', 
        ['BG'] = 'Bulgaria', 
        ['BH'] = 'Bahrain', 
        ['BI'] = 'Burundi', 
        ['BJ'] = 'Benin', 
        ['BM'] = 'Bermuda', 
        ['BN'] = 'Brunei Darussalam', 
        ['BO'] = 'Bolivia', 
        ['BQ'] = 'Bonaire', 
        ['BR'] = 'Brazil', 
        ['BS'] = 'Bahamas', 
        ['BT'] = 'Bhutan', 
        ['BV'] = 'Bouvet Island', 
        ['BW'] = 'Botswana', 
        ['BY'] = 'Belarus', 
        ['BZ'] = 'Belize', 
        ['CA'] = 'Canada', 
        ['CD'] = 'Congo', 
        ['CF'] = 'Central African Republic', 
        ['CG'] = 'Congo', 
        ['CH'] = 'Switzerland', 
        ['CI'] = 'Cote d?Ivoire', 
        ['CK'] = 'Cook Islands', 
        ['CL'] = 'Chile', 
        ['CM'] = 'Cameroon', 
        ['CN'] = 'China', 
        ['CO'] = 'Colombia', 
        ['CR'] = 'Costa Rica', 
        ['CU'] = 'Cuba', 
        ['CV'] = 'Cape Verde', 
        ['CW'] = 'Curacao', 
        ['CY'] = 'Cyprus', 
        ['CZ'] = 'Czech Republic', 
        ['DE'] = 'Germany', 
        ['DJ'] = 'Djibouti', 
        ['DK'] = 'Denmark', 
        ['DM'] = 'Dominica', 
        ['DO'] = 'Dominican Republic', 
        ['DZ'] = 'Algeria', 
        ['EC'] = 'Ecuador', 
        ['EE'] = 'Estonia', 
        ['EG'] = 'Egypt', 
        ['EH'] = 'Western Sahara', 
        ['ER'] = 'Eritrea', 
        ['ES'] = 'Spain', 
        ['ET'] = 'Ethiopia', 
        ['FI'] = 'Finland', 
        ['FJ'] = 'Fiji', 
        ['FK'] = 'Malvinas', 
        ['FO'] = 'Faroe Islands', 
        ['FR'] = 'France', 
        ['GA'] = 'Gabon', 
        ['GB'] = 'United Kingdom', 
        ['GD'] = 'Grenada', 
        ['GE'] = 'Georgia', 
        ['GG'] = 'Guernsey', 
        ['GH'] = 'Ghana', 
        ['GI'] = 'Gibraltar', 
        ['GL'] = 'Greenland', 
        ['GM'] = 'Gambia', 
        ['GN'] = 'Guinea', 
        ['GQ'] = 'Equatorial Guinea', 
        ['GR'] = 'Greece', 
        ['GT'] = 'Guatemala', 
        ['GW'] = 'Guinea-Bissau', 
        ['GY'] = 'Guyana', 
        ['HN'] = 'Honduras', 
        ['HR'] = 'Croatia', 
        ['HT'] = 'Haiti', 
        ['HU'] = 'Hungary', 
        ['ID'] = 'Indonesia', 
        ['IE'] = 'Ireland', 
        ['IL'] = 'Israel', 
        ['IM'] = 'Isle of Man', 
        ['IN'] = 'India', 
        ['IQ'] = 'Iraq', 
        ['IR'] = 'Iran', 
        ['IS'] = 'Iceland', 
        ['IT'] = 'Italy', 
        ['JE'] = 'Jersey', 
        ['JM'] = 'Jamaica', 
        ['JO'] = 'Jordan', 
        ['JP'] = 'Japan', 
        ['KE'] = 'Kenya', 
        ['KG'] = 'Kyrgyzstan', 
        ['KH'] = 'Cambodia', 
        ['KI'] = 'Kiribati', 
        ['KM'] = 'Comoros', 
        ['KN'] = 'Saint Kitts and Nevis', 
        ['KP'] = 'Korea', 
        ['KR'] = 'Korea', 
        ['KW'] = 'Kuwait', 
        ['KY'] = 'Cayman Islands', 
        ['KZ'] = 'Kazakhstan', 
        ['LA'] = 'Lao People?s Republic', 
        ['LB'] = 'Lebanon', 
        ['LC'] = 'Saint Lucia', 
        ['LI'] = 'Liechtenstein', 
        ['LK'] = 'Sri Lanka', 
        ['LR'] = 'Liberia', 
        ['LS'] = 'Lesotho', 
        ['LT'] = 'Lithuania', 
        ['LU'] = 'Luxembourg', 
        ['LV'] = 'Latvia', 
        ['LY'] = 'Libyan Arab Jamahiriya', 
        ['MA'] = 'Morocco', 
        ['MC'] = 'Monaco', 
        ['MD'] = 'Moldova', 
        ['ME'] = 'Montenegro', 
        ['MG'] = 'Madagascar', 
        ['MK'] = 'Macedonia', 
        ['ML'] = 'Mali', 
        ['MM'] = 'Myanmar', 
        ['MN'] = 'Mongolia', 
        ['MO'] = 'Macao', 
        ['MP'] = 'Northern Mariana Islands', 
        ['MR'] = 'Mauritania', 
        ['MS'] = 'Montserrat', 
        ['MT'] = 'Malta', 
        ['MU'] = 'Mauritius', 
        ['MV'] = 'Maldives', 
        ['MW'] = 'Malawi', 
        ['MX'] = 'Mexico', 
        ['MY'] = 'Malaysia', 
        ['MZ'] = 'Mozambique', 
        ['NA'] = 'Namibia', 
        ['NE'] = 'Niger', 
        ['NG'] = 'Nigeria', 
        ['NI'] = 'Nicaragua', 
        ['NL'] = 'Netherlands', 
        ['NO'] = 'Norway', 
        ['NP'] = 'Nepal', 
        ['NR'] = 'Nauru', 
        ['NZ'] = 'New Zealand', 
        ['OM'] = 'Oman', 
        ['PA'] = 'Panama', 
        ['PE'] = 'Peru', 
        ['PG'] = 'Papua New Guinea', 
        ['PH'] = 'Philippines', 
        ['PK'] = 'Pakistan', 
        ['PL'] = 'Poland', 
        ['PT'] = 'Portugal', 
        ['PW'] = 'Palau', 
        ['PY'] = 'Paraguay', 
        ['QA'] = 'Qatar', 
        ['RO'] = 'Romania', 
        ['RS'] = 'Serbia', 
        ['RU'] = 'Russian Federation', 
        ['RW'] = 'Rwanda', 
        ['SA'] = 'Saudi Arabia', 
        ['SB'] = 'Solomon Islands', 
        ['SC'] = 'Seychelles', 
        ['SD'] = 'Sudan', 
        ['SE'] = 'Sweden', 
        ['SG'] = 'Singapore', 
        ['SH'] = 'Saint Helena', 
        ['SI'] = 'Slovenia', 
        ['SK'] = 'Slovakia', 
        ['SL'] = 'Sierra Leone', 
        ['SM'] = 'San Marino', 
        ['SN'] = 'Senegal', 
        ['SO'] = 'Somalia', 
        ['SR'] = 'Suriname', 
        ['ST'] = 'Sao Tome and Principe', 
        ['SV'] = 'Salvador', 
        ['SX'] = 'Sint Maarten (Dutch part)', 
        ['SY'] = 'Syrian Arab Republic', 
        ['SZ'] = 'Swaziland', 
        ['TC'] = 'Turks and Caicos Islands', 
        ['TD'] = 'Chad', 
        ['TG'] = 'Togo', 
        ['TH'] = 'Thailand', 
        ['TJ'] = 'Tajikistan', 
        ['TL'] = 'Timor?Leste', 
        ['TM'] = 'Turkmenistan', 
        ['TN'] = 'Tunisia', 
        ['TO'] = 'Tonga', 
        ['TR'] = 'Turkey', 
        ['TT'] = 'Trinidad and Tobago', 
        ['TV'] = 'Tuvalu', 
        ['TW'] = 'Taiwan', 
        ['TZ'] = 'Tanzania', 
        ['UA'] = 'Ukraine', 
        ['UG'] = 'Uganda', 
        ['US'] = 'United States of America', 
        ['UY'] = 'Uruguay', 
        ['UZ'] = 'Uzbekistan', 
        ['VA'] = 'Holy See', 
        ['VC'] = 'Saint Vincent', 
        ['VE'] = 'Venezuela', 
        ['VG'] = 'Virgin Islands', 
        ['VN'] = 'Viet Nam', 
        ['VU'] = 'Vanuatu', 
        ['WS'] = 'Samoa', 
        ['YE'] = 'Yemen', 
        ['ZA'] = 'South Africa', 
        ['ZZ'] = 'n/a', 
        ['ZM'] = 'Zambia', 
         
    } 
      
      
    function showHome () 
        local countryCode = exports["admin"]:getPlayerCountry(source) 
        setElementData(source,"Country",Country[countryCode]) 
        outputChatBox("*"..getPlayerName(source) .."#FFFF00 join   #FF0000  [#FFFF00".. tostring(Country[countryCode]) .."#FF0000] !",getRootElement(), 255, 255, 255, true ) 
      
    end 
    addEventHandler("onPlayerJoin",getRootElement(),showHome) 
      
      
      
      
    

  4. I have tried with and without it, the reason I have written to me in the back of program errors MTA Script Editor

    And written and the error is gone but the script did not work

  5. =exports.scoreboard:addScoreboardColumn('Country') 
      
    Country = { 
          ['AD'] = 'Andorra', 
        ['AE'] = 'United Arab Emirates', 
        ['AF'] = 'Afghanistan', 
        ['AG'] = 'Antigua and Barbuda', 
        ['AI'] = 'Anguilla', 
        ['AL'] = 'Albania', 
        ['AM'] = 'Armenia', 
        ['AO'] = 'Angola', 
        ['AP'] = 'ARIPO', 
        ['AR'] = 'Argentina', 
        ['AT'] = 'Austria', 
        ['AU'] = 'Australia', 
        ['AW'] = 'Aruba', 
        ['AZ'] = 'Azerbaijan', 
        ['BA'] = 'Bosnia and Herzegovina', 
        ['BB'] = 'Barbados', 
        ['BD'] = 'Bangladesh', 
        ['BE'] = 'Belgium', 
        ['BF'] = 'Burkina Faso', 
        ['BG'] = 'Bulgaria', 
        ['BH'] = 'Bahrain', 
        ['BI'] = 'Burundi', 
        ['BJ'] = 'Benin', 
        ['BM'] = 'Bermuda', 
        ['BN'] = 'Brunei Darussalam', 
        ['BO'] = 'Bolivia', 
        ['BQ'] = 'Bonaire', 
        ['BR'] = 'Brazil', 
        ['BS'] = 'Bahamas', 
        ['BT'] = 'Bhutan', 
        ['BV'] = 'Bouvet Island', 
        ['BW'] = 'Botswana', 
        ['BY'] = 'Belarus', 
        ['BZ'] = 'Belize', 
        ['CA'] = 'Canada', 
        ['CD'] = 'Congo', 
        ['CF'] = 'Central African Republic', 
        ['CG'] = 'Congo', 
        ['CH'] = 'Switzerland', 
        ['CI'] = 'Cote d?Ivoire', 
        ['CK'] = 'Cook Islands', 
        ['CL'] = 'Chile', 
        ['CM'] = 'Cameroon', 
        ['CN'] = 'China', 
        ['CO'] = 'Colombia', 
        ['CR'] = 'Costa Rica', 
        ['CU'] = 'Cuba', 
        ['CV'] = 'Cape Verde', 
        ['CW'] = 'Curacao', 
        ['CY'] = 'Cyprus', 
        ['CZ'] = 'Czech Republic', 
        ['DE'] = 'Germany', 
        ['DJ'] = 'Djibouti', 
        ['DK'] = 'Denmark', 
        ['DM'] = 'Dominica', 
        ['DO'] = 'Dominican Republic', 
        ['DZ'] = 'Algeria', 
        ['EC'] = 'Ecuador', 
        ['EE'] = 'Estonia', 
        ['EG'] = 'Egypt', 
        ['EH'] = 'Western Sahara', 
        ['ER'] = 'Eritrea', 
        ['ES'] = 'Spain', 
        ['ET'] = 'Ethiopia', 
        ['FI'] = 'Finland', 
        ['FJ'] = 'Fiji', 
        ['FK'] = 'Malvinas', 
        ['FO'] = 'Faroe Islands', 
        ['FR'] = 'France', 
        ['GA'] = 'Gabon', 
        ['GB'] = 'United Kingdom', 
        ['GD'] = 'Grenada', 
        ['GE'] = 'Georgia', 
        ['GG'] = 'Guernsey', 
        ['GH'] = 'Ghana', 
        ['GI'] = 'Gibraltar', 
        ['GL'] = 'Greenland', 
        ['GM'] = 'Gambia', 
        ['GN'] = 'Guinea', 
        ['GQ'] = 'Equatorial Guinea', 
        ['GR'] = 'Greece', 
        ['GT'] = 'Guatemala', 
        ['GW'] = 'Guinea-Bissau', 
        ['GY'] = 'Guyana', 
        ['HN'] = 'Honduras', 
        ['HR'] = 'Croatia', 
        ['HT'] = 'Haiti', 
        ['HU'] = 'Hungary', 
        ['ID'] = 'Indonesia', 
        ['IE'] = 'Ireland', 
        ['IL'] = 'Israel', 
        ['IM'] = 'Isle of Man', 
        ['IN'] = 'India', 
        ['IQ'] = 'Iraq', 
        ['IR'] = 'Iran', 
        ['IS'] = 'Iceland', 
        ['IT'] = 'Italy', 
        ['JE'] = 'Jersey', 
        ['JM'] = 'Jamaica', 
        ['JO'] = 'Jordan', 
        ['JP'] = 'Japan', 
        ['KE'] = 'Kenya', 
        ['KG'] = 'Kyrgyzstan', 
        ['KH'] = 'Cambodia', 
        ['KI'] = 'Kiribati', 
        ['KM'] = 'Comoros', 
        ['KN'] = 'Saint Kitts and Nevis', 
        ['KP'] = 'Korea', 
        ['KR'] = 'Korea', 
        ['KW'] = 'Kuwait', 
        ['KY'] = 'Cayman Islands', 
        ['KZ'] = 'Kazakhstan', 
        ['LA'] = 'Lao People?s Republic', 
        ['LB'] = 'Lebanon', 
        ['LC'] = 'Saint Lucia', 
        ['LI'] = 'Liechtenstein', 
        ['LK'] = 'Sri Lanka', 
        ['LR'] = 'Liberia', 
        ['LS'] = 'Lesotho', 
        ['LT'] = 'Lithuania', 
        ['LU'] = 'Luxembourg', 
        ['LV'] = 'Latvia', 
        ['LY'] = 'Libyan Arab Jamahiriya', 
        ['MA'] = 'Morocco', 
        ['MC'] = 'Monaco', 
        ['MD'] = 'Moldova', 
        ['ME'] = 'Montenegro', 
        ['MG'] = 'Madagascar', 
        ['MK'] = 'Macedonia', 
        ['ML'] = 'Mali', 
        ['MM'] = 'Myanmar', 
        ['MN'] = 'Mongolia', 
        ['MO'] = 'Macao', 
        ['MP'] = 'Northern Mariana Islands', 
        ['MR'] = 'Mauritania', 
        ['MS'] = 'Montserrat', 
        ['MT'] = 'Malta', 
        ['MU'] = 'Mauritius', 
        ['MV'] = 'Maldives', 
        ['MW'] = 'Malawi', 
        ['MX'] = 'Mexico', 
        ['MY'] = 'Malaysia', 
        ['MZ'] = 'Mozambique', 
        ['NA'] = 'Namibia', 
        ['NE'] = 'Niger', 
        ['NG'] = 'Nigeria', 
        ['NI'] = 'Nicaragua', 
        ['NL'] = 'Netherlands', 
        ['NO'] = 'Norway', 
        ['NP'] = 'Nepal', 
        ['NR'] = 'Nauru', 
        ['NZ'] = 'New Zealand', 
        ['OM'] = 'Oman', 
        ['PA'] = 'Panama', 
        ['PE'] = 'Peru', 
        ['PG'] = 'Papua New Guinea', 
        ['PH'] = 'Philippines', 
        ['PK'] = 'Pakistan', 
        ['PL'] = 'Poland', 
        ['PT'] = 'Portugal', 
        ['PW'] = 'Palau', 
        ['PY'] = 'Paraguay', 
        ['QA'] = 'Qatar', 
        ['RO'] = 'Romania', 
        ['RS'] = 'Serbia', 
        ['RU'] = 'Russian Federation', 
        ['RW'] = 'Rwanda', 
        ['SA'] = 'Saudi Arabia', 
        ['SB'] = 'Solomon Islands', 
        ['SC'] = 'Seychelles', 
        ['SD'] = 'Sudan', 
        ['SE'] = 'Sweden', 
        ['SG'] = 'Singapore', 
        ['SH'] = 'Saint Helena', 
        ['SI'] = 'Slovenia', 
        ['SK'] = 'Slovakia', 
        ['SL'] = 'Sierra Leone', 
        ['SM'] = 'San Marino', 
        ['SN'] = 'Senegal', 
        ['SO'] = 'Somalia', 
        ['SR'] = 'Suriname', 
        ['ST'] = 'Sao Tome and Principe', 
        ['SV'] = 'Salvador', 
        ['SX'] = 'Sint Maarten (Dutch part)', 
        ['SY'] = 'Syrian Arab Republic', 
        ['SZ'] = 'Swaziland', 
        ['TC'] = 'Turks and Caicos Islands', 
        ['TD'] = 'Chad', 
        ['TG'] = 'Togo', 
        ['TH'] = 'Thailand', 
        ['TJ'] = 'Tajikistan', 
        ['TL'] = 'Timor?Leste', 
        ['TM'] = 'Turkmenistan', 
        ['TN'] = 'Tunisia', 
        ['TO'] = 'Tonga', 
        ['TR'] = 'Turkey', 
        ['TT'] = 'Trinidad and Tobago', 
        ['TV'] = 'Tuvalu', 
        ['TW'] = 'Taiwan', 
        ['TZ'] = 'Tanzania', 
        ['UA'] = 'Ukraine', 
        ['UG'] = 'Uganda', 
        ['US'] = 'United States of America', 
        ['UY'] = 'Uruguay', 
        ['UZ'] = 'Uzbekistan', 
        ['VA'] = 'Holy See', 
        ['VC'] = 'Saint Vincent', 
        ['VE'] = 'Venezuela', 
        ['VG'] = 'Virgin Islands', 
        ['VN'] = 'Viet Nam', 
        ['VU'] = 'Vanuatu', 
        ['WS'] = 'Samoa', 
        ['YE'] = 'Yemen', 
        ['ZA'] = 'South Africa', 
        ['ZZ'] = 'n/a', 
        ['ZM'] = 'Zambia', 
         
    } 
      
      
    function showHome () 
        local countryCode = exports["admin"]:getPlayerCountry(source) 
        setElementData(source,"Country",Country[countryCode]) 
        outputChatBox("*"..getPlayerName(source) .."#FFFF00 join   #FF0000  [#FFFF00".. tostring(Country[countryCode]) .."#FF0000] !",getRootElement(), 255, 255, 255, true ) 
      
    end 
    addEventHandler("onPlayerJoin",getRootElement(),showHome) 
      
      
      
      
    

    Upon entering the player does not appear in the chat

  6. Example 1

    This example creates a marker next to the player when they type 'createmarker':

    server

    -- this function is called whenever someone types 'createmarker' in the console: 
    function consoleCreateMarker ( thePlayer, commandName ) 
       if ( thePlayer ) then 
          local x, y, z = getElementPosition ( thePlayer ) -- get the player's position 
          -- create a cylindrical marker next to the player: 
          local theMarker = createMarker ( x + 2, y + 2, z, "cylinder", 1.5, 255, 255, 0, 170 ) 
          if ( theMarker ) then -- check if the marker was created successfully 
             outputConsole ( "Marker created successfully", thePlayer ) 
          else 
             outputConsole ( "Failed to create marker", thePlayer ) 
          end 
       end 
    end 
    addCommandHandler ( "createmarker", consoleCreateMarker ) 
    

    CreateMarker

  7. function muteOurPlayer(player, command, mutedguy, time) 
        if mutedguy and time then 
             
            local muted = getPlayerFromName(mutedguy) 
             
            if muted then 
                 
                if( not isPlayerMuted(muted) ) then 
                     
                        setPlayerMuted(muted, true) 
                        outputChatBox("#ADFF2F"..getPlayerName(muted).."#FF0000 has been muted for #ADFF2F"..time.."#FF0000 minutes. ", getRootElement(), 255, 0, 0, true) 
                        setElementData(muted, "Muted", 1) 
                        setElementData(muted, "MutedTime", time) 
      
                        setTimer(outputChatBox(mutedguy.." has been unmuted.", getRootElement()), time, 1)                   
                end 
            end 
        else  
                outputChatBox("/mute  ", player) 
        end 
    end 
    addCommandHandler("mute", muteOurPlayer) 
      
    

  8. meta.xml

        "X" name="AdminMsg" type="script" version="1.0.0" /> 
        

    This is repeated several times fast

    [2012-03-04 15:43:07] WARNING: adminmsg\client.lua:12: Bad argument @ 'dxDrawText' [Expected horizontal-align at argument 9, got string 'top']

    [2012-03-04 15:43:07] WARNING: adminmsg\client.lua:13: Bad argument @ 'dxDrawText' [Expected horizontal-align at argument 9, got string 'top']

  9. -- create the function 
    function mutePlayer(player,command,victimName) 
        -- if the player has specified a victim name to mute 
        if victimName then 
            -- get the victim player element from their name 
            local victim = getPlayerFromNick(victimName) 
            -- if the player exists 
            if victim then 
                -- if they arent already muted 
                if ( not isPlayerMuted(victim) ) then 
                    -- mute them and output a message to the chat 
                    setPlayerMuted(victim, true) 
                    outputChatBox("You have been muted.",victim) 
                end 
            else 
                outputChatBox("Could not find player with name: "..tostring(victimName),player) 
            end 
        else 
            outputChatBox("Usage: /mute ",player) 
        end 
    end 
    -- add the /mute command 
    addCommandHandler("mute",mutePlayer) 
    

  10. Server

    function wla(thePlayer, commandName,...) 
        local accName = getAccountName ( getPlayerAccount ( thePlayer ) ) 
        if isObjectInACLGroup ( "user." .. accName, aclGetGroup ( "Admin" ) ) then 
            local veve = {...} 
            local message = table.concat(veve, " ") 
            triggerClientEvent("new", getRootElement(),message) 
        end 
    end 
    addCommandHandler("AM", wla) 
    

    Clinet

    function start(message) 
        removeEventHandler ( "onClientRender", getRootElement(), as ) 
        function as() 
            dxDrawText("Admin :",17.0,189.0,61.0,206.0,tocolor(255,0,0,255),1.0,"default-bold","top","left",false,false,false) 
            dxDrawText(message,61.0,189.0,264.0,226.0,tocolor(255,255,255,255),1.0,"default-bold","top","left",false,false,false) 
        end 
        addEventHandler("onClientRender", getRootElement(), as) 
    end 
    addEvent("new", true ) 
    addEventHandler("new", getRootElement(), start) 
    function yana(msgmsg) 
        outputChatBox(msgmsg,getRootElement(),255,0,0,true) 
    end 
    addEvent("yanas", true ) 
    addEventHandler("yanas", getRootElement(), yana) 
    bindKey("u", "down", "chatbox","AM") 
    

    It does not work

×
×
  • Create New...