-
Posts
4,121 -
Joined
-
Last visited
-
Days Won
2
Everything posted by Kenix
-
https://wiki.multitheftauto.com/wiki/Ser ... _functions
-
If you not understand .. addEventHandler( 'onMarkerHit', root, function( uHitElement, bMatchingDimension) if getElementType( uHitElement ) == 'player' and isPedInVehicle( uHitElement ) then return end -- Doing something! -- .... end )
-
addEventHandler( 'onMarkerHit', root, function( uHitElement, bMatchingDimension) if getElementType( uHitElement ) == 'player' and isPedInVehicle( uHitElement ) then return end end )
-
You mean this? Try local connectionHandle; local pldata = { { "id", "0" }; { "name", "N/A" }; { "age", "0" }; { "profession", "N/A" }; { "language", "N/A" }; } addEventHandler( 'onPlayerJoin', root, function( ) spawnPlayer( source, 1959.55, -1714.46, 10 ) fadeCamera( source, true ) setCameraTarget( source, source ) end ) addEventHandler( 'onResourceStart', resourceRoot, function( ) connectionHandle = dbConnect( "mysql", "dbname=testgm;host=localhost", "root", "" ) local tQuery = dbQuery( connectionHandle, "SELECT * FROM `user` WHERE `id` = 1" ) local tResult, nNumrows, sErrmsg = dbPoll ( tQuery , -1 ) if nNumrows > 0 then for nKey, value in ipairs( tResult ) do pldata[ nKey ][ 2 ] = value end end end ) or this local connectionHandle; local pldata = { { "id", "0" }; { "name", "N/A" }; { "age", "0" }; { "profession", "N/A" }; { "language", "N/A" }; } addEventHandler( 'onPlayerJoin', root, function( ) spawnPlayer( source, 1959.55, -1714.46, 10 ) fadeCamera( source, true ) setCameraTarget( source, source ) end ) addEventHandler( 'onResourceStart', resourceRoot, function( ) connectionHandle = dbConnect( "mysql", "dbname=testgm;host=localhost", "root", "" ) local tQuery = dbQuery( connectionHandle, "SELECT * FROM `user` WHERE `id` = 1" ) local tResult, nNumrows, sErrmsg = dbPoll ( tQuery , -1 ) if nNumrows > 0 then for nKey, value in ipairs( tResult[1] ) do pldata[ nKey ][ 2 ] = value end end end ) I not know exactly. I not use mta mysql functions. I use mysql module Updated.
-
Please explain more better.
-
No problem. Not understand.
-
In lua not have defaults arguments ( very bad ) I like it in c++ like languages. function fTest( n ) if type( n ) == 'number' then return n + 1 end return 1 end print( fTest( 1 ) ) -- 2 print( fTest( ) ) -- 1 function fTestNext( n ) local n = type( n ) == 'number' and n or 1 return n + 1 end print( fTestNext( 0 ) ) -- 1 print( fTestNext( ) ) -- 2 Ask questions. Can you please explain me this line? local n = type( n ) == 'number' and n or 1 You define local variable n and you check variable n ( in arguments function ) ( is number ) and you get count this variable. If variable n not number then local variable n is 1.
-
SetTimer(GoGoGo,5000,1,city) What is it? Lua is case sensitive!
-
In lua not have defaults arguments ( very bad ) I like it in c++ like languages. function fTest( n ) if type( n ) == 'number' then return n + 1 end return 1 end print( fTest( 1 ) ) -- 2 print( fTest( ) ) -- 1 function fTestNext( n ) local n = type( n ) == 'number' and n or 1 return n + 1 end print( fTestNext( 0 ) ) -- 1 print( fTestNext( ) ) -- 2 Ask questions.
-
Create vehicle. Create ped. Warp ped to vehicle. Trigger to client. setPedControlState And use argument 'accelerate'.
-
Replace 24 line with this. local uTeam = getPlayerTeam( hitElement ) local name = uTeam and getTeamName( uTeam ) or false
-
Check all conditions, variables, ...
-
BinSlayer1,Solidsnake14 *FACEPALM* Example function fSize( ... ) return #( ... ) end print( fSize( { [1] = true; [3] = 4 } ) )-- 1 function fSize( ... ) return #( ... ) end print( fSize( { [1] = true; [2] = 2; [3] = 4 } ) ) -- 3 It's correct function fTableSize( ... ) local nCount = 0 for _ in pairs( ... ) do nCount = nCount + 1 end return nCount end print( fTableSize { [1] = 1; [3] = 3 } )-- 2 ipairs looping only numeric indexes in table and in order. I show upper examples. Also table.getn, operator # use this method too.
-
Your meta.xml WRONG. <meta> <info name="lol" type="script" author="Naz" version="1.0" description="smth" /> <script src="smth.lua" /> </meta> Also use my meta.xml generator viewtopic.php?f=108&t=41111 P.S Also read it https://wiki.multitheftauto.com/wiki/Meta.xml
-
I already say about this. Also i colored it.
-
https://wiki.multitheftauto.com/wiki/RestoreWorldModel
-
better onClientHUDRender https://wiki.multitheftauto.com/wiki/Gam ... sing_Order
-
Try Server addEventHandler( 'onResourceStart', root, function( ) uPed = createPed( 252, -158, 584, 15) uVehicle = createVehicle( 515, -158, 584, 16, 0, 0, 284 ) setTimer( function( uVehicle ) warpPedIntoVehicle ( uPed, uVehicle ) end, 1000, 1, uVehicle ) if uVehicle then setTimer( function( uVehicle ) setElementVelocity( uVehicle, 0.5, 0, 0 ) end, 5000, 1, uVehicle ) end uMarker = createMarker( -35, 613, 11, "ring", 3 ) addEventHandler( 'onMarkerHit', root, function( uHitElement, bDim ) if source == uMarker then if getElementType( uHitElement ) == 'player' and isPedInVehicle( uHitElement ) then setTimer( function( uHitElement ) setElementRotation( getPedOccupiedVehicle( uHitElement ) or uHitElement, 0, 90, 30 ) ------------------------ don't rotate! end, 1000, 1, uHitElement ) end end end ) end )