Wysłany: 2017-11-05, 13:32
DaVeCS
Mapper
Wiek: 31 Na forum: 3386 dni Posty: 193
Nick w MP: DaVe
Piwa : 59
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 ( x , y , w , h , color )
dxDrawRectangle ( x , y , w , h , color , false )
dxDrawRectangle ( x + 2 , y - 1 , w - 4 , 1 , color , false )
dxDrawRectangle ( x + 2 , y + h , w - 4 , 1 , color , false )
dxDrawRectangle ( x - 1 , y + 2 , 1 , h - 4 , color , false )
dxDrawRectangle ( x + w , y + 2 , 1 , h - 4 , color , false )
end
fonte = dxCreateFont ( ":nm-noti/czcionka.ttf" , 12 ) or "defaul-bold"
predkosc = dxCreateFont ( ":nm-noti/czcionka.ttf" , 30 ) or "defaul-bold"
local screenW , screenH = 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 ( thePedToCheck ) then
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.3375 , screenH * 0.0667 , screenW * 0.3405 , screenH * 0.1686 , tocolor ( 0 , 0 , 0 , 180 ), false )
dxDrawText ( km .. "km/h" , screenW * 0.3804 , screenH * 0.0819 , screenW * 0.4863 , screenH * 0.2200 , tocolor ( 255 , 255 , 255 , 255 ), 1.00 , predkosc , "center" , "center" , false , false , false , false , false )
dxDrawText ( "Ostatni Kierowca: " .. ostatni .. "\nModel Pojazdu: " .. automod .. "\nID Pojazdu: " .. poid .. "" , screenW * 0.5351 , screenH * 0.0943 , screenW * 0.6577 , screenH * 0.1724 , tocolor ( 255 , 255 , 255 , 255 ), 1.00 , fonte , "center" , "center" , false , false , false , false , false )
dxDrawText ( option [ value ][ option . selected ] or "Wybierz opcje (scrollem)" , screenW * 0.4452 , screenH * 0.1838 , screenW * 0.5768 , screenH * 0.2286 , tocolor ( 255 , 255 , 255 , 255 ), 1.00 , fonte , "center" , "center" , false , false , false , false , false )
-- dxDrawText ( "Suszarka SAPD" , screenW * 0.4104 , screenH * 0.7967 , screenW * 0.5993 , screenH * 0.8456 , tocolor ( 255 , 255 , 255 , 255 ), 1.00 , "default" , "center" , "center" , false , false , false , false , false )
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" , root , isRendering )
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" , root , isRendering )
end
end
end )
function onElementMoveUp () if option . selected > 4 then option . selected = 1 else option . selected = option . selected + 1 end end
function onElementMoveDown () if option . selected < 1 then option . selected = 4 else option . selected = option . selected - 1 end end
function onElementClicked () if option . selected > 0 then triggerServerEvent ( "onDryerAction2" , localPlayer , value , option . selected , element ) end end
function blokada ( prevSlot , newSlot )
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 ( player ) then
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??." , source , 255 , 255 , 255 )
outputChatBox ( "Dosta?e? mandat za przekroczon? pr?dkosc." , kierowca , 255 , 255 , 255 )
local dajkase = math . random ( 10 , 50 )
end
end
end )
Prosz? was o pomoc :(
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
skoro masz 2 opcje to po co tutaj s? 4?
option.selected > 4
Podpis
"amited" napisał/a :
Wysłany: 2017-11-05, 16:08
DaVeCS
Mapper
Wiek: 31 Na forum: 3386 dni Posty: 193
Nick w MP: DaVe
Piwa : 59
Czyli musz? te "4" Zmieni? na "2"?
[ Dodano : 2017-11-05, 16:13 ]
Zmieni?em te 4 na 2 i dalej nic
Wysłany: 2017-11-05, 16:52
amited
Wiek: 26 Na forum: 3714 dni Posty: 1233
Nick w MP: Amited
Piwa : 512
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??." , source , 255 , 255 , 255 )
outputChatBox ( "Dosta?e? mandat za przekroczon? pr?dkosc." , kierowca , 255 , 255 , 255 )
end
end
end )
tak zobacz i na przysz?o?? stosuj taby a nie spacje
Podpis
"amited" napisał/a :
Wysłany: 2017-11-05, 19:12
DaVeCS
Mapper
Wiek: 31 Na forum: 3386 dni Posty: 193
Nick w MP: DaVe
Piwa : 59
Niestety dalej nie dziala
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
Jezu m?j skrypt z przed 1,5roku XDDD
Tagi: suszarka :: sapd
Anonymous
Na forum: 245 dni
Posty: 1
Anonymous Koniecznie zajrzyj na: