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: 2524 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.79110.5135.1715120, -90},
    {-2205.51, -64.6235.32151200},

}

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


addEventHandler('onColShapeHit'resourceRoot, function(elmd)
    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(vehthen 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) == 449then return false end
                     if (getElementModel(veh) == 407then return false end
                     if (getElementModel(veh) == 597then return false end
            local speedCamera=tonumber(getElementData(source,'fotoradar:predkosc'))
            local vxvyvz=getElementVelocity(veh)
            local speedVehicle=((vx^vy^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(elmandat_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!."v0120255)
                                           local ulica getZoneName(x,y,zfalse)
                                       local ulica2 getZoneName(x,y,ztrue)
                                       if ulica2~=ulica then ulica " "..ulica.." "..ulica2 else ulica " "..ulica end
                                           outputChatBox("* radar Lokalizacja: "..ulica.." | Kwota: "..mandat_cost.." PLN"v0100255)
                      local blip createBlip(x,y,z41200025509999v) 
         setTimer( function()
             if isElement(blipthen
             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(txdMODEL)
    dff engineLoadDFF("foto.dff"MODEL)
    engineReplaceModel(dffMODEL)
end)


function addRednessOnDamage ( )
      fadeCamera sourcefalse1.02550)         -- 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 redinterrupt it after half a second and fade back to normal
end
addEventHandler "onPlayerDamage"rootaddRednessOnDamage )

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


Postaw piwo autorowi tego posta
 

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


_jvneczek







Wiek: 22
Na forum: 4325 dni
Posty: 1513
Nick w MP: _jvneczek

Piwa: 3949

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: 2524 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: 2199 dni
Posty: 86
Nick w MP: anonymous

Piwa: 57

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: 2894 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: 2199 dni
Posty: 86
Nick w MP: anonymous

Piwa: 57

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: 2524 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: 4107 dni
Posty: 551
Nick w MP: Nexisten

Piwa: 1479

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(elmandat_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: 2524 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(elmandat_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 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