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

Wysłany: 2016-01-02, 14:40


pomaza







Wiek: 39
Na forum: 3982 dni
Posty: 79

Piwa: 2

Respekt: 50

Witam mam taka suszare :

Kod:
Kod:


local resourceRoot = getResourceRootElement(getThisResource())
local screenWidth, screenHeight = guiGetScreenSize ()
vehicle=nil
najwyzsza=0
dop="n/a"
rejstrator=false
moznamierzyc=true
function seter()
moznamierzyc=true
tekst="Oczekuje na pomiar..."
end
function isPlayerInTeam( thePlayer, teamName )
local pTeam = getPlayerTeam( thePlayer )
local fTeam = getTeamFromName( teamName )
if ( pTeam ) and ( fTeam ) then
if ( pTeam == fTeam ) then
return true
end
end
end

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


function targetingActivated ( target )
local wep=getPedWeapon(getLocalPlayer())
if wep==32 then
if isPlayerInTeam( getLocalPlayer(), "SAPD" ) then
if getPedControlState ( getLocalPlayer(), "aim_weapon" ) then
if isPedDucked ( getLocalPlayer() ) then
sx, sy, sz = getElementVelocity ( getLocalPlayer() )
if math.floor((sx^2 + sy^2 + 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
sx, sy, sz = getElementVelocity ( getLocalPlayer() )
if math.floor((sx^2 + sy^2 + sz^2)^(0.5) * 180)<1 then
if vehicle then
--if ( isElementOnScreen ( vehicle ) ) then
if getPedTarget(getLocalPlayer()) == vehicle then
speedx, speedy, speedz = getElementVelocity ( vehicle )
actualspeed = (speedx^2 + speedy^2 + speedz^2)^(0.5)
predkosc = math.floor(actualspeed * 180)
if predkosc>najwyzsza then najwyzsza=predkosc end
dxDrawText ( predkosc.."km/h", screenWidth/2, screenHeight/2, screenWidth/2, screenHeight/2, tocolor ( 0, 0, 0, 255 ), 1.01, "pricedown" )
dxDrawText ( predkosc.."km/h", screenWidth/2, screenHeight/2, screenWidth/2, screenHeight/2, tocolor ( 255, 255, 255, 255 ), 1, "pricedown" )
end
end
end
else
if rejstrator then najwyszapr() end
end
end


local screenW, screenH = guiGetScreenSize()

tekst="Oczekuje na pomiar..."

local screenW, screenH = guiGetScreenSize()

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

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

if wep==32 then
if isPlayerInTeam( getLocalPlayer(), "SAPD" ) then
--dxDrawText("Radar: #FF0000"..dop.."#0011FFkm/h\n"..tekst, (screenW - 516) / 2, 73, ((screenW - 516) / 2) + 516, ( 73) + 73, tocolor(0, 17, 255, 255), 2, "bankgothic", "center", "center", false, false, true, true, false)
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 isPlayerInTeam( getLocalPlayer(), "SAPD" ) then
outputChatBox("Radar dost?pny tylko dla pracownik?w Policji!",255,0,0)
setControlState("aim_weapon",false)
end
end
end

end



function disableTec ( prevSlot, newSlot )
if getPedWeapon(getLocalPlayer(),newSlot) == 32 then
toggleControl ( "fire", false )
toggleControl ( "playerlist", false )
toggleControl ( "action", false )

addEventHandler ( "onClientRender", root, HandleTheRendering )
addEventHandler ( "onClientRender", root, createText )
else
toggleControl ( "fire", true )
toggleControl ( "playerlist", true )
toggleControl ( "action", true )
removeEventHandler ( "onClientRender", root, HandleTheRendering )
removeEventHandler ( "onClientRender", root, createText )
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)


I bym chcialem przerobic j? na acl ale jak sie bawilem to wgl znikal panel suszarki itp wiec moze ktos z was by umial to zrobic ?
Za pomoc daje :piwo: :eye:

Lub chcoiasz jak zrobic zebym mugl na pare teamow dac suszare.

[ Dodano: 2016-01-02, 18:20 ]
Pomo?e ktos kiedys mi w tej jednej sprawie ?
Jak mowie nawet moze byc na pare team?w bo ja prubuje dodac
Kod:

if isPlayerInTeam( getLocalPlayer(), "SAPD", "SAPD1", "SAPD2" ) then

to niestety nie dziala dalej tylko odbiera SAPD.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-01-02, 20:29


#404







Wiek: 26
Na forum: 4771 dni
Posty: 1438

Piwa: 2512

Respekt: 833,5
Respekt: 833,5Respekt: 833,5

Ostrzeżeń: 60%

if isPlayerInTeamgetLocalPlayer(), getTeamFromName("SAPD")) or isPlayerInTeam(localPlayergetTeamFromName("SAPD1")) then



Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-01-02, 21:25


pomaza







Wiek: 39
Na forum: 3982 dni
Posty: 79

Piwa: 2

Respekt: 50

Zrobnilem to to tak :
Kod:

if not isPlayerInTeam( getLocalPlayer() ("SAPD")) or not isPlayerInTeam(localPlayer, ("SAPD1")) then
outputChatBox("Radar dost?pny tylko dla pracownik?w Policji!",255,0,0)
setControlState("aim_weapon",false)

Ale niestety wywala bl?d : attempt to cal global 'localPlayer' (a userdata value)
w pierwszej linijce tego co podalem.
Lecz wszystko dziala ale ja nie chcial bym miec tego bledu dlatego
zrobilem to tak :
Kod:

if not isPlayerInTeam( getLocalPlayer(), ("SAPD")) or not isPlayerInTeam(localPlayer, ("SAPD1")) then
(dodalem przecinek) to nie ma bledow ale nie da sie brac suszarki dla teamu spad i sapd1.
Wiec co z tym zrboic ?

Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-01-05, 16:19


Emm

***** ***






Wiek: 32
Na forum: 3880 dni
Posty: 3191
Nick w MP: Emm

Piwa: 6162

Respekt: 1580
Respekt: 1580Respekt: 1580


   Administrator: Admin ma zawsze rację | REGULAMIN FORUM | REKLAMA/VIP | .

if not isPlayerInTeamgetLocalPlayer(), "SAPD" ) or not isPlayerInTeam(getLocalPlayer(), ("SAPD1")) then 
outputChatBox("Radar dost?pny tylko dla pracownik?w Policji!"25500)
setControlState("aim_weapon"false)


Spr?buj, je?li nie zadzia?a podaj pe?ny komunikat b??du/db3.

Podpis

Użytkownik: 20.10.2015r
GTAO Member: 06.03.2016r
Support-Team: 20.01.2016r
Moderator: 30.03.2016r
Mod-Team: 08.10.2016r
Vice Admin: 04.05.2018r
Administrator: 03.05.2022r


! Koniecznie zapoznaj się z regulaminem forum.
Pamiętaj, aby zawsze go przestrzegać, nie mniej ważne są również regulaminy działów, w których się wypowiadasz!
Zamiast zakładać temat po kilka razy, bo jest usuwany przez Administrację, przejrzyj regulamin i napisz poprawnie temat!
Sprawy z administracją możesz załatwiać anonimowo w tym dziale.
Najważniejsze informacje od Administracji możesz przeczytać tutaj oraz tutaj.
Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-01-05, 16:33


#404







Wiek: 26
Na forum: 4771 dni
Posty: 1438

Piwa: 2512

Respekt: 833,5
Respekt: 833,5Respekt: 833,5

Ostrzeżeń: 60%
Emm, localPlayer jest oficjaln? zmienn? i powinno dzia?a? w ka?dych okoliczno?ciach, do autora - kod da?e? po stronie client'a czy serwera ?

Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-01-18, 18:13


pomaza







Wiek: 39
Na forum: 3982 dni
Posty: 79

Piwa: 2

Respekt: 50

Dobra juz sobie poradzilem troche inaczej dzieki wam za pomoc :piwo: :piwo:

Postaw piwo autorowi tego posta
 

 
Tagi: suszara :: policji
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






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