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

Wysłany: 2012-08-29, 19:47


luki123luki123

Place Game






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

Piwa: 6101

Respekt: 611
Respekt: 611Respekt: 611

Witam dzi? chce si? zapyta? jak zrobi? ma?a blokad? np. na team lub acl do tego skryptu

serwer


function onCreateStinger(xyzrxryrz)
    stinger createObject(2899xyz+0.1rxryrz)
    setElementData(stinger"isStinger"true)
    triggerClientEvent"onCreateStinger"getRootElement(), xyz)
    stingerPlant(source)
end
addEvent"onCreateStinger"true )
addEventHandler"onCreateStinger"getRootElement(), onCreateStinger)

function stingerPlant(player)
    setPedAnimation(player"BOMBER""BOM_plant"3000falsefalsefalse)
    setTimer(setPedAnimation20001player)
end


klient

function getPointFrontOfElement(element,distance)
    local xygetElementPosition element )
    local rxryrz getElementRotation element )
    + (distance * (math.sin(math.rad(-rz))) )
    + (distance * (math.cos(math.rad(-rz))) )
    return x,y,z
end

function getPositionFromElementAtOffset(element,x,y,z)
    if not x or not y or not z then      
        return xyz   
    end        
    local matrix getElementMatrix element )
    local offX matrix[1][1] + matrix[2][1] + matrix[3][1] + matrix[4][1]
    local offY matrix[1][2] + matrix[2][2] + matrix[3][2] + matrix[4][2]
    local offZ matrix[1][3] + matrix[2][3] + matrix[3][3] + matrix[4][3]
    return offXoffYoffZ
end

function getVehicleWheelPosition(vehicle,wheel)
    local xy000
    local minXminYminZmaxXmaxYmaxZ getElementBoundingBox(vehicle)
    if wheel == 1 then
        xygetPositionFromElementAtOffset(vehicleminXmaxYminZ)
    elseif wheel == 2 then
        xygetPositionFromElementAtOffset(vehicleminX, -maxYminZ)        
    elseif wheel == 3 then
        xygetPositionFromElementAtOffset(vehiclemaxXmaxYminZ)
    elseif wheel == 4 then
        xygetPositionFromElementAtOffset(vehiclemaxX, -maxYminZ)
    end     
    return xyz
end

function team ()
 if getPlayerTeam(getLocalPlayer() == getTeamFromName("Policja")) then
end
end

function plantStingerCommand()
    local xygetPointFrontOfElement(getLocalPlayer(),3) 
    local rxry ,rz getElementRotation(getLocalPlayer())
    getGroundPosition(xyz)
    triggerServerEvent "onCreateStinger"getLocalPlayer(), xyzrxry ,rz)
end
bindKey"x""down"plantStingerCommand )

function onClientRender()
    if isPedInVehicle(getLocalPlayer()) then    
         vehicle getPedOccupiedVehicle(getLocalPlayer())

        g_Stingers getElementsByType("object")
        
        --local wx0wy0wz0 getVehicleWheelPosition(vehicle,0)
        local wx1wy1wz1 getVehicleWheelPosition(vehicle,1)
        local wx2wy2wz2 getVehicleWheelPosition(vehicle,2)
        local wx3wy3wz3 getVehicleWheelPosition(vehicle,3)
        local wx4wy4wz4 getVehicleWheelPosition(vehicle,4)
        
        -- for visual debug wheel positions
        --dxDrawLine3D(wx1wy1wz1wx2wy2wz2tocolor(0,255,0))
        --dxDrawLine3D(wx3wy3wz3wx4wy4wz4tocolor(0,255,0))
        
        for kv in ipairs(g_Stingers) do
            if getElementData(v,"isStinger") == true then
                local vxvyvz getElementPosition(v)
                if getDistanceBetweenPoints3D(wx1wy1wz1vxvyvz) <= 2.0 then
                    setVehicleWheelStates(vehicle1, -1, -1, -1)    
                end
                if getDistanceBetweenPoints3D(wx2wy2wz2vxvyvz) <= 2.0 then
                    setVehicleWheelStates(vehicle, -11, -1, -1)    
                end
                if getDistanceBetweenPoints3D(wx3wy3wz3vxvyvz) <= 2.0 then
                    setVehicleWheelStates(vehicle, -1, -11, -1)    
                end
                if getDistanceBetweenPoints3D(wx4wy4wz4vxvyvz) <= 2.0 then
                    setVehicleWheelStates(vehicle, -1, -1, -11)    
                end        
            end                                        
        end
     end
end
addEventHandler("onClientRender",getRootElement(), onClientRender)

function onCreateStinger (xyz)
       if(getDistanceBetweenPoints3D(xyzgetElementPosition(getLocalPlayer())) <= 10 then
       local sound playSound3D("plant.wav"xyz)
       setSoundMaxDistance(sound10)
end
end
addEvent("onCreateStinger"true)
addEventHandler("onCreateStinger"getRootElement(), onCreateStinger)




Wiem ?e jest z neta ale potrzebuje tego skryptu do mojego rpg

Postaw piwo autorowi tego posta
 

 
Wysłany: 2012-08-29, 21:03


Riot

3X






Wiek: 29
Na forum: 5729 dni
Posty: 1123
Nick w MP: Riot/3X

Piwa: 286

Respekt: 123
Respekt: 123

Czy m?g?by? ?askawie napisa? to jeszcze raz, tylko po POLSKU by?my zrozumieli? ;)

Postaw piwo autorowi tego posta
 

 
Wysłany: 2012-08-29, 21:14


luki123luki123

Place Game






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

Piwa: 6101

Respekt: 611
Respekt: 611Respekt: 611

?eby np gracz nie m?g? podstawi? blokady tylko policja

Postaw piwo autorowi tego posta
 

 
Wysłany: 2012-08-29, 21:23


Riot

3X






Wiek: 29
Na forum: 5729 dni
Posty: 1123
Nick w MP: Riot/3X

Piwa: 286

Respekt: 123
Respekt: 123

if getPlayerTeam(source) == getTeamFromName("Nazwa_Teamu"then


Postaw piwo autorowi tego posta
 

 
Wysłany: 2012-08-29, 21:29


luki123luki123

Place Game






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

Piwa: 6101

Respekt: 611
Respekt: 611Respekt: 611

Ziomek11, wiem ale nie dzia?a


function team ()
 if getPlayerTeam(getLocalPlayer) == getTeamFromName("Policja")) then
end
end


Postaw piwo autorowi tego posta
 

 
Wysłany: 2012-08-29, 21:31


Riot

3X






Wiek: 29
Na forum: 5729 dni
Posty: 1123
Nick w MP: Riot/3X

Piwa: 286

Respekt: 123
Respekt: 123

Ale dajesz to po stronie clietna? Bo getLocalPlayer() mo?esz dawa? tylko po stronie clienta.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2012-08-29, 21:52


luki123luki123

Place Game






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

Piwa: 6101

Respekt: 611
Respekt: 611Respekt: 611

no clinet

[ Dodano: 2012-08-29, 22:02 ]
ok zrobi?em dzi?a bez czatbox ale jak zrobi? z nim



function plantStingerCommand()
    if getPlayerTeamgetLocalPlayer() ) == getTeamFromName("Policja"then
    else outputChatBox("Nie Jeste? policjantem"source)
    local xygetPointFrontOfElement(getLocalPlayer(),3) 
    local rxry ,rz getElementRotation(getLocalPlayer())
    getGroundPosition(xyz)
    triggerServerEvent "onCreateStinger"getLocalPlayer(), xyzrxry ,rz)
end
end
bindKey"x""down"plantStingerCommand )


[ Dodano: 2012-08-29, 22:14 ]
ok dzia?a teraz tylko jak jeste? w policji to ci te? pisz?


function plantStingerCommand()
    outputChatBox("Nie Jeste? policjantem",getLocalPlayer() )
    if getPlayerTeamgetLocalPlayer() ) == getTeamFromName("Policja"then
    local xygetPointFrontOfElement(getLocalPlayer(),3) 
    local rxry ,rz getElementRotation(getLocalPlayer())
    getGroundPosition(xyz)
    triggerServerEvent "onCreateStinger"getLocalPlayer(), xyzrxry ,rz)
end
end
bindKey"x""down"plantStingerCommand )


Postaw piwo autorowi tego posta
 

 
Wysłany: 2012-08-29, 23:15


Piorun







Wiek: 32
Na forum: 6712 dni
Posty: 1837
Nick w MP: Piorun

Piwa: 516

Respekt: 480,7
Respekt: 480,7

Nie tw?j skrypt + nie potrafisz tworzy? warunk?w. Stworzy?e? warunek, a przed nim utworzy?e? funkcj?, kt?ra ma si? po nim wykona? .. gdzie tu logika?
Najpierw warunek, lub warunki
if .. and .. and .. and .. then

potem dajesz funkcje lub zatwierdzasz zmienne..
outputChatBox(...)
local x = ...

... i zamykasz
end


Kompletnie nie znasz podstaw.

Podpis
Możesz mnie znaleźć na: Facebook
Postaw piwo autorowi tego posta
 

 
Wysłany: 2012-08-30, 10:28


luki123luki123

Place Game






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

Piwa: 6101

Respekt: 611
Respekt: 611Respekt: 611

ok ju? jest git http://wiki.multitheftauto.com/ znalaz?em rozwi?zanie problemu dzi?ki Piorun, Ziomek11, piwka dla was

[ Dodano: 2012-08-30, 10:28 ]
CLOSE

Postaw piwo autorowi tego posta
 

 
Tagi: kolczatka
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






Skocz do:  
Wyświetl posty z ostatnich:   
GTAONLINE.PL » JĘZYKI PROGRAMOWANIA » LUA 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