Jump to content

KariiiM

Members
  • Posts

    1,312
  • Joined

  • Last visited

Posts posted by KariiiM

  1. Hello community,

    I'm using MySQL database to save data for my scripts I make for people in local server, I wonder if there's a way to use MySQL in local server with out using XAMP since XAMP force you to close the skype before using it, is there any good remplacement?

    Thanks in advance.

  2. Lua developers had created "ipairs" and "pairs" loops for their purpose, each loop has its role and its own usage;

    "ipairs": looping indexed tables and in order.

    "pairs":  looping  the tables who were created with a key-value and pairs donnot return the table's items in order even for indexed tables.

  3. Hey swag_k_dog, try my code and let me know

    --CLIENT SIDE:

    local missionMarker = createMarker(2153, -1799, 12.5, "cylinder", 1.1, 255, 0, 0, 100)
    local FONT = guiCreateFont(":freeroam_login/images/gtasanandreas.ttf", 50)
    
    function missionGui()
        missionName = guiCreateLabel(0.64, 0.85, 0.38, 0.13, "sweet buisness", true)
        guiSetFont(missionName, FONT)
        guiLabelSetColor(missionName, 252, 226, 81)
    end
    
    function destroyGuis ( )
        if isElement ( missionName ) then 
    		destroyElement ( missionName )
    	end
    end
    
    addEventHandler ( "onClientMarkerHit", missionMarker, 
    	function ( hitElement )
    		if ( isElement ( hitElement ) and hitElement == localPlayer ) then
    			triggerServerEvent ( "server->hitMarker", localPlayer, localPlayer )
    		end
    	end
    )
    
    addEventHandler ( "onClientMarkerLeave", missionMarker, 
    	function ( hitElement )
    		if ( isElement ( hitElement ) and hitElement == localPlayer ) then
    			destroyGuis	( )      
    		end
    	end
    )
    
    addEvent ( "client->hitMarker", true )
    addEventHandler ( "client->hitMarker", localPlayer, 
    	function ( )
    		missionGui ( )
    		fadeCamera ( false, 1.3 ) 
    		setTimer ( fadeCamera, 3000, 1, false, 1.3 )
    		setTimer ( guiSetVisible, 5500, 1, missionName, false )
    	end
    )

     

    --SERVER SIDE:

    addEvent ( "server->hitMarker", true )
    addEventHandler ( "server->hitMarker", root, 
    	function ( player )
    		if ( not client ) then
    			return
    			-- for security reasons, this helps against rouge clients
    		end
    		
    		if ( not player ) then
    			return
    			-- the same
    		end
    		triggerClientEvent ( client, "client->hitMarker", client )
    	end
    )

     

  4. Make a check if the player is logged in then get his account name, otherwise you will need to store it the player name somewhere each time logged / left the game and get it later.

  5. Hello there,

    I wanna know why I get this error message in my local server console,

    ERROR Msg:

    Quote

    DIAGNOSTIC: KariM #1012 External HTTP file download error:[404] Error downloading requested files. HTTP response code said error. [The requested URL returned error: 404 Not Found] [myFolderName/myFileName.lua] (Disabling External HTTP) [myFolderName/myFileName.lua]

     

    Kind regards,

    KariM

  6. Change the old client code by this:

    --start sound
    function start_fire_sound ( )
    	if isPedInVehicle ( localPlayer ) then
    		local theVehicle = getPedOccupiedVehicle ( localPlayer )
    		if ( theVehicle and getElementModel ( theVehicle ) == 476 ) then 
    			triggerServerEvent ( "start_fire_sound", localPlayer, theVehicle ) 
    		end
    	end
    end
    bindKey ( "lctrl", "down", start_fire_sound )
    
    local fireSound = { }
    local lastShot = { }
    
    addEvent ( "return_start_fire_sound", true )
    addEventHandler ( "return_start_fire_sound", root, 
    	function ( )
    		if isElement ( fireSound [ localPlayer ] ) then
    			destroyElement ( fireSound [ localPlayer ] ) 
    		end
    		local x, y, z = getElementPosition ( source )
    		fireSound [ localPlayer ] = playSound3D ( "files/fire.wav", x, y, z, true )
    		setSoundVolume ( fireSound [ localPlayer ], 1 )
    		setSoundMaxDistance ( fireSound [ localPlayer ], 500 )
    		attachElements ( fireSound [ localPlayer ], source, 0, 0, 0 ) 
    	end
    )
     
    --stop sound
    function stop_fire_sound ( )
    	if isPedInVehicle ( localPlayer ) then
    		local theVehicle = getPedOccupiedVehicle ( localPlayer )
    		if ( theVehicle and getElementModel ( theVehicle ) == 476 ) then
    			triggerServerEvent ( "stop_fire_sound", localPlayer, theVehicle ) 
    		end
    	end
    end
    bindKey ( "lctrl", "up", stop_fire_sound )
     
    addEvent( "return_stop_fire_sound", true )
    addEventHandler( "return_stop_fire_sound", root,
    	function ( )
    		if isElement ( lastShot [ localPlayer ] ) then
    			destroyElement ( lastShot [ localPlayer ] ) 
    		end
    		
    		if isElement ( fireSound [ localPlayer ] ) then
    			destroyElement ( fireSound [ localPlayer ] ) 
    		end
    		local x, y, z = getElementPosition ( source )	
    		lastShot [ localPlayer ] = playSound3D ( "files/fire_lastshot.wav", x, y, z, true )
    		setSoundVolume ( lastShot [ localPlayer ], 1 )
    		setSoundMaxDistance ( lastShot [ localPlayer ], 500 )
    		attachElements ( lastShot [ localPlayer ], source, 0,0,0 ) 
    	end
    )

     

  7. Try my code and inform me the results.

    --Client side:

    --start sound
    function start_fire_sound ( )
    	if isPedInVehicle ( localPlayer ) then
    		local theVehicle = getPedOccupiedVehicle ( localPlayer )
    		if ( theVehicle and getElementModel ( theVehicle ) == 476 ) then 
    			triggerServerEvent ( "start_fire_sound", localPlayer, theVehicle ) 
    		end
    	end
    end
    bindKey ( "lctrl", "down", start_fire_sound )
     
    addEvent ( "return_start_fire_sound", true )
    addEventHandler ( "return_start_fire_sound", root, 
    	function ( )
    		local x, y, z = getElementPosition ( source )
    		local fireSound = playSound3D ( "files/fire.wav", x, y, z, true ) 
    		setSoundMaxDistance ( fireSound, 500 )
    		setSoundVolume ( fireSound, 1 )
    		attachElements ( fireSound, source, 0, 0, 0 )
    		setElementData ( localPlayer, "sound_fire", fireSound )
    	end
    )
     
    --stop sound
    function stop_fire_sound ( )
    	if isPedInVehicle ( localPlayer ) then
    		local theVehicle = getPedOccupiedVehicle ( localPlayer )
    		if ( theVehicle and getElementModel ( theVehicle ) == 476 ) then
    			triggerServerEvent ( "stop_fire_sound", localPlayer, theVehicle ) 
    		end
    	end
    end
    bindKey ( "lctrl", "up", stop_fire_sound )
     
    addEvent( "return_stop_fire_sound", true )
    addEventHandler( "return_stop_fire_sound", root,
    	function ( )
    		local x, y, z = getElementPosition ( source )	
    		local sound_fire_lastshot = playSound3D ( "files/fire_lastshot.wav", x, y, z, true )
    		setSoundMaxDistance ( sound_fire_lastshot, 500 )
    		setSoundVolume ( sound_fire_lastshot, 1 )
    		attachElements ( sound_fire_lastshot, veh, 0,0,0 )
    		local sound_fire = getElementData ( localPlayer, "sound_fire" )
    		if ( sound_fire ) then
    			stopSound ( sound_fire )
    			destroyElement ( sound_fire )
    		end
    	end
    )

     

    --Server side:

    addEvent ( "start_fire_sound", true )
    addEventHandler ( "start_fire_sound", root, 
    	function ( theVehicle )
    		triggerClientEvent ( "return_start_fire_sound", theVehicle )
    	end
    )
     
    addEvent ( "stop_fire_sound", true )
    addEventHandler ( "stop_fire_sound", root, 
    	function ( theVehicle )
    		triggerClientEvent ( "return_stop_fire_sound", theVehicle )
    	end
    )

     

  8. Whatever, I had answered your main topic's question,

    About your second question, you'll need to make some calculations using math to draw the first text in the top of the rectangle and in each message draw a new message under the first one using some logic calculations by getting the last height plus the new height ..etc

    And when your box becomes containing max lines make a scroll system.

  9. The default chatbox is already based on directX, But to make a custom one you'll need to disable the default one and start building a custom one, using dxDrawText and if needed dxDrawRectangle, Also you can use the event onClientChatMessage to output on your custom chatbox any when any text is output to the default chatbox of MTA.

    • Like 1
×
×
  • Create New...