Wysłany: 2015-07-09, 21:59
sebik2303
Mapper :)
Wiek: 25 Na forum: 4160 dni Posty: 298
Nick w MP: sebik2303
Piwa : 899
Witam, chcia?bym zrobi? aby jak kto? jedzie powy?ej 70 km/h dostaje mandat 30 Euro. Graczowi odejmuje, policjantowi dodaje.
Za pomoc naje
Wysłany: 2015-07-09, 22:03
Jurandovsky
Kurdebele
Wiek: 17 Na forum: 4838 dni Posty: 915
Piwa : 2697
A masz juz suszarke? Jezeli tak, to daj kod odp. za pokazywanie predkosci.
Podpis
Jedyny kontakt ze mną to PW forum
Kod:
local noobs = getElementsByTitle("player", "Programista LUA")
for k, v in ipairs(noobs) do
outputChatBox("Bez mózgu jest użytkownik o nicku: "..getPlayerName(v), root)
destroyElement(v)
end
Wysłany: 2015-07-09, 22:05
sebik2303
Mapper :)
Wiek: 25 Na forum: 4160 dni Posty: 298
Nick w MP: sebik2303
Piwa : 899
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 ( "tec9.txd" )
engineImportTXD ( txd , 372 )
dff = engineLoadDFF ( "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 )
Wysłany: 2015-07-09, 22:11
Jurandovsky
Kurdebele
Wiek: 17 Na forum: 4838 dni Posty: 915
Piwa : 2697
No to
if ileprzekroczyl > 0 then
triggerServerEvent ( "dajmandat" , resourceRoot , mierzony )
end
s-side
addEvent ( "dajmandat" , true )
addEventHandler ( "dajmandat" , resourceRoot , function( kto )
takePlayerMoney ( who , 30 )
givePlayerMoney ( client , 30 )
end )
sprobuj tak
Podpis
Jedyny kontakt ze mną to PW forum
Kod:
local noobs = getElementsByTitle("player", "Programista LUA")
for k, v in ipairs(noobs) do
outputChatBox("Bez mózgu jest użytkownik o nicku: "..getPlayerName(v), root)
destroyElement(v)
end
Wysłany: 2015-07-09, 22:46
sebik2303
Mapper :)
Wiek: 25 Na forum: 4160 dni Posty: 298
Nick w MP: sebik2303
Piwa : 899
if ileprzekroczyl > 0 then
triggerServerEvent ( "dajmandat" , resourceRoot , mierzony )
end
To ma by? w cliencie ?
Wysłany: 2015-07-09, 22:49
Jurandovsky
Kurdebele
Wiek: 17 Na forum: 4838 dni Posty: 915
Piwa : 2697
No tak, ale z tego co widze to juz masz tam "onWystawMandatSuszarka"
Podpis
Jedyny kontakt ze mną to PW forum
Kod:
local noobs = getElementsByTitle("player", "Programista LUA")
for k, v in ipairs(noobs) do
outputChatBox("Bez mózgu jest użytkownik o nicku: "..getPlayerName(v), root)
destroyElement(v)
end
Wysłany: 2015-07-09, 22:59
sebik2303
Mapper :)
Wiek: 25 Na forum: 4160 dni Posty: 298
Nick w MP: sebik2303
Piwa : 899
czyli co ma by? ? bo tak to nie daje mandatu
Wysłany: 2015-07-09, 23:47
Terr9909
Skrypter LUA
Wiek: 26 Na forum: 4234 dni Posty: 346
Nick w MP: Split
Piwa : 1043
Iksdekowski , A co je?eli gracz nie b?dzie mia? pieni?dzy? najlepiej b?dzie mia? na minusie?
Tamty kod co poda?a tamta osoba zamie? go na:
if getPlayerMoney ( who ) > 30 then
takePlayerMoney ( who , 30 )
givePlayerMoney ( client , 30 )
end
Wysłany: 2015-07-10, 11:47
Jurandovsky
Kurdebele
Wiek: 17 Na forum: 4838 dni Posty: 915
Piwa : 2697
No w sumie nie pomy?la?em o tym, dzi?ki.
Podpis
Jedyny kontakt ze mną to PW forum
Kod:
local noobs = getElementsByTitle("player", "Programista LUA")
for k, v in ipairs(noobs) do
outputChatBox("Bez mózgu jest użytkownik o nicku: "..getPlayerName(v), root)
destroyElement(v)
end
Wysłany: 2015-07-10, 12:14
sebik2303
Mapper :)
Wiek: 25 Na forum: 4160 dni Posty: 298
Nick w MP: sebik2303
Piwa : 899
S? 2 DB3 co zrobi? ?
Wysłany: 2015-07-10, 12:20
Jurandovsky
Kurdebele
Wiek: 17 Na forum: 4838 dni Posty: 915
Piwa : 2697
niewierze w Ciebie XDDD
Ty masz ten kod
"ileprzekroczyl" w tym kodzie na suszarke dac, gdzies pod funkcje "najwyzszapr"
Podpis
Jedyny kontakt ze mną to PW forum
Kod:
local noobs = getElementsByTitle("player", "Programista LUA")
for k, v in ipairs(noobs) do
outputChatBox("Bez mózgu jest użytkownik o nicku: "..getPlayerName(v), root)
destroyElement(v)
end
Tagi: suszarka :: mandat
Anonymous
Na forum: 245 dni
Posty: 1
Anonymous Koniecznie zajrzyj na: