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

Wysłany: 2017-11-05, 13:32


DaVeCS

Mapper






Wiek: 31
Na forum: 3386 dni
Posty: 193
Nick w MP: DaVe

Piwa: 59

Respekt: 70,5

Witam, ot?? posiadam skrypt na suszark? sapd lecz nie chce ona dzia?a? w takim sensie, ?e mam 2 opcje:

Wystaw Mandat oraz Zaci?gnij R?czny.

?adna z tych opcji nie dzia?a.

Strona client:

function roundedRectangle(xywhcolor)
  dxDrawRectangle(xywhcolorfalse)
  dxDrawRectangle(2141colorfalse)
  dxDrawRectangle(2h41colorfalse)
  dxDrawRectangle(1214colorfalse)
  dxDrawRectangle(w214colorfalse)
end

fonte dxCreateFont(":nm-noti/czcionka.ttf",12) or "defaul-bold"
predkosc dxCreateFont(":nm-noti/czcionka.ttf",30) or "defaul-bold"

local screenWscreenH guiGetScreenSize()

local vehicle={}
vehicle.id=nil
vehicle.speed=nil
vehicle.driver=nil

local option={}
value=nil
element=nil
option.selected=0
option.actived=false

option["vehicle"]={
    "Wystaw Mandat",
    "Zaci?gnij R?czny",
}
function isPedAiming thePedToCheck )
    if isElement(thePedToCheckthen
        if getElementType(thePedToCheck) == "player" or getElementType(thePedToCheck) == "ped" then
            if getPedTask(thePedToCheck"secondary"0) == "TASK_SIMPLE_USE_GUN" then
                return true
            end
        end
    end
    return false
end

function isRendering()
    if option.actived == true then
        if not element then return end
        if value == "vehicle" then
        local sx,sy,sz getElementVelocity(element)
        local automod getVehicleName(element)
        local poid getElementData(element"id") or "Brak ID"
        local ostatni getElementData(element,"ostatnikierowca") or "Brak"
        local km math.ceil(((sx^2+sy^2+sz^2)^(0.5))*155)
        roundedRectangle(screenW 0.3375screenH 0.0667screenW 0.3405screenH 0.1686tocolor(000180), false)
        dxDrawText(km.."km/h"screenW 0.3804screenH 0.0819screenW 0.4863screenH 0.2200tocolor(255255255255), 1.00predkosc"center""center"falsefalsefalsefalsefalse)
        dxDrawText("Ostatni Kierowca: "..ostatni.."\nModel Pojazdu: "..automod.."\nID Pojazdu: "..poid..""screenW 0.5351screenH 0.0943screenW 0.6577screenH 0.1724tocolor(255255255255), 1.00fonte"center""center"falsefalsefalsefalsefalse)
        dxDrawText(option[value][option.selected] or "Wybierz opcje (scrollem)"screenW 0.4452screenH 0.1838screenW 0.5768screenH 0.2286tocolor(255255255255), 1.00fonte"center""center"falsefalsefalsefalsefalse)
        --dxDrawText("Suszarka SAPD"screenW 0.4104screenH 0.7967screenW 0.5993screenH 0.8456tocolor(255255255255), 1.00"default""center""center"falsefalsefalsefalsefalse)
        end
    end
end

addEventHandler("onClientPlayerTarget",root, function(el)
    if isPedAiming(localPlayer) and el and getPedWeapon(localPlayer) == 24 then
        if not option.actived  then
            if getElementType(el) == "vehicle" then
                value="vehicle"
                element=el
                option.actived=true
            else return end
            bindKey("mouse1""down"onElementClicked)
            bindKey("mouse_wheel_down""down"onElementMoveDown)
            bindKey("mouse_wheel_up""down"onElementMoveUp)
            bindKey("arrow_d""down"onElementMoveDown)
            bindKey("arrow_u""down"onElementMoveDown)
            addEventHandler("onClientHUDRender"rootisRendering)
        end
    else
        if option.actived then
            vehicle.el=nil
            option.actived=false
            unbindKey("mouse1""down"onElementClicked)
            unbindKey("mouse_wheel_down""down"onElementMoveDown)
            unbindKey("mouse_wheel_up""down"onElementMoveUp)
            unbindKey("arrow_d""down"onElementMoveDown)
            unbindKey("arrow_u""down"onElementMoveDown)
            removeEventHandler("onClientHUDRender"rootisRendering)
        end
    end
end)

function onElementMoveUp() if option.selected 4 then option.selected=else option.selected=option.selected+1 end end
function onElementMoveDown() if option.selected 1 then option.selected=else option.selected=option.selected-1 end end
function onElementClicked() if option.selected 0 then triggerServerEvent("onDryerAction2"localPlayervalueoption.selectedelementend end

function blokada prevSlotnewSlot )
    if getPedWeapon(getLocalPlayer(), newSlot) == 24 then
        toggleControl "fire"false ) --disable the aim button
    else 
        toggleControl "fire"true ) --renable the aim button
    end
end
addEventHandler "onClientPlayerWeaponSwitch"getRootElement(), blokada )


Strona Server:
function isPedAiming(player)
    if isElement(playerthen
        if getElementType(player) == "player" or getElementType(player) == "vehicle" then
            if getPedTask(player"secondary"0) == "TASK_SIMPLE_USE_GUN" then
                return true
            end
        end
    end
    return false
end

addEvent("onDryerAction2"true)
addEventHandler("onDryerAction2"root, function(typ,selected,el)
    if not el or not selected then return end
    if typ == "vehicle" then
        if not el then return end
        local kierowca getVehicleController(el)
        if selected == 1 then
         local hajs getElementData(kierowca,"pieniadze")
         setElementData(kierowca,"pieniadze",hajs-250)
            outputChatBox("Wystawi?e? mandat za przekroczon? pr?dko??."source255255255)
            outputChatBox("Dosta?e? mandat za przekroczon? pr?dkosc."kierowca255255255)
                        local dajkase math.random(10,50)
        end
    end
end)


Prosz? was o pomoc :(

Postaw piwo autorowi tego posta
 

 
Więcej szczegółów
Wystawiono 1 piw(a):
Kortiz
Wysłany: 2017-11-05, 16:03


amited







Wiek: 26
Na forum: 3714 dni
Posty: 1233
Nick w MP: Amited

Piwa: 512

Respekt: 466
Respekt: 466

skoro masz 2 opcje to po co tutaj s? 4?
option.selected > 4

Podpis
"amited" napisał/a:
Postaw piwo autorowi tego posta
 

 
Wysłany: 2017-11-05, 16:08


DaVeCS

Mapper






Wiek: 31
Na forum: 3386 dni
Posty: 193
Nick w MP: DaVe

Piwa: 59

Respekt: 70,5

Czyli musz? te "4" Zmieni? na "2"?

[ Dodano: 2017-11-05, 16:13 ]
Zmieni?em te 4 na 2 i dalej nic :(

Postaw piwo autorowi tego posta
 

 
Wysłany: 2017-11-05, 16:52


amited







Wiek: 26
Na forum: 3714 dni
Posty: 1233
Nick w MP: Amited

Piwa: 512

Respekt: 466
Respekt: 466

addEvent("onDryerAction2"true)
addEventHandler("onDryerAction2"root, function(typ,selected,el)
    if typ == "vehicle" then
        local kierowca getVehicleController(el)
        if selected == 1 then
            local hajs getElementData(kierowca,"pieniadze")
            setElementData(kierowca,"pieniadze",tonumber(hajs)-250)
            outputChatBox("Wystawi?e? mandat za przekroczon? pr?dko??."source255255255)
            outputChatBox("Dosta?e? mandat za przekroczon? pr?dkosc."kierowca255255255)
        end
    end
end)

tak zobacz i na przysz?o?? stosuj taby a nie spacje

Podpis
"amited" napisał/a:
Postaw piwo autorowi tego posta
 

 
Wysłany: 2017-11-05, 19:12


DaVeCS

Mapper






Wiek: 31
Na forum: 3386 dni
Posty: 193
Nick w MP: DaVe

Piwa: 59

Respekt: 70,5

Niestety dalej nie dziala :(

Postaw piwo autorowi tego posta
 

 
Wysłany: 2017-11-05, 21:09


Malentas

Koder mirofali w lua






Wiek: 24
Na forum: 3681 dni
Posty: 146
Nick w MP: Malentas

Piwa: 1626

Respekt: 47,3

Jezu m?j skrypt z przed 1,5roku XDDD

Podpis
Aktualny projekt:


AntoriaMTA
Discord: https://discord.gg/TVrAddp3Wu

Najszybszy kontakt (discord): Malentas#2091
Postaw piwo autorowi tego posta
 

 
Tagi: suszarka :: sapd
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