Jump to content

Kenix

Retired Staff
  • Posts

    4,121
  • Joined

  • Last visited

  • Days Won

    2

Everything posted by Kenix

  1. My bad:/ I didn't read first post better. Your table not exists in registry.db ( all executeSQL .. functions working only with registry.db ) Also in XAMPP included Apache MySQL PHP Perl. Where you see sqlite? You working with mysql ... So use this functions: https://wiki.multitheftauto.com/wiki/DbConnect https://wiki.multitheftauto.com/wiki/DbExec https://wiki.multitheftauto.com/wiki/DestroyElement
  2. https://wiki.multitheftauto.com/wiki/InterpolateBetween ?
  3. Check your table in PMA.
  4. executeSQLQuery( "DROP TABLE `testtable`" ) or executeSQLDropTable( "testtable" ) Updated.
  5. Better create all in client side. if ping > 600 then trigger to server and kick player. Also you should add rights for this resource use "kickPlayer" function. Client --[[ Writed by Kenix Version: 1.0.0 ]] local nPingMax = 600 setTimer( function( nPingMax ) local nCurrentPing = getPlayerPing( localPlayer ) if nCurrentPing >= nPingMax then triggerServerEvent( 'Server:KickPlayer', localPlayer, nPingMax, nCurrentPing ) end end, 5000, 0, nPingMax ) Server addEvent( 'Server:KickPlayer', true ) addEventHandler( 'Server:KickPlayer', root, function( nPingMax, nCurrentPing ) kickPlayer( source, 'Your ping = ' .. tostring( nCurrentPing ) .. ' , Max ping = ' .. tostring( nPingMax ) ) end ) You can use it. I create this for my gm.
  6. Kenix

    help please

    Check what return this line local nHouse = guiGetText ( housenumber );
  7. Corrected code addEvent ( 'openGUI', true ) local vehicles = { 'Patriot'; } function openGUI ( ) window = guiCreateWindow ( 0.3,0.2,0.3,0.6,'SACR Car spawn',true ) gridlist = guiCreateGridList ( 0.1,0.1,0.8,0.7,true,window ) column = guiGridListAddColumn( gridlist, 'Vehicles:', 0.85 ) for index, vehicle in ipairs ( vehicles ) do local row = guiGridListAddRow ( gridlist ) guiGridListSetItemText ( gridlist, row, column, tostring ( vehicle ), false, false ) end button = guiCreateButton ( 0.6,0.85,0.4,0.1,'Spawn',true,window ) close = guiCreateButton( 0,0.85,0.4,0.1,'Close',true,window ) showCursor ( true ) end function destroyGUI( ) destroyElement( window ) showCursor ( false ) window = nil end function buttonClick ( ) if ( source == button ) then -- 'row' is not a GUI element. local nRow, nCol = guiGridListGetSelectedItem ( gridlist ) if ( nRow and nCol and nRow ~= -1 and nCol ~= -1 ) then local sVehicleName = guiGridListGetItemText ( gridlist, nRow, nCol ) triggerServerEvent ( 'vehicle', localPlayer, getVehicleModelFromName ( sVehicleName ) ) destroyGUI ( ) end elseif source == close then destroyGUI ( ) end end addEventHandler ( 'onClientGUIClick', root, buttonClick ) addEventHandler ( 'openGUI', root, openGUI ) local uMyMarker = createMarker ( 1539.3, -1686.8, 13, 'cylinder', 2, 255, 225, 0, 150 ) addEvent ( 'vehicle', true ) addEventHandler ( 'vehicle', root, function ( nModel ) local uVehicle = createVehicle ( nModel, 1539.3, -1686.8, 13 ) setTimer( warpPedIntoVehicle, 1000, 1, source, uVehicle ) end ) addEventHandler ( 'onMarkerHit', root, function ( uPlayer ) if ( source == uMyMarker ) then triggerClientEvent ( uPlayer, 'openGUI', uPlayer ) end end ) Your problem here: addEventHandler ( 'vehicle', root, function ( uPlayer ) local uVehicle = createVehicle ( 470, 1539.3, -1686.8, 13 ) setTimer( warpPedIntoVehicle, 1000, 1, uPlayer, uVehicle ) end ) Variable uPlayer is not element, it's number of model vehicle .. You should use source here. viewtopic.php?f=91&t=39678 addEventHandler ( 'vehicle', root, function ( nModel ) local uVehicle = createVehicle ( nModel, 1539.3, -1686.8, 13 ) setTimer( warpPedIntoVehicle, 1000, 1, source, uVehicle ) end ) P.S Solidsnake14, ... You just fix it and not explain him ... Good job
  8. local uMyMarker = createMarker ( 1539.3, -1686.8, 13, 'cylinder', 2, 255, 225, 0, 150 ) addEvent ( 'vehicle', true ) addEventHandler ( 'vehicle', root, function ( uPlayer ) local uVehicle = createVehicle ( 470, 1539.3, -1686.8, 13 ) setTimer( warpPedIntoVehicle, 1000, 1, uPlayer, uVehicle ) end ) addEventHandler ( 'onMarkerHit', root, function ( uPlayer ) if ( source == uMyMarker ) then triggerClientEvent ( uPlayer, 'openGUI', uPlayer ) end end ) You should use timer for warp player into vehicle. Also use in next time /debugscript 3 And show your client side code if this didn't working.
  9. Пора закругляться уже вам ..
  10. Попроси побольше места если не нравится.
  11. Kenix

    onColShapeHit

    local tTempAreas = { tRedAreas = { }; tGreenAreas = { }; } local tAllAreas = { tRedAreas = { { nX = 300, nY = 50, nWidth = 50, nHeight = 50 }; }; tGreenAreas = { { nX = 200, nY = 100, nWidth = 50, nHeight = 50 }; }; } local fOnRectangleHit = function ( uPlayer ) outputChatBox ( getPlayerName ( uPlayer ) .. ' entered the ColShape!', root, 255, 255, 255 ) end local fOnRectangleLeave = function ( uPlayer ) outputChatBox ( getPlayerName ( uPlayer ) .. ' left the ColShape!', root, 255, 255, 255 ) end addEventHandler ( 'onResourceStart', resourceRoot, function ( ) for sName, tArea in pairs( tAllAreas ) do for _, tValue in pairs( tArea ) do tTempAreas[ sName ][ #tTempAreas[ sName ] + 1 ] = createColRectangle ( tValue.nX, tValue.nY, tValue.nWidth, tValue.nHeight ) addEventHandler ( 'onColShapeHit', tTempAreas[ sName ][ #tTempAreas[ sName ] ], fOnRectangleHit ) addEventHandler ( 'onColShapeLeave', tTempAreas[ sName ][ #tTempAreas[ sName ] ], fOnRectangleLeave ) end end end )
  12. Может быть db, а не bd? db = Database Почитать: http://www.mysql.ru/docs/ viewtopic.php?f=142&t=37482 http://www.spravkaweb.ru/mysql/
  13. Kenix

    police script

    DrakeN + 1 Just create your own .. viewtopic.php?f=148&t=40809 https://wiki.multitheftauto.com/wiki/Scr ... troduction https://wiki.multitheftauto.com/wiki/Int ... ng_the_GUI
  14. Just learn lua. viewtopic.php?f=148&t=40809 Anyway use /debugscript 3.
  15. Kenix

    Pls Correct

    addCommandHandler ( "drawWel", function ( uPlayer ) triggerClientEvent ( root, "drawTheText", uPlayer ) end ) Better way.
  16. Kenix

    Pls Correct

    In triggerClientEvent, where recipient - root element, it's better with loop,in this case the function only finds the players in the element tree. But if you use loop then it creates additional packet in each request. Also if root element - source in trigger (Client/Server) Event this is bad. MTA loops all the elements in the element tree and attaches each handler to it for the event.
  17. It's rly easy to understand. If someone condition return false then this function return false otherwise true. print( false and false and false and false ) -- false print( false and true ) -- false print( false or true ) -- true print( 1 == 1 and true or false ) -- true print( 1 == 1 ) -- true print( 1 ~= 1 ) -- false print( 1 ~= 1 and 0 or 1 ) -- 1 print( true ~= true and true or false ) -- false
×
×
  • Create New...