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

Wysłany: 2019-09-01, 21:14


drzewo1902







Wiek: 28
Na forum: 2806 dni
Posty: 21
Nick w MP: Draczekk



Respekt: 50

Siemka, pisz? skrypt kt?ry po klikni?ciu na peda ma wysy?a? losowe wiadomo?ci, z tym ?e nie dzia?a a pedy kt?re mam wy?ej w skrypcie si? usuwaj?. Pomo?ecie?



Kod:

local messages = { "F*** off, Punk!", "You're not welcome.", "I'm not selling you anything.", "Find someone else to harrass.", "Get Lost." }


function clickPed(button, state, absX, absY, wx, wy, wz, element)
if getElementData(getLocalPlayer(), "exclusiveGUI") then
return
end

if element and getElementType(element) == "ped" and state=="down" and getElementData(element,"Lucasx2") then
local x, y, z = getElementPosition(getLocalPlayer())

if getDistanceBetweenPoints3D(x, y, z, wx, wy, wz)<=4 then
if true then
triggerServerEvent("onClientClick", element)
else
outputChatBox('[Bot m?wi]: ' .. messages[math.random(1, #messages)
end
end
end
end
addEventHandler("onClientClick", getRootElement(), clickPed, true)


Ostatnio zmieniony przez drzewo1902 2019-09-01, 22:03, w całości zmieniany 4 razy  
Postaw piwo autorowi tego posta
 

 
Wysłany: 2019-09-01, 21:53


Wilq







Wiek: 24
Na forum: 4428 dni
Posty: 3410

Piwa: 739

Respekt: 1225,8
Respekt: 1225,8

Kilka pyta?:
- czy posidasz elementDat? "exclusiveGUI"
- czy bot posiada elementDat? "Lucasx2"
- czy wiesz, ?e triggerujesz event "onClientClick" (bo tak masz skonstruowany warunek sprawdzaj?cy)
- funkcja outputChatBox nie jest zamkni?ta

Przed wys?aniem tutaj w?tku, sprawdzaj b??dy /debugscript 3 i ewentualnie je tutaj do??czaj.

local messages = { "F*** off, Punk!""You're not welcome.""I'm not selling you anything.""Find someone else to harrass.""Get Lost." } 


function clickPed(buttonstateabsXabsYwxwywzelement) 
    if (getElementData(getLocalPlayer(), "exclusiveGUI")) then 
        return 
    end 

    if (element) and (getElementType(element) == "ped") and (state == "down") and (getElementData(element"Lucasx2")) then 
        local xygetElementPosition(getLocalPlayer()) 

        if (getDistanceBetweenPoints3D(xyzwxwywz) <= 4then 
            outputChatBox("Bot m?wi]: " .. messages[math.random(#messages)])
        end 
    end 
end 
addEventHandler("onClientClick"getRootElement(), clickPedtrue)


Staraj si? korzysta? tak?e z BBCode: [.lua] [./lua]

Postaw piwo autorowi tego posta
 

 
Więcej szczegółów
Wystawiono 1 piw(a):
drzewo1902
Wysłany: 2019-09-01, 21:59


drzewo1902







Wiek: 28
Na forum: 2806 dni
Posty: 21
Nick w MP: Draczekk



Respekt: 50

Kod:

local Lucasx1 = createPed( 25, -1178.75, -291.8232421875, 14.354700088501 )
setPedRotation( Lucasx1, -50 )
setElementDimension( Lucasx1, 550 )
setElementInterior( Lucasx1 , 44 )
setElementData( Lucasx1, "talk", 1, false )
setElementData( Lucasx1, "name", "Lucas West", false )
setPedAnimation ( Lucasx1, "dealer", "dealer_deal", -1, true, false, false )
setElementFrozen(Lucasx1, true)


local Lucasx2 = createPed( 104, -1177.7399902344, -291.01599121094, 14.354700088501 )
setPedRotation( Lucasx2, 122 )
setElementDimension( Lucasx2, 550 )
setElementInterior( Lucasx2 , 44 )
setElementData( Lucasx2, "talk", 1, false )
setElementData( Lucasx2, "name", "Lucas Lewis", false )
setPedAnimation ( Lucasx2, "dealer", "dealer_deal", -1, true, false, false )
setElementFrozen(Lucasx2, true)

local messages = { "F*** off, Punk!", "You're not welcome.", "I'm not selling you anything.", "Find someone else to harrass.", "Get Lost." }


function clickPed(button, state, absX, absY, wx, wy, wz, element)
if getElementData(getLocalPlayer(), "exclusiveGUI") then
return
end

if element and getElementType(element) == "ped" and state=="down" and getElementData(element,"Lucasx2") then
local x, y, z = getElementPosition(getLocalPlayer())

if getDistanceBetweenPoints3D(x, y, z, wx, wy, wz)<=4 then
if true then
triggerServerEvent("onClientClick", element)
else
outputChatBox('[Bot m?wi]: ' .. messages[math.random(1, #messages)
end
end
end
end
addEventHandler("onClientClick", getRootElement(), clickPed, true)



tu jest ca?y kod, mo?esz go jako? przerobi? czy co??

Postaw piwo autorowi tego posta
 

 
Wysłany: 2019-09-01, 22:03


Wilq







Wiek: 24
Na forum: 4428 dni
Posty: 3410

Piwa: 739

Respekt: 1225,8
Respekt: 1225,8

Dzi?ki, ?e odpowiedzia?e? na kluczowe pytania dzi?ki kt?rym mo?emy szybko i bezproblemowo rozwi?za? problem.

Fajnie r?wnie?, ?e zobaczy?e? i przetestowa?e? przyk?ad kodu, kt?ry na pewno b?dzie dzia?a?.

Mi?o mi r?wnie?, ?e wykorzysta?e? odpowiednie BBCode (code -> lua).

Przy??? si? chocia? troch? jak ju? sam sobie nie jeste? w stanie poradzi? z takim do?? prostym problemem.

Podmie? ten event, na jedno pytanie ju? sobie odpowiedzia?em sam.

function clickPed(buttonstateabsXabsYwxwywzelement) 
    if (element) and (getElementType(element) == "ped") and (state == "down") and (element == Lucasx2then 
        local xygetElementPosition(getLocalPlayer()) 

        if (getDistanceBetweenPoints3D(xyzwxwywz) <= 4then 
            outputChatBox("Bot m?wi]: " .. messages[math.random(#messages)])
        end 
    end 
end 
addEventHandler("onClientClick"getRootElement(), clickPedtrue)


Postaw piwo autorowi tego posta
 

 
Więcej szczegółów
Wystawiono 1 piw(a):
drzewo1902
Wysłany: 2019-09-01, 22:10


drzewo1902







Wiek: 28
Na forum: 2806 dni
Posty: 21
Nick w MP: Draczekk



Respekt: 50

Dzi?ki wielkie <3, tak wiem, ?e jestem ameb? xD poradzi?e? sobie bez moich odpwiedzi na kt?re nie mia?em poj?cia jak odpowiedzie? XD jeszcze raz dzi?kuje :D

Postaw piwo autorowi tego posta
 

 
Tagi: kliknięcie :: peda
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