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

Wysłany: 2016-11-04, 21:50


P.Wiśnia

Programista LUA






Wiek: 24
Na forum: 4044 dni
Posty: 568
Nick w MP: P.Wiśnia

Piwa: 376

Respekt: 100
Respekt: 100

jak zrobi?
zamiast
if isPlayerInTeam( getLocalPlayer(), "Policja" ) then
na
if getElementData(el, 'player:duty')=='SMSA' then

dodam ze jak zmieniam to nie dzia?a.

local resourceRoot getResourceRootElement(getThisResource())
local screenWidthscreenHeight guiGetScreenSize ()
vehicle=nil
najwyzsza=0
dop="n/a"
rejstrator=false
moznamierzyc=true
function seter()
moznamierzyc=true
tekst="Oczekuje na pomiar..."
end
function isPlayerInTeamthePlayerteamName )
    local pTeam getPlayerTeamthePlayer )
    if ( pTeam ) and ( fTeam then
        if ( pTeam == fTeam then
            return true 
        end
    end
end

addEventHandler("onClientResourceStart",resourceRoot,
function ()
    txd engineLoadTXD "files/tec9.txd" )
    engineImportTXD txd372  )
    dff engineLoadDFF "files/tec9.dff"372  )
    engineReplaceModel dff372  )
end)


function targetingActivated target )
local wep=getPedWeapon(getLocalPlayer())
    if wep==32 then
        if isPlayerInTeamgetLocalPlayer(), "Policja" then
        if getPedControlState getLocalPlayer(), "aim_weapon" )  then
            if isPedDucked getLocalPlayer() ) then
                sxsysz getElementVelocity getLocalPlayer() )
                if math.floor((sx^sy^sz^2)^(0.5)  * 180)<3 then
                    if target then
                        if getElementType(target)=="vehicle" then
                            if vehicle~=target then najwyzsza=0 end
                            vehicle=target
                            rejstrator=true
                        end
                    end
                end
            end
        end
        end
    end
end
addEventHandler "onClientPlayerTarget"getRootElement(), targetingActivated )


function najwyszapr()
if najwyzsza>0 then 
    mierzony=getVehicleController(vehicle)
    if mierzony then
    triggerServerEvent("onPokazChatMierzenie"getLocalPlayer(), "*Policjant zmierzy? ci pr?dko??: "..najwyzsza..""mierzony) 
        if (dop~="n/a") and (tonumber(dop))+10<najwyzsza then
        ileprzekroczyl=najwyzsza-dop
        kwota=(math.floor(ileprzekroczyl*10)/2)
        score=0
        triggerServerEvent("onWystawMandat_Suszarka"getLocalPlayer(), getElementData(mierzony,"ID-Player"),"Radar policyjny",getPlayerName(getLocalPlayer()),getElementData(getLocalPlayer(),"ID-Player") or 0,"Pr?dko?? "..najwyzsza.."/"..dop.."kmh",kwota,score)
        triggerServerEvent("onPokazChatMierzenie"getLocalPlayer(), "*Przekroczy?e? dopuszaln? pr?dko?? i otrzyma?e? mandat "..najwyzsza.."/"..dop.."kmh od ["..getPlayerName(getLocalPlayer()).."]"mierzony) 
        outputChatBox("Przekroczona pr?dko??: "..najwyzsza.."/"..dop.."kmh ["..getPlayerName(mierzony).."]")
        moznamierzyc=false
        tekst="Czekaj, Synchronizacja"
        setTimer(seter,4000,1)
        end
    outputChatBox("*Najwy?sza zarejstrowana pr?dko?? gracza ["..getPlayerName(mierzony).."]: "..najwyzsza)
    else
    outputChatBox("*Najwy?sza zarejstrowana pr?dko??: "..najwyzsza)
    end
    najwyzsza=0
    vehicle=nil
    rejstrator=false
end
end

function createText ( )
if getPedControlState getLocalPlayer(), "aim_weapon" ) and isPedDucked getLocalPlayer() )  then
sxsysz getElementVelocity getLocalPlayer() )
if math.floor((sx^sy^sz^2)^(0.5)  * 180)<1 then
if vehicle then
--if ( isElementOnScreen vehicle ) ) then
if getPedTarget(getLocalPlayer()) == vehicle then
speedxspeedyspeedz getElementVelocity vehicle )
actualspeed = (speedx^speedy^speedz^2)^(0.5predkosc math.floor(actualspeed 180)
if predkosc>najwyzsza then najwyzsza=predkosc end
dxDrawText predkosc.."km/h"screenWidth/2screenHeight/2screenWidth/2screenHeight/2tocolor 000255 ), 1.01"pricedown" )
dxDrawText predkosc.."km/h"screenWidth/2screenHeight/2screenWidth/2screenHeight/2tocolor 255255255255 ), 1"pricedown" end
end
end
else
if rejstrator then najwyszapr() end
end
end


local screenWscreenH guiGetScreenSize()

tekst="Oczekuje na pomiar..."

local screenWscreenH guiGetScreenSize()

    function render_pda()
        dxDrawImage(screenW 307, (screenH 236), 307236"files/pda.png"000tocolor(255255255255), false)
        dxDrawText(""11418671141867tocolor(255255255255), 1"default""left""top"falsefalsefalsefalsefalse)
        dxDrawText(najwyzsza.." / "..dop..""screenW 213 45, (screenH 30) -70, (screenW 213 45) + 213, ( (screenH 30) -70) + 30tocolor(000255), 1.3"default-bold""center""center"falsefalsefalsefalsefalse)
        dxDrawText("Najwy?sza pr?dko??[kmh]:"screenW 211 45, (screenH 19) -95, (screenW 211 45) + 211, ( (screenH 19) -95) + 19tocolor(000255), 1"default""left""top"falsefalsefalsefalsefalse)
        dxDrawText("Max dop. pr?dko??[kmh]: "..dopscreenW 211 45, (screenH 19) -160, (screenW 211 45) + 211, ( (screenH 19) -160) + 19tocolor(000255), 1"default""left""top"falsefalsefalsefalsefalse)
        dxDrawText("Stan urz?dzenia:"screenW 211 45, (screenH 19) -140, (screenW 211 45) + 211, ( (screenH 19) -140) + 19tocolor(000255), 1"default""left""top"falsefalsefalsefalsefalse)
        dxDrawText(tekstscreenW 211 45, (screenH 19) -120, (screenW 211 45) + 211, ( (screenH 19) -120) + 19tocolor(000255), 1.3"default-bold""center""center"falsefalsefalsefalsefalse)
        dxDrawText("Po??czenie: WiFI Radar Policja"screenW 285 10, (screenH 24) -200, (screenW 285 10) + 285, ( (screenH 24) -200) + 24tocolor(000255), 1"default-bold""center""center"falsefalsefalsefalsefalse)
    end

function HandleTheRendering ( )
local wep=getPedWeapon(getLocalPlayer())

    if wep==32 then
        if isPlayerInTeamgetLocalPlayer(), "Policja" then
        --dxDrawText("Radar: #FF0000"..dop.."#0011FFkm/h\n"..tekst, (screenW 516) / 273, ((screenW 516) / 2) + 516, ( 73) + 73tocolor(017255255), 2"bankgothic""center""center"falsefalsetruetruefalse)
        render_pda()
        end
            if getPedControlState getLocalPlayer(), "aim_weapon" )  then
                if not isPedDucked getLocalPlayer() ) then
                setControlState("aim_weapon",false)
                outputChatBox("Aby mierzy? predkosc musisz kuca?",255,0,0)
                end
                if not moznamierzyc then
                setControlState("aim_weapon",false)
                outputChatBox("Odczekaj 2 sekundy od ostatniego mierzenia",255,0,0)            
                end
                if not isPlayerInTeamgetLocalPlayer(), "Policja" then
                outputChatBox("Radar dost?pny tylko dla pracownik?w Policji!",255,0,0)
                setControlState("aim_weapon",false)
                end
            end    
    end

end



function disableTec prevSlotnewSlot )
    if getPedWeapon(getLocalPlayer(),newSlot) == 32 then
        toggleControl "fire"false )
        toggleControl "playerlist"false )
        toggleControl "action"false )
         
        addEventHandler "onClientRender"rootHandleTheRendering )
        addEventHandler "onClientRender"rootcreateText )
        else
        toggleControl "fire"true ) 
        toggleControl "playerlist"true ) 
        toggleControl "action"true ) 
        removeEventHandler "onClientRender"rootHandleTheRendering )
        removeEventHandler "onClientRender"rootcreateText )
    end
end
addEventHandler "onClientPlayerWeaponSwitch"getRootElement(), disableTec )



function setDopPredkosc(cmd,ile)
if tonumber(ile)>49 and tonumber(ile)<=300 then
dop=math.floor(tonumber(ile))
else
outputChatBox("Ustaw poprawn? warto??!",255,0,0)
end
end
addCommandHandler("predkosc",setDopPredkosc)


Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-11-04, 22:36


zabijaka2000







Wiek: 26
Na forum: 4983 dni
Posty: 147
Nick w MP: aleks556

Piwa: 13

Respekt: 80

Ostrzeżeń: 20%
Wi?c tak, sprawd? czy nada?e? dat? elementowi. Je?li tak to u?yj przy getElementData funkcji tostring(), my?l?, ?e powinno dzia?a?.

Podpis
San Fierro Stories Roleplay
Postaw piwo autorowi tego posta
 

 
Tagi: jak :: zrobić :: wykrywanie :: frakcji
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