-
Posts
4,121 -
Joined
-
Last visited
-
Days Won
2
Everything posted by Kenix
-
It should work maybe you use not in client side. local gui = { } gui['form'] = guiCreateWindow( "...",200,200,200,200,false ) guiSetVisible( gui['form'],false )
-
Lua predefined variables. MTA predefined variables. List create user Fro, More details on the functios-handlers Element tree If list is broken or change - write down update list and this post will be updated. Original post by MX_Master viewtopic.php?f=141&t=37420 Wiki: https://wiki.multitheftauto.com/wiki/Pre ... ables_list
-
Oh my bad.I create small mistake Tested local state = { } local txd bindKey( "m","down", function( ) state[ localPlayer ] = not state[ localPlayer ] local State = state[ localPlayer ] if State then txd = engineLoadTXD ( "vgncarshade1.txd" ) engineImportTXD( txd, 3458 ) else destroyElement( txd ) end end )
-
thePlayer is nil in your code. _get = get function get( str ) if type( str ) == 'string' then return _get( str ),str end return false end local isMessageEnabled,st = get( getResourceName( getThisResource( ) ).. '.enabledjoinmessage' ) -- Reads the setting added in the meta, in our case its true. --[[ Example <setting name="#enabledjoinmessage" value="[ true ]" /> ]] -- Adding the event handler! addEventHandler( "onPlayerJoin",root, function( ) if tostring( isMessageEnabled ) == 'true' then -- check if 'enabledjoinmessage' is exits outputChatBox( "Welcome "..getPlayerName( source ) -- Gets the player name and adds a variable to it! .." to our server, please enjoy!",root,255,153,0 ) -- output in chat box else -- if not exits outputChatBox( "The setting ("..st..") is neither false or true! Correct it!",root,255,153,0 ) end end )
-
I am assume resource hedit not running.
-
Maybe he not tested. I not sure if he trigger correct.
-
No problem dude. I update code.
-
addEventHandler( "onPlayerChat", getRootElement(), -- use root in next time function (messageType) -- first argument is message second is message type see on wiki. if messageType == 0 then -- I think you understand problem. outputChatBox("Sorry you cant use this chat, use team chat.", source, 255, 0, 0) cancelEvent() end end) In first time you post code with syntax error.And i at once write my code.
-
local state = { } bindKey( "m","down", function( ) local txd state[ localPlayer ] = not state[ localPlayer ] local State = state[ localPlayer ] if State then txd = engineLoadTXD ( "vgncarshade1.txd" ) engineImportTXD( txd, 3458 ) else destroyElement( txd ) txd = nil end end )
-
Client side local sound addEventHandler( "onClientResourceStart",resourceRoot, function( ) createPed( 0,0,0,0 ) --[[ creating ped ]] sound = playSound( "some.mp3" ) --[[ You need add to meta.xml this line <file src="some.mp3" /> ]] end ) addEventHandler( "onClientPlayerSpawn",localPlayer, function( ) if sound then stopSound( sound ) -- stop sound if player spawned for example sound = nil end end ) https://wiki.multitheftauto.com/wiki/Scr ... troduction https://wiki.multitheftauto.com/wiki/Cli ... _Functions https://wiki.multitheftauto.com/wiki/PlaySound https://wiki.multitheftauto.com/wiki/CreatePed Klesh,Your code is wrong.
-
No problem Yeah Example function noChat( msg,messageType ) if messageType == 0 then if not tCounts[ source ] then tCounts[ source ] = 0 end if tCounts[ source ] ~= Max then tCounts[ source ] = tCounts[ source ] + 1 outputChatBox( "Sorry you cant use this chat, use team chat.", source, 255, 0, 0 ) if isTimer( tTimerInterv[ source ] ) then killTimer( tTimerInterv[ source ] ) end tTimerInterv[ source ] = setTimer( function( player ) tCounts[ player ] = 0 end, interv*1000, 1,source ) else if not isPlayerMuted( source ) then setPlayerMuted( source,true ) outputChatBox( "Sorry you are muted.", source, 255, 0, 0 ) if isTimer( tTimer[ source ] ) then killTimer( tTimer[ source ] ) end tTimer[ source ] = setTimer( function( player ) outputChatBox( "You are unmuted.", player, 255, 0, 0 ) setPlayerMuted( player,false ) tCounts[ player ] = 0 end, Time*1000, 1,source ) end end cancelEvent( ) end end addEventHandler( "onPlayerChat", root, noChat ) addEventHandler( "onPlayerQuit", root, function( ) tTimerInterv[ source ] = nil tTimer[ source ] = nil tCounts[ source ] = nil end ) P.S Need acl rights. Update code.
-
Stop freeroam And test again.
-
Server function noChat( msg,messageType ) if messageType == 0 then outputChatBox( "Sorry you cant use this chat, use team chat.", source, 255, 0, 0 ) cancelEvent( ) end end addEventHandler( "onPlayerChat", root, noChat ) Klesh,Your code is wrong. P.S Tabulate code in next time.
-
Learn https://wiki.multitheftauto.com/wiki/Scr ... troduction http://www.lua.org/manual/5.1/
-
Show how you trigger this events: stopwhileupdate, getting
-
getLocalPlayer( ) т.к это клиентская функция и не может быть на сервере. Изучай лучше https://wiki.multitheftauto.com/wiki/RU/ ... troduction
-
Show your mtaserver.conf Show 'start' log server. I think you not load module mysql. And your script server side?
-
Show your mtaserver.conf
-
Show how you trigger events: stopwhileupdate, getting
-
You can use element data for storage information. Or you can trigger to client. Example Server addEventHandler( "onPlayerLogin",root, function( ) local acc = getPlayerAccount( source ) if acc and not isGuestAccount( acc ) then local result = mysql_query( connect, "SELECT * FROM workers" ) if mysql_num_rows ( result ) > 0 then while true do local row = mysql_fetch_assoc( result ) if not row then break end setElementData( source,"sql.name",row["Name"] ) end mysql_free_result( result ) else mysql_free_result( result ) end end end ) In client just use getElementData.
-
I not understand too. DarkLink,Explain better what you need create.
-
I not understand what you want create. Maybe you mean this? or i not understand. local state,wood function createLine( ) if state and isElement( wood ) then local x,y,z = getElementPosition( localPlayer ) local xW,yW,zW = getElementPosition( wood ) if isLineOfSightClear( x, y, z, xW, yW, zW, true, false, false, true, false, false, localPlayer ) then dxDrawLine3D ( xW, yW, zW+1, xW, yW, zW-1, tocolor ( 0, 255, 0, 255 ), 10 ) setElementPosition( wood,x + 3, y, z+3 ) outputChatBox( "no obstacle visible" ) else outputChatBox( "obstacle visible" ) end end end function place( ) local x,y,z = getElementPosition( source ) if isElement( wood ) then destroyElement( wood ) end wood = createObject ( 1418, x + 3, y, z+3, 150.23657226563, 50.000610351563, 150.47875976563, false ) outputChatBox("a wood vale:" .. tostring( wood ) ) state = true addEventHandler( "onClientRender", wood, createLine ) end addEventHandler ( "onClientPlayerSpawn", root, place ) Updated