Jump to content

Kenix

Retired Staff
  • Posts

    4,121
  • Joined

  • Last visited

  • Days Won

    2

Everything posted by Kenix

  1. Kenix

    Problem

    I not understand what you mean local gui = { } local timer function on_pushButton_clicked(button,state) if button == "left" and state == "up" then local nRnd,nRnd2 gui[ "imagen_3" ] = guiCreateStaticImage( 32,32,178,222,tablaImagen[ math.random( 1,24 ) ) ],false,gui["_root"] ) gui[ "imagen_4" ] = guiCreateStaticImage( 381,32,178,222,tablaImagen[ math.random( 1,24 ) ],false,gui["_root"] ) guiSetVisible( gui["imagen_3"],false ) guiSetVisible( gui["imagen_4"],false ) if isTimer( timer ) then killTimer( timer ) end timer = setTimer( function( ) nRnd,nRnd2 = math.random( 1,24 ) ,math.random( 1,24 ) guiStaticImageLoadImage( gui[ "imagen_3" ],tablaImagen[ nRnd ] ) guiStaticImageLoadImage( gui[ "imagen_4" ],tablaImagen[ nRnd2 ] ) end, 1000, 10 ) guiSetVisible( gui["imagen_3"],true ) guiSetVisible( gui["imagen_4"],true ) guiSetText( gui["label"],tablaSkins[ nRnd ] ) guiSetText( gui["label_2"],tablaSkins[ nRnd2 ] ) end end Maybe you mean this. P.S table tablaSkins and tablaImagen defined?
  2. Use resource joinquit.( have in resources ) If not download latest resources http://code.google.com/p/mtasa-resources/downloads/list
  3. Kenix

    addEventHandler

    addEvent( "hideRegisterWindow", true ) addEvent( "hideLoginWindow", true ) login_Window = guiCreateWindow( 0.3252,0.3138,0.3428,0.276,"Login Window",true ) guiSetAlpha( login_Window,1 ) guiWindowSetMovable( login_Window,false ) guiWindowSetSizable( login_Window,false ) loginNick_Edit = guiCreateEdit( 0.0627,0.3632,0.8946,0.1415,getPlayerName( localPlayer ),true,login_Window ) loginPw_Edit = guiCreateEdit( 0.0598,0.6509,0.8946,0.1415,"",true,login_Window ) guiEditSetMasked( loginPw_Edit,true ) username_Label = guiCreateLabel( 0.0769,0.2547,0.8462,0.1038," Username",true,login_Window ) guiSetFont( username_Label,"default-bold-small" ) password_Label = guiCreateLabel( 0.0769,0.533,0.8462,0.1038," Password",true,login_Window ) guiSetFont( password_Label,"default-bold-small" ) loginOrRegister_Label = guiCreateLabel( 0.0769,0.1179,0.8462,0.1038," Login or Register",true,login_Window ) guiSetFont( loginOrRegister_Label,"default-bold-small") login_Button = guiCreateButton( 0.0285,0.8491,0.3561,0.1085,"Login",true,login_Window ) guiSetFont( login_Button,"default-bold-small" ) register_Button = guiCreateButton( 0.6182,0.8443,0.3561,0.1085,"Register",true,login_Window ) guiSetFont( register_Button,"default-bold-small" ) showCursor ( true ) guiSetInputEnabled( true ) function onClickLogin ( button, state ) triggerServerEvent ( "onLogin", root, localPlayer, guiGetText( loginNick_Edit ), guiGetText( loginPw_Edit ) ) end function onClickRegister ( button, state ) register_Window = guiCreateWindow( 0.3252,0.3138,0.3428,0.276,"Register Window",true ) guiSetAlpha( register_Window,1 ) guiWindowSetMovable( register_Window,false ) registerNick_Edit = guiCreateEdit( 0.0627,0.3632,0.8946,0.1415,"",true,register_Window ) registerPw_Edit = guiCreateEdit( 0.0598,0.6509,0.8946,0.1415,"",true,register_Window ) guiEditSetMasked( registerPw_Edit,true ) registerUsername_Label = guiCreateLabel( 0.0769,0.2547,0.8462,0.1038," Username",true,register_Window ) guiSetFont( registerUsername_Label,"default-bold-small" ) registerPassword_Label = guiCreateLabel( 0.0769,0.533,0.8462,0.1038," Password",true,register_Window ) guiSetFont( registerPassword_Label,"default-bold-small" ) loginOrRegister_Label2 = guiCreateLabel( 0.0769,0.1179,0.8462,0.1038," Login or Register",true,register_Window ) guiSetFont( loginOrRegister2_Label,"default-bold-small" ) register_Button2 = guiCreateButton( 0.6182,0.8443,0.3561,0.1085,"Register",true,register_Window ) guiSetFont( register_Button2,"default-bold-small" ) end function onClickRegister2 ( button, state ) triggerServerEvent ( "onRegister", root, localPlayer, guiGetText( registerNick_Edit ), guiGetText( registerPw_Edit ) ) end function hideLoginWindow( ) guiSetInputEnabled(false) guiSetVisible ( login_Window, false ) showCursor ( false ) end addEventHandler( "hideLoginWindow", root, hideLoginWindow ) function hideRegisterWindow( ) guiSetInputEnabled( false ) guiSetVisible ( register_Window, false ) showCursor ( false ) end addEventHandler( "hideRegisterWindow", root, hideRegisterWindow ) addEventHandler ( "onClientGUIClick", login_Button, onClickLogin,false ) addEventHandler ( "onClientGUIClick", register_Button, onClickRegister,false ) addEventHandler ( "onClientGUIClick", register_Button2, onClickRegister2,false ) Because you delete window.
  4. Зачем ты раскрыл такую тайну? Я думал они не догадаются
  5. Kenix

    addEventHandler

    addEvent( "hideRegisterWindow", true ) addEvent( "hideLoginWindow", true ) login_Window = guiCreateWindow( 0.3252,0.3138,0.3428,0.276,"Login Window",true ) guiSetAlpha( login_Window,1 ) guiWindowSetMovable( login_Window,false ) guiWindowSetSizable( login_Window,false ) loginNick_Edit = guiCreateEdit( 0.0627,0.3632,0.8946,0.1415,getPlayerName( localPlayer ),true,login_Window ) loginPw_Edit = guiCreateEdit( 0.0598,0.6509,0.8946,0.1415,"",true,login_Window ) guiEditSetMasked( loginPw_Edit,true ) username_Label = guiCreateLabel( 0.0769,0.2547,0.8462,0.1038," Username",true,login_Window ) guiSetFont( username_Label,"default-bold-small" ) password_Label = guiCreateLabel( 0.0769,0.533,0.8462,0.1038," Password",true,login_Window ) guiSetFont( password_Label,"default-bold-small" ) loginOrRegister_Label = guiCreateLabel( 0.0769,0.1179,0.8462,0.1038," Login or Register",true,login_Window ) guiSetFont( loginOrRegister_Label,"default-bold-small") login_Button = guiCreateButton( 0.0285,0.8491,0.3561,0.1085,"Login",true,login_Window ) guiSetFont( login_Button,"default-bold-small" ) register_Button = guiCreateButton( 0.6182,0.8443,0.3561,0.1085,"Register",true,login_Window ) guiSetFont( register_Button,"default-bold-small" ) showCursor ( true ) guiSetInputEnabled( true ) function onClickLogin ( button, state ) triggerServerEvent ( "onLogin", root, localPlayer, guiGetText( loginNick_Edit ), guiGetText( loginPw_Edit ) ) end function onClickRegister ( button, state ) destroyElement( login_Window, true ) register_Window = guiCreateWindow( 0.3252,0.3138,0.3428,0.276,"Register Window",true ) guiSetAlpha( register_Window,1 ) guiWindowSetMovable( register_Window,false ) registerNick_Edit = guiCreateEdit( 0.0627,0.3632,0.8946,0.1415,"",true,register_Window ) registerPw_Edit = guiCreateEdit( 0.0598,0.6509,0.8946,0.1415,"",true,register_Window ) guiEditSetMasked( registerPw_Edit,true ) registerUsername_Label = guiCreateLabel( 0.0769,0.2547,0.8462,0.1038," Username",true,register_Window ) guiSetFont( registerUsername_Label,"default-bold-small" ) registerPassword_Label = guiCreateLabel( 0.0769,0.533,0.8462,0.1038," Password",true,register_Window ) guiSetFont( registerPassword_Label,"default-bold-small" ) loginOrRegister_Label2 = guiCreateLabel( 0.0769,0.1179,0.8462,0.1038," Login or Register",true,register_Window ) guiSetFont( loginOrRegister2_Label,"default-bold-small" ) register_Button2 = guiCreateButton( 0.6182,0.8443,0.3561,0.1085,"Register",true,register_Window ) guiSetFont( register_Button2,"default-bold-small" ) end function onClickRegister2 ( button, state ) triggerServerEvent ( "onRegister", root, localPlayer, guiGetText( registerNick_Edit ), guiGetText( registerPw_Edit ) ) end function hideLoginWindow( ) guiSetInputEnabled(false) guiSetVisible ( login_Window, false ) showCursor ( false ) end addEventHandler( "hideLoginWindow", root, hideLoginWindow ) function hideRegisterWindow( ) guiSetInputEnabled( false ) guiSetVisible ( register_Window, false ) showCursor ( false ) end addEventHandler( "hideRegisterWindow", root, hideRegisterWindow ) addEventHandler ( "onClientGUIClick", login_Button, onClickLogin,false ) addEventHandler ( "onClientGUIClick", register_Button, onClickRegister,false ) addEventHandler ( "onClientGUIClick", register_Button2, onClickRegister2,false )
  6. So you need check key( 'mouse1' if player clamped this key ) in event onClientRender .Then you need know cursor position. If cursor show then you need check x-axis ( in function https://wiki.multitheftauto.com/wiki/GetCursorPosition ).You need create this: if x > 500 then rotate car z-axis +1 if x < 500 then rotate car z-axis - 1. You also need the border where you can use the mouse to rotate the vehicle.( just check cursor position ) P.S If you created vehicle ( done you selected ) you should destroy this car and create vehicle in server ( because it need for sync ). If you create vehicle in client side only you can see.
  7. local playerCash = loadPlayerData(thePlayer,"cash") Возвращает ложь у тебя. Скорее всего аккаунт дата 'cash' не существует. local playerCash = loadPlayerData( thePlayer,"cash" ) or 0 Возвращаем 0 если аккаунт дата возвращает ложь. if (isGuestAccount(getPlayerAccount(thePlayer)) == true) then К чему это?Условие if then выполняется если переменная ( или функция ) возвращает значение не ложь( false ) и не ноль( nil ). Т.е var = 1 if var then print 'done' end -- > 'done' var = false if var then print 'done' else print 'done2' end -- > 'done 2' var = nil if not var then print 'done' end -- > 'done' var = false if not var then print 'done' end -- > 'done'
  8. function getPointFromDistanceRotation(x, y, dist, angle) local a = math.rad(90 - angle); local dx = math.cos(a) * dist; local dy = math.sin(a) * dist; return x+dx, y+dy; end function destroy( ) local px, py, pz = getElementPosition( localPlayer ) local rx, ry, rz = getElementRotation( localPlayer ) local tz, ty = getPointFromDistanceRotation( x, y, 2, rz ) local hit, hitX, hitY, hitZ, hitlineElement, normalX, normalY, normalZ = processLineOfSight( px, py, pz, tx, ty, pz+5,true, true, false, true, false, true, false, true, localPlayer ) if isElement( hitlineElement ) then if getElementModel( hitlineElement ) == 979 then triggerServerEvent ( "destroyRoadblock", localPlayer, hitlineElement ) end end end addCommandHandler( "destroyroadblock", destroy ) addEvent( "destroyRoadblock", true ) function destroyRoadblock( hitlineElement ) destroyElement( hitlineElement ) end addEventHandler( "destroyRoadblock", root, destroyRoadblock )
  9. Это событие срабатывает , когда игрок может убить игрока ножом с зади. Т.е если например отменить это событие , то нельзя будет убить игрока ножом с зади.
  10. чтобы результат вернуть, его надо получить.. Ты его получаешь через функцию getAccountData и возвращаешь через оператор return. function loadPlayerData ( thatPlayer,datatype ) local playeraccount = getPlayerAccount ( thatPlayer ) if ( playeraccount ) and not isGuestAccount ( playeraccount ) then return getAccountData( playeraccount, datatype ) end return false end
  11. Тебе надо возвращать результат в функции loadPlayerData. Для тебя пока лучше Account Data. Потом уже изучишь мускул/склайт.
  12. Тебе надо понять алгоритм просто.
  13. Да это я понял. Я понял из твоего кода что ты вызываешь эти функции savePlayerData/loadPlayerData и в 1 аргумент передаёшь элемент( юзердату ) , но в первом условии ты проверяешь ,что 1 аргумент существует и что этот аргумент не пустая строка. Зачем? Не могу понять. Дальше ты из функции ( getPlayerFromParticalName ) хочешь получить элемент ( который уже есть у тебя ты его передал ) , но функция getPlayerFromParticalName вернёт false , потому-что ты указал не строку в аргумент функции. Зачем? Для чего это.
  14. Я указал ошибку, но смысл кода не понял твоего ..
  15. Ты вызываешь функцию getPlayerFromParticalName и юзаешь 1 аргумент userdata т.е элемент , а должен строку.
  16. function OnNametagUpdate( player ) setPlayerNametagText( player, getPlayerName( player ) .. "[" .. ( tonumber( getPlayerWantedLevel( player ) ) or 0 ) .. "]" ) end function NametagUpdate() for _, p in ipairs( getElementsByType( "player" ) ) do OnNametagUpdate( p ); end end setTimer( NametagUpdate, 1000, 0 ); Kernell,тоже вариант кстати. У тебя ошибка не большая source nil в аргументе функции setPlayerNametagText. Т.е надо юзать player.
  17. Сервер. function playerLogin ( ) local wantedLvl = getPlayerWantedLevel ( source ) if wantedLvl == 0 then setPlayerNametagText ( source, getPlayerName( source ) .. "[0]" ) else setPlayerNametagText ( source, getPlayerName( source ) .. "[wantedLvl]" ) end end addEventHandler ( "onPlayerLogin", root, playerLogin ) https://wiki.multitheftauto.com/wiki/Event_system viewtopic.php?f=141&t=37420
  18. Try it. addEvent( 'onMapStarting',true ) addEventHandler( 'onMapStarting',root, function ( ) local map = getResourceName( exports['mapmanager']:getRunningGamemodeMap( ) ) while not map do map = getResourceName( exports['mapmanager']:getRunningGamemodeMap( ) ) end local result = executeSQLQuery ( "SELECT player, time FROM Top WHERE map = '" ..map.. "'" ) if not result or #result == 0 then executeSQLQuery( "INSERT INTO Top VALUES ('"..map.."','No one', '"..tostring( 100 )..":"..tostring( 100 ).."')" ) setElementData( root,'playerName',"No one" ) setElementData( root,'timeMT',tostring( 100 )..":"..tostring( 100 ) ) triggerClientEvent( 'clientStart',root ) else setElementData( root,'playerName',tostring( result[1]['player'] ) ) setElementData( root,'timeMT',tostring( result[1]['time'] ) ) triggerClientEvent( 'clientStart',root ) end end )
  19. Lol,i tested it and it colored.
  20. Same myonlake,index's can't be local in table. This is syntax error.
×
×
  • Create New...