Jump to content

Walid

Members
  • Posts

    1,491
  • Joined

  • Last visited

  • Days Won

    3

Posts posted by Walid

  1. function drawDxStuff(player)
        if player and isElement(player) then
            triggerClientEvent(player, "drawDxStuff", player)
        end 
    end

    Then use this server side

    exports.resourceName:drawDxStuff(player)

    And in the dx stuff part just added (onClientRender) event

  2. thePlayer is not defined here

    1 hour ago, PyTrO said:

    setPlayerNametagColor ( thePlayer, r , g , b )

    function lol(player)
       if exports.SAWGacl:isPlayerInGroup(player,"Admin") then
          local team = getTeamFromName("Admins")
          if team then 
             setPedSkin(player, 217)
             setPlayerTeam(player,team)
             setElementData(player,"class", "Admin")
             setElementHealth( player, 100 )
             setPlayerArmor( player, 100 )  
             local r, g, b = getTeamColor (team)
             setPlayerNametagColor (player, r , g , b )
          else
             exports.SAWGcommands:sendMessage("*Commands* You :Oing Moron You're not a sexy HQ Member to use this sexy command.",0,255,0,player)
          end 
       end
    end
    addCommandHandler("A", lol)

     

  3. local play = {}
    
    function pSound(key,keyState,s)
    	if play[s] then
    	    stopSound(play[s])
    	else
    		play[s] = playSound("Sirens/"..s..".wav")
    		setSoundVolume(play[s], 0.3)
        end
    end
    bindKey("num_1", "down", pSound,"Sound_003")
    bindKey("n", "down", pSound,"Sound_012")

     

  4. Sorry i can't edit my post, anyways you can use sth like this :

    function getBansTable()
        local bans =  getBans()
        local bansTable = {}
        for i=1, #bans do
            local admin = getBanAdmin(bans[i]) or "N/A"
            local ip = getBanIP(bans[i]) or "N/A"
            local nick = getBanNick(bans[i]) or "N/A"
            local serial = getBanSerial (bans[i]) or "N/A"
            local banTime = getBanTime (bans[i]) or "N/A"
            local reason = getBanReason (bans[i]) or "N/A"
            table.insert(bansTable,{admin,ip,nick,serial,banTime,reason})
        end 
        return bansTable
    end
    
    
    function setBans()
        local bans =  getBansTable()
        if bans then 
            triggerClientEvent(client,"setBans", client, bans)
        end
    end
    addEvent("outputBans", true)
    addEventHandler("outputBans", resourceRoot, setBans)

     

  5. Try this

    -- Server side
    function setBans()
        local bans =  getBans()
        triggerClientEvent(client,"setBans", client, bans)
    end
    addEvent("outputBans", true)
    addEventHandler("outputBans", resourceRoot, setBans)
    
    -- Client side
    function setBans(bans)
        if bans then 
            for k, v in ipairs(bans) do
                local row = guiGridListAddRow (stfgrd5)
                local serial = tostring(v.serial) or "N/A"
                local duration = tostring(v.time) or "N/A"
                local ip = tostring(getBanIP(v)) or "N/A"
                local nick = tostring(getBanNick(v)) or "N/A"
                local admin = tostring(getBanAdmin(v)) or "N/A"
                guiGridListSetItemText (stfgrd5, row, 1, serial, false, false)
                guiGridListSetItemText (stfgrd5, row, 2, duration, false, false)
                guiGridListSetItemText (stfgrd5, row, 3, ip, false, false)
                guiGridListSetItemText (stfgrd5, row, 4, name, true, false)
                guiGridListSetItemText (stfgrd5, row, 5, admin, true, false)
            end 
        end
    end
    addEvent("setBans", true)
    addEventHandler("setBans", root, setBans)
    
    
    function outputBans()
        if (source == stfgrd5) then
            triggerServerEvent("outputBans", resourceRoot)
        end
    end
    addEventHandler("onClientGUIClick", root, outputBans)

     

  6. On 04/11/2016 at 5:25 PM, Lally said:

    Is very good! But now the problem is that I bind the j to start the car and gender has no effect if it is broken or not. And if you mess and fix it no longer hurt.

     

     

    3 minutes ago, Lally said:

    @Walid Can you help me? You're only helping me

    Try to do it by yourself then post your code here.

  7. Optimized the whole code for you, Fixed some bugs etc ... ( I think you need to release the next version :P)

    • Client side
    local beepTimer = {}
    local vehiclesBeep = {
        [485] = true,[431] = true,[437] = true,[574] = true,[525] = true,[408] = true,[552] = true,[416] = true,[433] = true,[427] = true,[407] = true,[544] = true,[428] = true,[499] = true,[609] = true,
        [498] = true,[524] = true,[532] = true,[578] = true,[486] = true,[406] = true,[573] = true,[455] = true,[588] = true,[403] = true,[423] = true,[414] = true,[443] = true,[515] = true,[514] = true,
        [456] = true
    }
    
    function TruckReverseSound(position)
        local x,y,z = unpack(fromJSON(position))
        local sfx = playSound3D("sfx/SFX_REVERSE_BEEP_2.mp3", x, y, z, false) 
        setSoundMaxDistance( sfx, 30 )
    end
    addEvent ( "doReverseBeep", true )
    addEventHandler ( "doReverseBeep", root, TruckReverseSound )
    
    function detectDirection ()
        local theVehicle = getPedOccupiedVehicle (localPlayer)
        if theVehicle then
            local matrix = getElementMatrix ( theVehicle )
            local velocity = Vector3(getElementVelocity(theVehicle))
            local DirectionVector = (velocity.x * matrix[2][1]) + (velocity.y * matrix[2][2]) + (velocity.z * matrix[2][3]) 
            if (DirectionVector < 0) then
                triggerServerEvent ( "onReverseBeep", resourceRoot,theVehicle)
            end
        end 
    end
    
    
    function truckSound(thePlayer, seat)
        if thePlayer == localPlayer then
            if(seat == 0) then
                if eventName =="onClientVehicleEnter" then 
                    local model = getElementModel(source)
                    if vehiclesBeep[model] then
                        beepTimer[source] = setTimer ( detectDirection, 1000, 0 )
                    end
                elseif eventName =="onClientVehicleExit" then 
                    if isTimer(beepTimer[source]) then 
                        killTimer (beepTimer[source])
                        beepTimer[source] = nil
                    end
                end 
            end
        end
    end
    addEventHandler("onClientVehicleEnter", root,truckSound)
    addEventHandler("onClientVehicleExit",root,truckSound)
    • Server side
    function doBeepNextToPlayers (theVehicle)
        if theVehicle then 
            local vehicleX, vehicleY, vehicleZ = getElementPosition (theVehicle)
            local position = toJSON({vehicleX, vehicleY, vehicleZ})
            triggerClientEvent ( root, "doReverseBeep", root, position)
        end 
    end
    addEvent( "onReverseBeep", true )
    addEventHandler( "onReverseBeep", resourceRoot, doBeepNextToPlayers )

     

    • Like 1
×
×
  • Create New...