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

Wysłany: 2021-10-26, 15:47


Pro3west1







Wiek: 26
Na forum: 2665 dni
Posty: 37
Nick w MP: hjkh



Respekt: 50

Witam, jak zrobi? aby fotoradary nie pobiera?y hajsu gdy kto? ma 0$??
Pozdrawiam


local speedCameras={
    {-2412.79, 110.51, 35.17, 15, 120, -90},
    {-2205.51, -64.62, 35.32, 15, 120, 0},

}

for i,v in pairs(speedCameras) do
    local cs=createColSphere(v[1], v[2], v[3], v[4]-2)
    local o1=createObject(16101, v[1], v[2], v[3]-2.16, 0, 0, v[6])
    setElementData(cs, 'fotoradar:predkosc', v[5] or 60, false) 
    local t=createElement("text")
    setElementPosition(t,v[1],v[2],v[3]+4)
    setElementDimension(t, 0)
    setElementInterior(t, 0)
end


addEventHandler('onColShapeHit', resourceRoot, function(el, md)
    if not el then return end
    if getElementType(el) == 'player' then
        if getElementData(el, 'player:faction') == 'SAPD' then return end
        if getElementData(el, 'player:faction') == 'SAFD' then return end
        if getElementData(el, 'player:faction') == 'SAMD' then return end
        local veh=getPedOccupiedVehicle(el)
        if not veh then return end
        if getVehicleController(veh)~=el then return end
        if getElementData(veh,"multiseat") then return end
        if getVehicleSirensOn(veh) then return else
            if getElementData(veh,"vehicle:masked") and getElementData(veh,"vehicle:masked") >= 1 then
            return end
                        if getElementData(el, "player:jobtram") then return false end
                        if (getElementModel(veh) == 449) then return false end
                     if (getElementModel(veh) == 407) then return false end
                     if (getElementModel(veh) == 597) then return false end
            local speedCamera=tonumber(getElementData(source,'fotoradar:predkosc'))
            local vx, vy, vz=getElementVelocity(veh)
            local speedVehicle=((vx^2 + vy^2 + vz^2)^(0.5))*161
            if speedVehicle>speedCamera then
                local cost=0
                local diff=(speedVehicle-speedCamera)
                if speedVehicle>speedCamera+10 then
                    cost=diff*2
                else
                    cost=diff*2
                end
                cost=math.floor(cost)
                                local mandat_cost = cost
                takePlayerMoney(el, mandat_cost)
                x,y,z=getElementPosition(el)
                outputChatBox( "Przekroczy?e? pr?dko??! ".. mandat_cost.." PLN.", el,255,255,255,true)

--fadeCamera(false,0.1,255,255,255)
--setTimer(fadeCamera,60,1,true,1.5)
--exports["AvCentral_EnginePRO"]:avc_dbSet("insert into avc_mandate values(null,?,?,now(),?,?,?,?,0,0)",getElementData(el,"avc_player_pid"),getPlayerSerial(el),toJSON({x,y,z},true),-1,"Przekroczenie predkosci. Dopuszczalna predkosc "..speedCamera.."km/h, Twoja predkosc "..string.format("%.02f", speedVehicle).." km/h.",cost)

                                for i,v in ipairs(getElementsByType("player")) do
                                     if getElementData(v, "player:faction") == "SAPD" then 
                                           outputChatBox("* radar Pojazd: "..getVehicleName(veh).." przekroczyl predkosc!.", v, 0, 120, 255)
                                           local ulica = getZoneName(x,y,z, false)
                                       local ulica2 = getZoneName(x,y,z, true)
                                       if ulica2~=ulica then ulica = " "..ulica.." "..ulica2 else ulica = " "..ulica end
                                           outputChatBox("* radar Lokalizacja: "..ulica.." | Kwota: "..mandat_cost.." PLN", v, 0, 100, 255)
                      local blip = createBlip(x,y,z, 41, 2, 0, 0, 0, 255, 0, 9999, v) 
         setTimer( function()
             if isElement(blip) then
             destroyElement(blip)
         else
             destroyElement(blip)
         end
             end,20000,1)
                                     end
                                end
            end
        end
    end
end
)

local MODEL=16101

addEventHandler("onClientResourceStart", resourceRoot, function()
    txd = engineLoadTXD("foto.txd" )
    engineImportTXD(txd, MODEL)
    dff = engineLoadDFF("foto.dff", MODEL)
    engineReplaceModel(dff, MODEL)
end)


function addRednessOnDamage ( )
      fadeCamera ( source, false, 1.0, 255, 0, 0 )         -- fade the player's camera to red over a period of 1 second
      setTimer ( fadeCameraDelayed, 500, 1, source )   -- don't let it go to opaque red, interrupt it after half a second and fade back to normal
end
addEventHandler ( "onPlayerDamage", root, addRednessOnDamage )

function fadeCameraDelayed(player) -- This function prevents debug warnings when the player disconnects while the timer is running.
      if (isElement(player)) then
            fadeCamera(player, true, 0.5)
      end
end


Postaw piwo autorowi tego posta
 

 
Wysłany: 2021-10-26, 18:24


_jvneczek







Wiek: 22
Na forum: 4466 dni
Posty: 1509
Nick w MP: _jvneczek

Piwa: 3960

Respekt: 337,5
Respekt: 337,5Respekt: 337,5Respekt: 337,5

Pobierz got?wke gracza, je?li ma poni?ej 0 to niech nie wykonuje takePlayerMoney

Postaw piwo autorowi tego posta
 

 
Wysłany: 2021-10-26, 22:10


Pro3west1







Wiek: 26
Na forum: 2665 dni
Posty: 37
Nick w MP: hjkh



Respekt: 50

"svt.n" napisał/a:

Pobierz got?wke gracza, je?li ma poni?ej 0 to niech nie wykonuje takePlayerMoney


A jak to zrobi??

Postaw piwo autorowi tego posta
 

 
Wysłany: 2021-10-27, 00:18


etrnl

CLASSIC RPG






Wiek: 26
Na forum: 2340 dni
Posty: 86
Nick w MP: anonymous

Piwa: 58

Respekt: 50

Ostrzeżeń: 40%
U?yj funkcji MTA https://wiki.multitheftauto.com/wiki/GetPlayerMoney

i zako?cz sobie funkcj? je?eli pieni?dze gracza wynosz? mniej ni? otrzymany mandat.

Ale nie wiem po co ma zabiera? pieni?dze, nie lepiej ci zrobi? system mandat?w do op?aty w urz?dzie?

robisz sobie w usersach tabelke mandat, nadajesz po wej?ciu i zapisujesz po wyj?ciu, zamiast takePlayerMoney u?ywasz np. setElementData(plr, "player"mandate") tylko pierw musisz pobra? ilo?? tych jego mandat?w za pomoc? getElementData i doda? do istniej?cej element daty warto?? kolejnego mandatu. Taki skrypt zapewne znajdziesz na necie i zawsze si? co? poduczysz.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2021-10-27, 17:38


Maniekxx

Amator






Wiek: 24
Na forum: 3035 dni
Posty: 232
Nick w MP: Maniekxx

Piwa: 225

Respekt: 110
Respekt: 110

Ostrzeżeń: 20%
if getPlayerMoney(player) <= 0 then return end

Postaw piwo autorowi tego posta
 

 
Wysłany: 2021-10-29, 15:36


etrnl

CLASSIC RPG






Wiek: 26
Na forum: 2340 dni
Posty: 86
Nick w MP: anonymous

Piwa: 58

Respekt: 50

Ostrzeżeń: 40%
"Maniekxx" napisał/a:

if getPlayerMoney(player) <= 0 then return end


Nie mo?e por?wna? do zera tylko do kwoty mandatu, bo je?eli b?dzie mia? 5euro i zabierze mu za mandat np 150 to i tak b?dzie na minus, a tego chce unikn??.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2021-10-30, 13:49


Pro3west1







Wiek: 26
Na forum: 2665 dni
Posty: 37
Nick w MP: hjkh



Respekt: 50

Ma kto? jeszcze jaki? pomys??

Postaw piwo autorowi tego posta
 

 
Wysłany: 2021-10-30, 15:26


Nexisten

Moderator






Wiek: 22
Na forum: 4248 dni
Posty: 552
Nick w MP: Nexisten

Piwa: 1486

Respekt: 287,3
Respekt: 287,3Respekt: 287,3Respekt: 287,3

Dodaj przed funkcje

Więcej informacji znajdziesz w Wikipedii MTA:

takePlayerMoney

ten kod i sprawd? czy dzia?a jak powinno, teoretycznie nie powinno teraz zabiera? pieni?dzy, je?li gracza nie sta? na mandat
if getPlayerMoney(el) < mandat_cost then return end


Czyli tamten kawa?ek kodu po edycji powinien wygl?da? mniej wi?cej tak
local mandat_cost = cost
if getPlayerMoney(el) < mandat_cost then return end
takePlayerMoney(el, mandat_cost)

Oczywi?cie wy?ej i ni?ej jest reszta twojego kodu

Postaw piwo autorowi tego posta
 

 
Wysłany: 2021-11-20, 11:10


Pro3west1







Wiek: 26
Na forum: 2665 dni
Posty: 37
Nick w MP: hjkh



Respekt: 50

"Nexisten" napisał/a:

Dodaj przed funkcje

Więcej informacji znajdziesz w Wikipedii MTA:

takePlayerMoney

ten kod i sprawd? czy dzia?a jak powinno, teoretycznie nie powinno teraz zabiera? pieni?dzy, je?li gracza nie sta? na mandat
if getPlayerMoney(el) < mandat_cost then return end


Czyli tamten kawa?ek kodu po edycji powinien wygl?da? mniej wi?cej tak
local mandat_cost = cost
if getPlayerMoney(el) < mandat_cost then return end
takePlayerMoney(el, mandat_cost)

Oczywi?cie wy?ej i ni?ej jest reszta twojego kodu


Dzi?ki dzia?a, ale jest jeden problem.
Nie dzia?a powiadomienie SAPD gdy gracz nie ma kasy jedynie jak kase ma, jak to naprawi??

[ Dodano: 2021-12-10, 10:26 ]
ref

Postaw piwo autorowi tego posta
 

 
Tagi: fotoradary
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






Skocz do:  
Wyświetl posty z ostatnich:   
GTAONLINE.PL » JĘZYKI PROGRAMOWANIA » LUA » Fotoradary Odpowiedz do tematu

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