Jump to content

Kenix

Retired Staff
  • Posts

    4,121
  • Joined

  • Last visited

  • Days Won

    2

Everything posted by Kenix

  1. You can't cancel onClientGUIClick event. You can use https://wiki.multitheftauto.com/wiki/GuiSetEnabled
  2. Kenix

    Scores script

    Can you explain better?
  3. local screenWidth, screenHeight = guiGetScreenSize( ) local bShow, uTimer function helpText ( ) if bShow then dxDrawRectangle ( ( ( screenWidth / 2 )-200 ), ( screenHeight - 80 ), 400, 80, tocolor( 0, 0, 0, 150 ) ) dxDrawText ( "/kill when you are buged", 0, 0, screenWidth, screenHeight - 40, tocolor ( 255, 255, 255, 255 ), 0.7, 'bankgothic', "center", "bottom", false, false, false ) dxDrawText ( "dont ask admin for password!", 0, 0, screenWidth, screenHeight - 20, tocolor ( 255, 255, 255, 255 ), 0.7, 'bankgothic', "center", "bottom", false, false, false ) end end addEventHandler( "onClientRender", root, helpText ) addEventHandler( 'onClientPlayerWasted', root, function( ) bShow = true if isTimer( uTimer ) then killTimer( uTimer ) end uTimer = setTimer( function( ) bShow = false end, 5000, 1 ) end ) Updated.
  4. So it work? Can you tabulate your code?
  5. Wrong. Comments here: local teams = getElementsByType("team") for i,team in ipairs(teams) do -- Ok you loop all teams local teamName = getTeamName(teams) -- why? Variable teams is table function balanceTeams ( thePlayer ) -- You create function in loop? Why? local Count1 = countPlayersInTeam (teamName) -- false, because getTeamName return false local Count2 = countPlayersInTeam (teamName) -- false, because getTeamName return false if (Count1 == Count2) then -- All wrong next. setPlayerTeam ( thePlayer, teamName ) elseif (Count1 > Count2) then setPlayerTeam ( thePlayer, teamName ) elseif (Count1 < Count2) then setPlayerTeam ( thePlayer, teamName ) end end end --[[ You need tabulate your code. ]]
  6. Again syntax error. in 8 line you create 2 )) And you use not define variables x,y,Sw,Sh
  7. Kenix

    marker problem

    Correct Client. myMarker = createMarker( 1478.336, 2647.9533691406, 55.8359375, 'cylinder', 2.0, 0, 0, 255, 150 ) addEventHandler ( 'onClientMarkerHit', myMarker, function( hitPlayer, matchingDimension ) setElementPosition ( hitPlayer, 287.85568, 1820.85620, 17.64063 ) end ) Evil-Cod3r,Your code wrong. addEventHandler ( "onClientMarkerHit", getRootElement(), myMarker, MarkerHit ) 3 argument is addEventHandler function-handler NOT ELEMENT, next arguments wrong. 1 argument in function-handler onClientMarkerHit is element player. if getElementType( hitPlayer ) == "player" then Why you need check it?If hit element is player always. tim260 myMarker = createMarker( 1478.336, 2647.9533691406, 55.8359375, 'cylinder', 2.0, 0, 0, 255, 150 ) function markerHit ( element, dimension ) setElementPosition ( element, 287.85568, 1820.85620, 17.64063 ) end addEventHandler ( 'onmyMarkerHit', myMarker, MarkerHit ) It's wrong because lua is case sensitive. Correct: myMarker = createMarker( 1478.336, 2647.9533691406, 55.8359375, 'cylinder', 2.0, 0, 0, 255, 150 ) function markerHit ( element, dimension ) setElementPosition ( element, 287.85568, 1820.85620, 17.64063 ) end addEventHandler ( 'onmyMarkerHit', myMarker, markerHit ) Example: nCount = 1 print( nCount ) --> 1 print( NCount ) --> nil
  8. Learn lua viewtopic.php?f=91&t=40809 https://wiki.multitheftauto.com/wiki/Scr ... troduction You have syntax errors in each scripts.
  9. Kenix

    Water function

    https://wiki.multitheftauto.com/wiki/CreateWater https://wiki.multitheftauto.com/wiki/SetElementInterior https://wiki.multitheftauto.com/wiki/SetElementDimension
  10. Kenix

    TDMA

    Your code wrong. Correct addEventHandler( 'onPlayerDamage', root, function( attacker,weapon ) if attacker and attacker ~= source then if weapon and weapon == 16 then fadeCamera ( source, false, 1.0, 255, 255, 255 ) setTimer( fadeCamera, 1000, 1, source, true, 1 ) end end end )
  11. Kenix

    Problem Country

    Show meta.xml viewtopic.php?f=91&t=40807
  12. local txd, dff, state bindKey( 'F6', 'down', function( ) state = not state if state then txd = engineLoadTXD( 'models/fbi.txd', 490 ) engineImportTXD( txd, 490 ) dff = engineLoadDFF( 'models/fbi.dff', 490 ) engineReplaceModel( dff, 490 ) else destroyElement( txd ) destroyElement( dff ) end end )
  13. Kenix

    Problem Country

    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) Syntax error here: =exports.scoreboard:addScoreboardColumn('Country') You not need use here =
  14. I am use lua compiler in my "Super modified" notepad ++ .
  15. addCommandHandler( 'deletemap', function( uPlayer, _, ... ) local map = table.concat( { ... } ,' ' ) local search = getResourceFromName( map ) if search then deleteResource( search ) outputChatBox( 'Map sucessfully deleted!', uPlayer, 255, 255, 255, false ) else outputChatBox( 'Map not found!', uPlayer, 255, 255, 255, false ) end end ) Draken,Your code wrong, because 1 argument in function table.concat is table, but you use string.
  16. http://mta.dzek.eu/compiler/ ?
  17. Yes, i said it . In 3 page.
  18. Lol, it's draw rectangle. Client local sText = '' local uTimer function dxDrawColorText( str, ax, ay, bx, by, color, scale, font, alignX, alignY ) if alignX then if alignX == "center" then local w = dxGetTextWidth(str:gsub( "#%x%x%x%x%x%x","" ), scale, font ) ax = ax + (bx-ax)/2 - w/2 elseif alignX == "right" then local w = dxGetTextWidth(str:gsub( "#%x%x%x%x%x%x","" ), scale, font ) ax = bx - w end end if alignY then if alignY == "center" then local h = dxGetFontHeight( scale, font ) ay = ay + (by-ay)/2 - h/2 elseif alignY == "bottom" then local h = dxGetFontHeight( scale, font ) ay = by - h end end 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( tonumber( "0x"..col:sub( 1, 2 ) ), tonumber( "0x"..col:sub( 3, 4 ) ), tonumber( "0x"..col:sub( 5, 6 ) ), 255 ) 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( tonumber( "0x"..col:sub( 1, 2 ) ), tonumber( "0x"..col:sub( 3, 4 ) ), tonumber( "0x"..col:sub( 5, 6 ) ), 255 ) end last = e + 1 s, e, cap, col = str:find( pat, last ) end if last <= #str then cap = str:sub( last ) local w = dxGetTextWidth( cap, scale, font ) dxDrawText( cap, ax, ay, ax + w, by, color, scale, font ) end end addEvent( 'onClientPlayerLogin', true ) function dxDrawRelativeText( text,posX,posY,right,bottom,color,scale,mixed_font,alignX,alignY,clip,wordBreak,postGUI ) local resolutionX = 1280 local resolutionY = 1024 local sWidth,sHeight = guiGetScreenSize( ) return dxDrawColorText( tostring( text ), ( posX/resolutionX )*sWidth, ( posY/resolutionY )*sHeight, ( right/resolutionX )*sWidth, ( bottom/resolutionY)*sHeight, color,( sWidth/resolutionX )*scale, mixed_font, alignX, alignY, clip, wordBreak, postGUI ) end function dxDrawRelativeRectangle( posX, posY, width, height,color,postGUI ) local resolutionX = 1280 local resolutionY = 1024 local sWidth,sHeight = guiGetScreenSize( ) return dxDrawRectangle( ( posX/resolutionX )*sWidth, ( posY/resolutionY )*sHeight, ( width/resolutionX )*sWidth, ( height/resolutionY )*sHeight, color, postGUI ) end function fDraw( quitReason ) sText = sText..string.format( '#FFFFFFServer: #FFFFFF%s has %s the server %s \n', getPlayerName( source ), eventName == 'onClientPlayerQuit' and 'left' or eventName == 'onClientPlayerLogin' and 'join', eventName == 'onClientPlayerQuit' and '(' .. quitReason .. ')' or '' ) if isTimer( uTimer ) then killTimer( uTimer ) end uTimer = setTimer( function( ) sText = '' end, 5000, 1 ) end addEventHandler( 'onClientRender', root, function( ) if sText ~= '' then dxDrawRelativeRectangle( 245.0,0.0,365.0,23.0,tocolor( 0,0,0,150 ),false ) dxDrawRelativeText( sText,254.0,0.0,757.0,20.0,tocolor(255,255,255,255),1.0,"default","left","top",false,false,false) end end ) addEventHandler ( 'onClientPlayerQuit', root, fDraw ) addEventHandler ( 'onClientPlayerLogin', root, fDraw ) sckatchof, Full code with color codes.
  19. No problem. What you mean? If someone connect, then draw first name . if next connect, draw next name. Like this Someone connect: Server: Kenix has join the server. Again someone connect.( if last drawing then +1 row .If not draw new.( 1 row ) ). So draw it: Server: Kenix has join the server. Server: Qwety~ has join the server. And in 5 sec hide.
  20. Client addEvent( 'onClientPlayerLogin', true ) local sText = '' local uTimer function dxDrawRelativeText( text,posX,posY,right,bottom,color,scale,mixed_font,alignX,alignY,clip,wordBreak,postGUI ) local resolutionX = 1280 local resolutionY = 1024 local sWidth,sHeight = guiGetScreenSize( ) return dxDrawText( tostring( text ), ( posX/resolutionX )*sWidth, ( posY/resolutionY )*sHeight, ( right/resolutionX )*sWidth, ( bottom/resolutionY)*sHeight, color,( sWidth/resolutionX )*scale, mixed_font, alignX, alignY, clip, wordBreak, postGUI ) end function dxDrawRelativeRectangle( posX, posY, width, height,color,postGUI ) local resolutionX = 1280 local resolutionY = 1024 local sWidth,sHeight = guiGetScreenSize( ) return dxDrawRectangle( ( posX/resolutionX )*sWidth, ( posY/resolutionY )*sHeight, ( width/resolutionX )*sWidth, ( height/resolutionY )*sHeight, color, postGUI ) end function fDraw( quitReason ) sText = sText..string.format( '#FFFFFFServer: #FFFFFF%s has %s the server %s \n', getPlayerName( source ), eventName == 'onClientPlayerQuit' and 'left' or eventName == 'onClientPlayerLogin' and 'join', eventName == 'onClientPlayerQuit' and '(' .. quitReason .. ')' or '' ) if isTimer( uTimer ) then killTimer( uTimer ) end uTimer = setTimer( function( ) sText = '' end, 5000, 1 ) end addEventHandler( 'onClientRender', root, function( ) if sText ~= '' then dxDrawRelativeRectangle( 245.0,0.0,365.0,23.0,tocolor( 0,0,0,150 ),false ) dxDrawRelativeText( sText,254.0,0.0,757.0,20.0,tocolor(255,255,255,255),1.0,"default","left","top",false,false,false) end end ) addEventHandler ( 'onClientPlayerQuit', root, fDraw ) addEventHandler ( 'onClientPlayerLogin', root, fDraw ) Server addEventHandler( 'onPlayerLogin', root, function( ) triggerClientEvent( root, 'onClientPlayerLogin', source ) end )
  21. Yes, it's show only who in server.
  22. No problem. but i think you need lengthen rectangle.
×
×
  • Create New...