Jump to content

[HELP!] Peds!


.:HyPeX:.

Recommended Posts

well i cant spawn them, not even setting them streamable or anything.

  
  
PedTDM = createPed(0,502.93051147461, -10.852199554443,1000.6799926758,126.002746) 
setElementInterior(PedTDM, 17) 
setElementStreamable(PedTDM, false) 
setElementPosition(PedTDM,502.93051147461, -10.852199554443,1000.6799926758) 
setElementData(PedTDM, "text","Team Deathmatch") 
setPedAnimation(PedTDM, "DANCING","dnce_M_a", 1000, true,false) 
PedM = createPed(0,481.27551269531, -19.967199325562,1000.6799926758,355.002746) 
setElementStreamable(PedTDM, false) 
setPedAnimation(PedM, "DANCING","dnce_M_a", 1000, true,false) 
setElementInterior(PedM, 17) 
setElementData(PedM, "text", "Missions | Co-Op") 
setElementPosition(PedM, 481.27551269531, -19.967199325562,1000.6799926758) 
  

Link to comment

The peds come about line 280

EDIT: They exist (@IIYAMA)

EDIT2: Fixed it by frozing them, Peds were just falling off the objects b4 they were loaded.

  
local startx = 487.60119628906
local starty = -3.6586000919342
local startz = 1000
local screenStartX = guiGetScreenSize()
local SPECWIDTH = screenStartX
local screenStartX = screenStartX * 0
local SPECHEIGHT = (SPECWIDTH / 16) * 7
local screenStartY = SPECHEIGHT / 2
local BANDS = 40
local use_dx = true
object = createObject(16000, 487.60119628906,-3.6586000919342,1000.7130126953, 0,0,180)
setElementInterior(object, 17, 487.60119628906,-3.6586000919342,1000.7130126953)
setObjectScale(object, 0.3)
setElementCollidableWith(getLocalPlayer(), object, false)
object1 = createObject(8838, 484.20709228516,-3.1703000068665,1001.5739746094,0,270,0)
object2 = createObject(8838,484.41659545898,-3.3726000785828,1001.5739746094,0,270,90)
object3 = createObject(8838,490.80099487305,-3.373899936676,1001.5739746094, 0,270,90)
object4 = createObject(8838,490.99771118164,-3.1575000286102,1001.5739746094,0,270,180)
setElementCollidableWith(getLocalPlayer(), object1, false)
setElementCollidableWith(getLocalPlayer(), object2, false)
setElementCollidableWith(getLocalPlayer(), object3, false)
setElementCollidableWith(getLocalPlayer(), object4, false)
setObjectScale(object1, 0.2)
setObjectScale(object2, 0.2)
setObjectScale(object3, 0.2)
setObjectScale(object4, 0.2)
setElementInterior(object1, 17)
setElementInterior(object2, 17)
setElementInterior(object3, 17)
setElementInterior(object4, 17)
timer = setTimer(function()
setTime(1,0)
setWeather(63)
end, 5000,0)
 
 
local peakData, ticks, maxbpm, startTime, release, peak, peaks
function reset ( )
    peaks = {}
    for k=0, BANDS - 1 do
        peaks[k] = {}
    end
    peakData = {}
    ticks = getTickCount()
    maxbpm = 1
    bpmcount = 1
    startTime = 0
    release = { }
    peak = 0
end
function changeMeta(stream)
if tags then
tags.stream_title = stream
end
end
addEventHandler("onClientSoundChangedMeta", getRootElement(), changeMeta)
 
timerSound = setTimer(function()
Lobby = getTeamFromName("#006677 - Lobby | Welcome - ")
if getPlayerTeam(getLocalPlayer()) ~= Lobby then
setSoundVolume(stream, 0)
else
setSoundVolume(stream, 1)
end
end, 1000, 0)
addEventHandler("onClientResourceStart", root, function ()
    if ( stream ) then
        destroyElement(stream)
    end
 
        -- Deal with sound
                setRadioChannel(0)
        stream = playSound3D("http://pub5.di.fm:80/di_chilloutdreams",startx, starty, startz, true)
        setSoundVolume(stream, 1)
        setSoundMinDistance(stream, 1)
    setSoundMaxDistance(stream, 10000)
    startTicks = getTickCount()
    ticks = getTickCount()
    reset ( )
    -- Deal with shaders
 
    -- Create shader
    shader_cinema, tec = dxCreateShader ( "texreptransform.fx" )
    if not shader_cinema then return end
    -- If the image is too bright, you can darken it
    -- If the image is too bright, you can darken it
    dxSetShaderValue ( shader_cinema, "gBrighten", -0.25 )
    -- Set the angle, grayscaled, rgb
    local radian=math.rad(0)
    dxSetShaderValue ( shader_cinema, "gRotAngle", radian )
    dxSetShaderValue ( shader_cinema, "gGrayScale", 0 )
    dxSetShaderValue ( shader_cinema, "gRedColor", 0 )
    dxSetShaderValue ( shader_cinema, "gGrnColor", 0 )
    dxSetShaderValue ( shader_cinema, "gBluColor", 0 )
    -- Set image alpha (1 max)
    dxSetShaderValue ( shader_cinema, "gAlpha", 1 )
    -- Set scrolling (san set negative and positive values)
    dxSetShaderValue ( shader_cinema, "gScrRig",  0)
        dxSetShaderValue ( shader_cinema, "gScrDow", 0)
    -- Scale and offset (don't need to change that)
        dxSetShaderValue ( shader_cinema, "gHScale", 1 )
    dxSetShaderValue ( shader_cinema, "gVScale", 1 )
    dxSetShaderValue ( shader_cinema, "gHOffset", 0 )
    dxSetShaderValue ( shader_cinema, "gVOffset", 0 )
    if not shader_cinema then
        outputChatBox( "Could not create shader. Please use debugscript 3" )
        return
    else
                -- new render target slightly bigger
        tar = dxCreateRenderTarget ( SPECWIDTH, SPECHEIGHT )
        -- reduce our width
        SPECWIDTH = SPECWIDTH - 6
        -- Apply our shader to the drvin_screen texture
        engineApplyShaderToWorldTexture ( shader_cinema, "drvin_screen" )
    end
    addEventHandler("onClientRender", root, function ( )
                -- Get 2048 / 2 samples and return BANDS bars ( still needs scaling up )
        local fftData = getSoundFFTData(stream, 2048, BANDS)
        -- get our screen size
        local w, h = guiGetScreenSize()
        -- if fftData is false it hasn't loaded
        if ( fftData == false ) then
            dxDrawText("Stream not loaded yet.", w-300, h-150)
            return
        end
        -- Draw a nice now playing thingy
        local myx, myy = guiGetScreenSize()
        local len = string.len("You are in the Lobby, feel free to relax or join the fight")
        dxDrawText("You are in the Lobby, feel free to relax or join the fight.", w-(270+(len*4)), h-150,myx,myy,tocolor(0,104,255,255), 1.5, "default-bold")
        -- Calculate our bars by the fft data
        calc ( fftData, stream )
    end)
       
end)
-- Util stuff
function timetostring ( input, input2 )
    local minutes = input / 60
    local seconds = input % 60
    local minutes2 = input2 / 60
    local seconds2 = input2 % 60
    return string.format("%2.2i:%2.2i", minutes2, seconds2)
end
function avg ( num )
    return maxbpm / bpmcount
end
function avg2 ( num1, num2, num )
    return (num1+num2)/num
end
function round(num, idp)
  return tonumber(string.format("%." .. (idp or 0) .. "f", num))
end
function getAverageBPM ( )
    return maxbpm / bpmcount
end
function min ( num1, num2 )
    return num1 <= num2 and num1 or num2
end
function max ( num1, num2 )
    return num1 >= num2 and num1 or num2
end
function calc ( fft, stream )
    -- Render to a render target and clear it
    dxSetRenderTarget( tar, true )
 
    -- Set a random seed
    math.randomseed ( getTickCount ( ) )
    -- Get our "Average" bpm
    local bpm = getSoundBPM ( stream )
 
    if ( bpm == false or bpm == nil or bpm == 0  ) then
        bpm = 1
    end
 
    local calced = {}
    local y = 0
    local bC=0
    local specbuf = 0
    local w, h = guiGetScreenSize()
 
    local r,g,b = 0,0,0
    local var = bpm + 37
 
    -- use bpm to determine r,g,b though there are better ways of doing this.
    if ( var <= 56 ) then
        r,g,b = 99, 184, 255
    end
    if ( var >= 57 and var < 83 ) then
        r,g,b = 238, 174, 238
    end
    if ( var >= 83 and var < 146 ) then
        r,g,b = 238, 174, 238
    end
 
    if ( var >= 146 and var < 166 ) then
        r,g,b = 99, 184, 255
    end
    if ( var > 166 and var <= 200 ) then
        r,g,b = 238, 201, 0
    end
 
    if ( var >= 200 ) then
        r,g,b = var, 0, 0
    end
 
    local tags = getSoundMetaTags(stream)
    local bSpawnParticles = true
    if ( bpm <= 1 and getSoundBPM ( stream ) == false and getSoundPosition ( stream ) <= 20 ) then
        r,g,b = 255, 255, 255
        dxDrawImage ( 0, 00, SPECWIDTH, SPECHEIGHT+100, "bg.png", 0, 0,0, tocolor(r, g, b, 255) )
        dxDrawText(string.format("Learning...", bpm), screenStartX+10, screenStartY-30, screenStartX+10, screenStartY-30, tocolor(255, 255, 255, 255 ), 1.5, "arial")
        bSpawnParticles = false
    else
        -- always make this bigger because when you tint it the image will look smaller.
        local var = 600
        local var2 = 400
        dxDrawImage ( -var2, -var, SPECWIDTH+(var2*2), SPECHEIGHT+(var*2)+100, "bg.png", 0, 0,0, tocolor(r, g, b, 255) )
    end
    local movespeed = (1 * (bpm / 180)) + 1
    local dir = bpm <= 100 and "down" or "up"
    local prevcalced = calced
        -- loop all the bands.
    for x, peak in ipairs(fft) do
        local posx = x - 1
        -- fft contains our precalculated data so just grab it.
        peak = fft [ x ]
        y=math.sqrt(peak)*3*(SPECHEIGHT-4); -- scale it (sqrt to make low values more visible)
 
        if (y > 200+SPECHEIGHT) then
            y=SPECHEIGHT+200
        end -- cap it
        calced[x] = y
 
        y = y - 1
        if ( y >= -1 ) then
            dxDrawRectangle((posx*(SPECWIDTH/BANDS))+10+screenStartX, screenStartY, 10, max((y+1)/4, 1), tocolor(r, g, b, 255 ))
        end
        if ( bSpawnParticles == true ) then
            for key = 0, 40 do
                if ( peaks[x][key] == nil ) then
                    if ( #peaks[x] <= 20 and prevcalced[x] <= calced[x] and ( release[x] == true or release[x] == nil ) and y > 1 ) then
                        local rnd = math.random(0, 0)
                        peaks[x][key] = {}
                        if ( dir == "up" ) then
                            peaks[x][key]["pos"] = screenStartY
                        else
                            peaks[x][key]["pos"] = screenStartY+((y+1)/4)
                        end
                        peaks[x][key]["posx"] = (posx*(SPECWIDTH/BANDS))+12+screenStartX+(2-key)
                        peaks[x][key]["alpha"] = 128
                        peaks[x][key]["dirx"] = 0
                        release
Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...