-
Posts
857 -
Joined
-
Last visited
Everything posted by Blaawee
-
انت اصصلاآ مم فتحت الويكي . https://wiki.multitheftauto.com/wiki/OnPlayerLogin #المثآل الثآني =)
-
You can loop it or unpack it. I can't explain to you how to do but, maybe this could help you viewtopic.php?f=148&t=58158
-
local status = { }; local timeToWaitFor = 5; addCommandHandler( 'kitarmas', function( player, _, weapon, ammo ) if status[ player ] then return outputChatBox( 'You have to wait '.. timeToWaitFor..' second', player, 255, 0, 0, true ); end if not weapon and not ammo then return outputChatBox( 'Syntex /kitarmas [weapon] [ammo]', player, 255, 0, 0, true ); end giveWeapon( player, getWeaponIDFromName( weapon ), tonumber( ammo ), true ); outputChatBox ( 'You got a ' .. getWeaponIDFromName( weapon ), player, 0, 255, 0, true ); status[ player ] = true; setTimer( function( ) status[ player ] = false end, timeToWaitFor * 1000, 1 ) end );
-
I don't think so, copy the code again.
-
it's working fine with me, make sure it's server side type.
-
local status = { }; local timeToWaitFor = 5; addCommandHandler( 'kitarmas', function( player, _, weapon, ammo ) if status[ player ] then return outputChatBox( 'You have to wait '.. timeToWaitFor..' second', player, 255, 0, 0, true ); end if not weapon and not ammo then return outputChatBox( 'Syntex /kitarmas [weapon] [ammo]', player, 255, 0, 0, true ); end giveWeapon( player, tonumber( weapon ), tonumber( ammo ), true ); status[ player ] = true; setTimer( function( ) status[ player ] = false end, timeToWaitFor * 1000, 1 ) end );
-
local button = guiCreateButton ( .... ) - نسوي زر , addEventHandler( 'onClientGUIClick', button, - لمآ يضغط آللآعب ع آلزر .. function( ) - وظيفةة guiSetEnabled( source, not guiGetEnabled ( source ) ) - يطفي آلزر end, false ) - غلقق آلوظيفةة ! وآلحدث -- function onClientClick (button, state, absoluteX, absoluteYe) if ( source == GUIEditor_Button[ 1 ] ) then guiSetEnabled ( source, false ) setTimer ( guiSetEnabled, 3000, 1, source, true ) end end addEventHandler ("onClientGUIClick", guiRoot, onClientClick )
-
Handler function parameters These are the parameters for the handler function that is called when the command is used. Server player playerSource, string commandName, [string arg1, string arg2, ...]
-
addCommandHandler( 'setStyle', function( player, _, style ) setPedFightingStyle( player, tonumber( style ) ); end );
-
First, Make sure you didn't changed the resource name. Second, it must be the resource that called ' notifications ' is running . The arguments: -- The Types: 'error' 'warning' 'info' -- Server Side: exports.notifications:showBox( element player, string type, string message ); -- Client Side: exports.notifications:showBox( string type, string message ); Here an example for you : --Server side: addEventHandler ( 'onPlayerJoin', root, function( ) exports.notifications:showBox( source, 'info', 'Welcome ' . . getPlayerName ( source ) . . ' to ' . . getServerName( ) . . '!' ); end );
- 1 reply
-
- 1
-
-
setPedAnimation ( source, nil, nil )
-
addEventHandler ( 'onClientClick', root, function( _, _, _, _, _, _, _, clickedElement ) if clickedElement and getElementType ( clickedElement ) == 'player' then -- Do somthing end end );
-
local gMaxSpeed = 80; local gTargetSpeed = 60; function getElementSpeed( element, unit ) if ( unit == nil ) then unit = 0 end if ( isElement( element ) ) then local x, y, z = getElementVelocity( element ); if ( unit == 'mph' or unit == 1 or unit == '1' ) then return ( x ^ 2 + y ^ 2 + z ^ 2) ^ 0.5 * 100; else return ( x ^ 2 + y ^ 2 + z ^ 2 ) ^ 0.5 * 1.61 * 100; end else outputDebugString( 'Not an element. Cant get speed' ); return false end end function setElementSpeed( element, unit, speed ) if ( unit == nil ) then unit = 0; end if ( speed == nil ) then speed = 0; end speed = tonumber( speed ); local acSpeed = getElementSpeed(element, unit); if ( acSpeed ~= false ) then local diff = speed / acSpeed; local x, y, z = getElementVelocity( element ); setElementVelocity( element, x * diff, y * diff, z * diff ); return true else return false end end addEventHandler ( 'onClientRender', root, function( ) for _, player in ipairs( getElementsByType( 'player' ) ) do while true do if not isPedInVehicle( player ) then break end if getElementSpeed( getPedOccupiedVehicle( player ) ) >= gMaxSpeed then setElementSpeed( getPedOccupiedVehicle( player ), nil, gTargetSpeed ); end break end end end );
-
مو مجرب# function getVehicleSpeed( Vehicle ) local x, y, z = getElementVelocity( Vehicle ); return ( x ^ 2 + y ^ 2 + z ^ 2 ) ^ 1 * 100; end function setVehicleSpeed( Vehicle ) local x, y, z = getElementVelocity( Vehicle ); return setElementVelocity ( Vehicle, x, y, z ); end addEventHandler ( 'onClientRender', root, function( ) for _, player in ipairs( getElementsByType( 'player' ) ) do while true do if not isPedInVehicle( player ) then break end if getVehicleSpeed( getPedOccupiedVehicle( player ) ) == 80 then setVehicleSpeed( getPedOccupiedVehicle( player ) ); end break end end end );
-
Use Notepad++. Check this topic : viewtopic.php?f=91&t=31891
-
Use it in server side. createBlipAttachedTo There's an argument called ' visibleTo '.
-
تصحيح الاخ --\\\\\\\\\\\\\\\\\\\\\\\\\\ --// Setting local g_screenX, g_screenY = guiGetScreenSize(); local gScale = 0.3; local gAlphaDistance = 25; local gMaxDistance = 50; -- Max Distance local gTextAlpha = 120; local gTextSize = 1; local gAlphaDiff = gMaxDistance - gAlphaDistance; gScale = 1 / gScale * 800 / g_screenY; local gMaxScaleCurve = { { 0, 0 }, { 3, 3 }, { 13, 5 } }; local gTextScaleCurve = { { 0, 0.8 }, { 0.8, 1.2 }, { 99, 99 } }; local gTextAlphaCurve = { { 0, 0 }, { 25, 100 }, { 120, 190 }, { 255, 190 } }; local marker = createMarker( ... ); -- كمل الارقمنت النآقصه addEventHandler ( 'onClientRender', root, function ( ) local x, y, z = getCameraMatrix( ); local x1, y1, z1 = getElementPosition ( marker ); local distance = getDistanceBetweenPoints3D( x, y, z, x1, y1, z1 ); if distance <= gMaxDistance then local x1_, y1_ = getScreenFromWorldPosition( x1, y1, z1 + 0.95, 0.06 ); if x1_ and y1_ then local scale = 1 / ( gScale * ( distance / gMaxDistance ) ); local alpha = ( ( distance - gAlphaDistance ) / gAlphaDiff ); alpha = ( alpha < 0 ) and gTextAlpha or gTextAlpha - ( alpha * gTextAlpha ); scale = math.evalCurve( gMaxScaleCurve, scale ); local textscale = math.evalCurve( gTextScaleCurve, scale ); local textalpha = math.evalCurve( gTextAlphaCurve, alpha ); dxDrawText( "#FFFF00The Text Here", x1_, y1_, x1_, y1_, tocolor ( 255, 255, 255, textalpha ), textscale * gTextSize, "arial", "center", "bottom", false, false, false, true ); end end end ); -- ////////////////////////////////// -- // MATH FUNCTIONS // -- ////////////////////////////////// function math.evalCurve( curve, input ) if input < curve[ 1 ][ 1 ] then return curve[ 1 ][ 2 ]; end for idx = 2, #curve do if input < curve[ idx ][ 1 ] then local x1 = curve[ idx - 1 ][ 1 ]; local y1 = curve[ idx - 1 ][ 2 ]; local x2 = curve[ idx ][ 1 ]; local y2 = curve[ idx ][ 2 ]; local alpha = ( input - x1 ) / ( x2 - x1 ); return math.lerp( y1, y2, alpha ); end end return curve[ #curve ][ 2 ]; end function math.lerp( from, to, alpha ) return from + ( to-from ) * alpha; end
-
You can use : setElementData getElementData -- or table
-
use these function function guiCreateWindow( x, y, width, height, text, relative ) local window = guiCreateStaticImage ( x, y, width, height, "filePath.png", relative ); -- Dont forget to add here the custome functoin local close = guiCreateStaticImage ( width - 55, 5, 50, 30, "closeButtonFilePath.png", relative, window ); -- And here local header = guiCreateLabel ( 50, 0, 400, 100, text, false, window ); guiSetEnabled ( header, false ); addEventHandler( 'onClientGUIClick', close, function( ) guiSetVisible( window, false ); end ); return window; end function guiCreateButton( x, y, width, height, text, relative ) local button = guiCreateStaticImage ( x, y, width, height, "filePath.png", relative ); -- And here. local buttonText = guiCreateLabel ( x / 2 - width / 2, y / 2 - height / 2, width, height, text, false, button ); guiLabelSetColor( buttonText, 135, 0, 0 ); addEventHandler( 'onClientMouseEnter', guiRoot, function( ) if source == buttonText then guiLabelSetColor( source, 0, 135, 0 ); else guiLabelSetColor( source, 135, 0, 0 ); end end ); return button; end
-
use load pcall
-
Here is an example : local gEvents = {}; local _addEventHandler = addEventHandler; function addEventHandler ( eventName, attachedTo, handlerFunction, getPropagated, priority ) if type( eventName ) == 'string' and type( handlerFunction ) == 'function' then table.insert ( gEvents, { eventName, attachedTo, handlerFunction } ); -- Store all events in table end return _addEventHandler ( eventName, attachedTo, handlerFunction, getPropagated, priority ); end function removeTheEvents( ) -- use this function to remove the events for _, theEvent in ipairs( gEvents ) do removeEventHandler ( theEvent[ 1 ], theEvent[ 2 ], theEvent[ 3 ] ); -- Get all events of the resource then remove it end end
-
Try this : Server Side local jobMarker = createMarker( 2121, 1402, 10, "cylinder", 2, 0, 255, 0 ); local gVeh = {}; addEventHandler( "onMarkerHit", resourceRoot, function( element ) if source == jobMarker and getElementType ( element ) == "player" then if isElement( gVeh[ element ] ) then destroyElement( gVeh[ element ] ); end if isPedInVehicle( element ) then removePedFromVehicle( element ); end local gVeh[ element ] = createVehicle ( 431, 2107, 1395, 10 ); warpPedIntoVehicle ( element, gVeh[ element ] ); outputChatBox ( 'you can earn money by driving to the markers', element ); local arriveMarker = createMarker ( 2038.26, 1514.01, 9, "cylinder", 1.5, 255, 255, 0, 170, element ); local Blip = createBlip ( 2038.26, 1514.01, 13, 41, 0, 0, 0, 255, 0, 99999, element ); elseif source == arriveMarker then outputChatBox ( 'you arrived to the marker and you won $1000000', element ); givePlayerMoney( element, 1000000 ); destroyElement( source ); destroyElement( Blip ); if isElement( gVeh[ element ] ) then destroyElement( gVeh[ element ] ); end end end );