Zaloguj się by uzyskać pełen dostęp. Nie masz jeszcze konta? Założ je już teraz w kilka sekund.

Wysłany: 2014-03-28, 08:08


Rebeka

Szefostwo






Wiek: 31
Na forum: 4452 dni
Posty: 37
Nick w MP: Projekt

Piwa: 15

Respekt: 50

znajde jeszcze jaki? aktywny link do migaczy poniewa? nie potrafie zrobi? a na czym? chce si? wzorowa? i od razu popacze?

Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-03-28, 20:50


zuraw13







Wiek: 27
Na forum: 5074 dni
Posty: 95
Nick w MP: zuraw113

Piwa: 191

Respekt: 50

Masz, strona clienta:
local INDICATOR_SIZE 0.32                        
local INDICATOR_COLOR = { 25510010255 }    
local INDICATOR_FADE_MS 150                    
local INDICATOR_SWITCH_TIMES = { 300400 }        
local INDICATOR_AUTOSWITCH_OFF_THRESHOLD 62    



local root getRootElement()
local localPlayer getLocalPlayer()
local vehiclesWithIndicator = {}



INDICATOR_AUTOSWITCH_OFF_THRESHOLD INDICATOR_AUTOSWITCH_OFF_THRESHOLD 90


local function vectorLength vector )
    return math.sqrt vector[1]*vector[1] + vector[2]*vector[2] + vector[3]*vector[3] )
end


local function normalizeVector vector )
    local length vectorLength vector )
    if length 0 then
        local normalizedVector = {}
        normalizedVector[1] = vector[1] / length
        normalizedVector[2] = vector[2] / length
        normalizedVector[3] = vector[3] / length
        return normalizedVectorlength
    else
        return nillength
    end
end


local function crossProduct v)
    local result = {}
    result[1] = v[2]*w[3] - v[3]*w[2]
    result[2] = w[1]*v[3] - w[3]*v[1]
    result[3] = v[1]*w[2] - v[2]*w[1]
    return result
end


local function getFakeVelocity vehicle )
    
    local __angle getElementRotation vehicle )
    local velocity = { 00}
    velocity[1] = -math.sin angle )
    velocity[2] = math.cos angle )
    return velocity
end


local function createIndicator ()
    local xygetElementPosition(localPlayer)
    local indicator createMarker (     xyz+4'corona',
                                        INDICATOR_SIZE,
                                        INDICATOR_COLOR[1],
                                        INDICATOR_COLOR[2],
                                        INDICATOR_COLOR[3],
                                        0
                                    )
    setElementStreamable indicatorfalse )
    return indicator
end


local function createIndicatorState vehicleindicatorLeftindicatorRight )
    local t = { vehicle          vehicle,        
                left           indicatorLeft,    
                right           indicatorRight,
                coronaLeft      nil,            
                coronaRight      nil,            
                nextChange      0,                
                timeElapsed   0,                
                currentState  false,            
                activationDir nil,            
              }
    return t
end


local function updateIndicatorState state )
    if not state then return end

    
    local numberOfIndicators 0
    

    local xminyminzminxmaxymaxzmax getElementBoundingBox state.vehicle )


    xmin xmin 0.2
    xmax xmax 0.2
    ymin ymin 0.2
    ymax ymax 0.2
    zmin zmin 0.6


    if state.left then
        if not state.coronaLeft then
            state.coronaLeft = { createIndicator (), createIndicator () }
            attachElements state.coronaLeft[1], state.vehiclexmin,  ymaxzmin )
            attachElements state.coronaLeft[2], state.vehiclexmin, -ymaxzmin )
        end
        numberOfIndicators numberOfIndicators 1
    elseif state.coronaLeft then
        destroyElement state.coronaLeft[1] )
        destroyElement state.coronaLeft[2] )
        state.coronaLeft nil
    end
    

    if state.right then
        if not state.coronaRight then
            state.coronaRight = { createIndicator (), createIndicator () }
            attachElements state.coronaRight[1], state.vehicle, -xmin,  ymaxzmin )
            attachElements state.coronaRight[2], state.vehicle, -xmin, -ymaxzmin )
        end
        numberOfIndicators numberOfIndicators 1
    elseif state.coronaRight then
        destroyElement state.coronaRight[1] )
        destroyElement state.coronaRight[2] )
        state.coronaRight nil
    end
    

    if numberOfIndicators == and getVehicleOccupant state.vehicle) == localPlayer then
        
        state.activationDir normalizeVector ( { getElementVelocity state.vehicle ) } )
        if not state.activationDir then
            
            state.activationDir getFakeVelocity state.vehicle )
        end
    else
        state.activationDir nil
    end
end


local function destroyIndicatorState state )
    if not state then return end
    
    
    if state.coronaLeft then
        destroyElement state.coronaLeft[1] )
        destroyElement state.coronaLeft[2] )
        state.coronaLeft nil
    end
    
    
    if state.coronaRight then
        destroyElement state.coronaRight[1] )
        destroyElement state.coronaRight[2] )
        state.coronaRight nil
    end
    

    if getVehicleOccupant state.vehicle ) == localPlayer then
        setElementData state.vehicle'i:left'falsetrue )
        setElementData state.vehicle'i:right'falsetrue )
    end
end


local function performIndicatorChecks vehicle )
    
    local indicatorLeft getElementData(vehicle'i:left')
    local indicatorRight getElementData(vehicle'i:right')

    
    local anyIndicator indicatorLeft or indicatorRight
    

    local currentState vehiclesWithIndicator vehicle ]

    
    if anyIndicator then
        
        if currentState then
        
            currentState.left indicatorLeft
            currentState.right indicatorRight
        else
        
            currentState createIndicatorState vehicleindicatorLeftindicatorRight )
            vehiclesWithIndicator vehicle ] = currentState
        end
        updateIndicatorState currentState )
    elseif currentState then
        
        destroyIndicatorState currentState )
        vehiclesWithIndicator vehicle ] = nil
    end
end


local function setIndicatorsAlpha statealpha )
    if state.coronaLeft then
        setMarkerColor state.coronaLeft[1],    INDICATOR_COLOR[1],
                                                INDICATOR_COLOR[2],
                                                INDICATOR_COLOR[3],
                                                alpha )
        setMarkerColor state.coronaLeft[2],    INDICATOR_COLOR[1],
                                                INDICATOR_COLOR[2],
                                                INDICATOR_COLOR[3],
                                                alpha )
    end
    if state.coronaRight then
        setMarkerColor state.coronaRight[1],    INDICATOR_COLOR[1],
                                                INDICATOR_COLOR[2],
                                                INDICATOR_COLOR[3],
                                                alpha )
        setMarkerColor state.coronaRight[2],    INDICATOR_COLOR[1],
                                                INDICATOR_COLOR[2],
                                                INDICATOR_COLOR[3],
                                                alpha )
    end
end


local function processIndicators state )
    
    if getElementHealth state.vehicle ) == 0 then
    
        destroyIndicatorState state )
        vehiclesWithIndicator state.vehicle ] = nil
        return
    end
    

    if state.activationDir then
        
        local currentVelocity normalizeVector ( { getElementVelocity state.vehicle ) } )
        
    
        if not currentVelocity then
            currentVelocity getFakeVelocity state.vehicle )
        end
        
        
        local cross crossProduct state.activationDircurrentVelocity )
            
    
        local length vectorLength cross )
            

        if length INDICATOR_AUTOSWITCH_OFF_THRESHOLD then
    
            destroyIndicatorState state )
            vehiclesWithIndicator state.vehicle ] = nil
            return
        end
    end


    if state.nextChange <= state.timeElapsed then
        
        setIndicatorsAlpha stateINDICATOR_COLOR[4] )
        
        
        state.currentState not state.currentState
    
        
        local playerVehicle getPedOccupiedVehicle localPlayer )
        

        state.timeElapsed 0
        if state.currentState then
            state.nextChange INDICATOR_SWITCH_TIMES[1]
            
        else
            state.nextChange INDICATOR_SWITCH_TIMES[2]
            
        end
        

    
    elseif state.currentState == false then
        
        if state.timeElapsed >= INDICATOR_FADE_MS then
            setIndicatorsAlpha state)
        else
            setIndicatorsAlpha state, (- (state.timeElapsed INDICATOR_FADE_MS)) * INDICATOR_COLOR[4] )
        end
    end
end


addEventHandler('onClientElementDataChange'root, function ( dataNameoldValue )
    
    if getElementType(source) == 'vehicle' and ( dataName == 'i:left' or dataName == 'i:right' then
        
        if isElementStreamedIn(sourcethen
            
            performIndicatorChecks source )
        end
    end
end)


addEventHandler('onClientElementStreamIn'root, function ()
    if getElementType(source) == 'vehicle' then
        
        performIndicatorChecks source )
    end
end)


addEventHandler('onClientElementStreamOut'root, function ()
    if getElementType(source) == 'vehicle' then

        local currentState vehiclesWithIndicator source ]
        
        
        if currentState then
            destroyIndicatorState currentState )
            vehiclesWithIndicator source ] = nil
        end
    end
end)


local function switchIndicatorState indicator )
    
    local v getPedOccupiedVehicle(localPlayer)
    if v then
        
        if getVehicleType(v) == "Automobile" or getVehicleType(v) == "Bike" or getVehicleType(v) == "Quad" then
            
            if getVehicleOccupant(v0) == localPlayer then
                
                local dataName 'i:' .. indicator
                local currentValue getElementData(vdataName) or false
                
                setElementData(vdataNamenot currentValuetrue)
            end
        end
    end
end
addCommandHandler('indicator_left', function () switchIndicatorState('left'endfalse)
addCommandHandler('indicator_right', function () switchIndicatorState('right'endfalse)


addEventHandler('onClientPreRender'root, function ( timeSlice )
    
    for vehiclestate in pairs(vehiclesWithIndicator) do
        state.timeElapsed state.timeElapsed timeSlice
        processIndicators statestate.lastChange )
    end
end)

function handleKeyBindkeyPressedkeyState )
    if (keyPressed == "["then
        switchIndicatorState('left')
    elseif (keyPressed == "]"then
        switchIndicatorState('right')
    end
end

addEventHandler('onClientResourceStart'getResourceRootElement(getThisResource()), function ()

    local vehicles getElementsByType 'vehicle' )
    for kvehicle in ipairs(vehicles) do
        if isElementStreamedIn vehicle then
            local indicatorLeft getElementData vehicle'i:left' )
            local indicatorRight getElementData vehicle'i:right' )
            if indicatorLeft or indicatorRight then
                performIndicatorChecks vehicle )
            end
        end
    end
     
    bindKey "[""down"handleKeyBind )
    bindKey "]""down"handleKeyBind )
endfalse)


addEventHandler('onClientVehicleRespawn'root, function ()
    if isElementStreamedIn source then
        performIndicatorChecks source )
    end
end)


addEventHandler('onClientElementDestroy'root, function ()
    if getElementType source ) == 'vehicle' then
        local currentState vehiclesWithIndicator source ]
        if currentState then
            
            destroyIndicatorState currentState )
            vehiclesWithIndicator source ] = nil
        end
    end
end)


Podpis
Moje skrypty i mapy:
-Baza by Zuraw [SAMP]
-RC Vehicles enter by Zuraw [SAMP]
-Neony by zuraw [SAMP]
Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-03-29, 02:31


Rebeka

Szefostwo






Wiek: 31
Na forum: 4452 dni
Posty: 37
Nick w MP: Projekt

Piwa: 15

Respekt: 50

dzi?kuje za strone Client a jak zrobi? Server?

Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-05-17, 14:45


zuraw13







Wiek: 27
Na forum: 5074 dni
Posty: 95
Nick w MP: zuraw113

Piwa: 191

Respekt: 50

Skrypt jest tylko po stronie clienta.

Plik meta:
Cytat:

<meta>
<script src="kierunkowskazy_c.lua" type="client" />
</meta>


Podpis
Moje skrypty i mapy:
-Baza by Zuraw [SAMP]
-RC Vehicles enter by Zuraw [SAMP]
-Neony by zuraw [SAMP]
Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-05-18, 12:20


luki123luki123

Place Game






Wiek: 28
Na forum: 5275 dni
Posty: 1948
Nick w MP: LuKiO

Piwa: 6101

Respekt: 611
Respekt: 611Respekt: 611

zuraw13, jak gracz w??czy migacza to 2 gracz nie b?dzie go widzia? ;D

Postaw piwo autorowi tego posta
 

 
Tagi: migacze
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






Skocz do:  
Wyświetl posty z ostatnich:   
GTAONLINE.PL » JĘZYKI PROGRAMOWANIA » LUA » Migacze Ten temat jest zablokowany bez możliwości zmiany postów lub pisania odpowiedzi

Nie możesz pisać nowych tematów
Nie możesz odpowiadać w tematach
Nie możesz zmieniać swoich postów
Nie możesz usuwać swoich postów
Nie możesz głosować w ankietach
Dodaj temat do Ulubionych
Wersja do druku