Wysłany: 2020-05-05, 19:27
DaVeCS
Mapper
Wiek: 31 Na forum: 3386 dni Posty: 193
Nick w MP: DaVe
Piwa : 59
Witam ot?? mam problem z panelem logowania. Gdy wybieram spawn ka?dy poza "Tw?j Dom" to jest dobrze, za? gdy wybiore w?a?nie "Tw?j Dom" to nic si? nie dzieje opr?cz b??du w debugscript
B??d https://imgur.com/a/dtunt4s
Kod dotycz?cy b??du:
-- Compatibility : Lua - 5.1
function split ( str , pat )
local t = {} -- NOTE : use { n = 0 } in Lua - 5.0
local fpat = "(.-)" .. pat
local last_end = 1
local s , e , cap = str : find ( fpat , 1 )
while s do
if s ~= 1 or cap ~= "" then
table . insert ( t , cap )
end
last_end = e + 1
s , e , cap = str : find ( fpat , last_end )
end
if last_end <= #str then
cap = str : sub ( last_end )
table . insert ( t , cap )
end
return t
end
6 linijka to: local s, e, cap = str:find(fpat, 1)
[ Dodano : 2020-05-05, 19:31 ]
Dodam ?e jak nie mam kupionego domku to respi w miejscu spawnu tam gdzie ustawi?em.
Wysłany: 2020-05-05, 19:37
Wilq
Wiek: 24 Na forum: 4428 dni Posty: 3410
Piwa : 739
Nie musisz definiowa? funkcji split, gdy? jest ona ju? wbudowana w MTA.
Wysłany: 2020-05-05, 19:43
DaVeCS
Mapper
Wiek: 31 Na forum: 3386 dni Posty: 193
Nick w MP: DaVe
Piwa : 59
Czyli poprostu mam j? usun???
[ Dodano : 2020-05-05, 19:45 ]
My?l? ?e to nie jest to, poniewa? wyb?r spawnu "Tw?j Dom" dalej nie reaguje.
Kod od wyboru Spawnu:
--[[
Resource : OURGme v2
Developers : Split < split . programista @ gmail . com >
You have no right to use this code without my permission .
( c ) 2015 < split . programista @ gmail . com >. All rights reserved .
]]
local sx , sy = guiGetScreenSize ()
local px , py = ( sx / 1920 ),( sy / 1080 )
local data ={ showed = nil , button ={}, info = nil , misc = nil , tick = getTickCount ()}
local font = dxCreateFont ( "font.ttf" , 12 )
local font1 = dxCreateFont ( "font1.ttf" , 15 )
local font12 = dxCreateFont ( "font1.ttf" , 10 )
local font123 = dxCreateFont ( "font1.ttf" , 14 )
local cameraX , cameraY = 600 , 2400
local screenW , screenH = guiGetScreenSize ()
function isMouseIn123 ( psx , psy , pssx , pssy , abx , aby )
if not isCursorShowing () then return end
cx , cy = getCursorPosition ()
cx , cy = cx * sx , cy * sy
if cx >= psx and cx <= psx + pssx and cy >= psy and cy <= psy + pssy then
return true , cx , cy
else
return false
end
end
local anims , builtins = {}, { "Linear" , "InQuad" , "OutQuad" , "InOutQuad" , "OutInQuad" , "InElastic" , "OutElastic" , "InOutElastic" , "OutInElastic" , "InBack" , "OutBack" , "InOutBack" , "OutInBack" , "InBounce" , "OutBounce" , "InOutBounce" , "OutInBounce" , "SineCurve" , "CosineCurve" }
function table . find ( t , v )
for k , a in ipairs ( t ) do
if a == v then
return k
end
end
return false
end
a = 255
function animate ( f , t , easing , duration , onChange , onEnd )
assert ( type ( f ) == "number" , "Bad argument @ 'animate' [expected number at argument 1, got " .. type ( f ).. "]" )
assert ( type ( t ) == "number" , "Bad argument @ 'animate' [expected number at argument 2, got " .. type ( t ).. "]" )
assert ( type ( easing ) == "string" or ( type ( easing ) == "number" and ( easing >= 1 or easing <= #builtins)), "Bad argument @ 'animate' [Invalid easing at argument 3]")
assert ( type ( duration ) == "number" , "Bad argument @ 'animate' [expected function at argument 4, got " .. type ( duration ).. "]" )
assert ( type ( onChange ) == "function" , "Bad argument @ 'animate' [expected function at argument 5, got " .. type ( onChange ).. "]" )
table . insert ( anims , { from = f , to = t , easing = table . find ( builtins , easing ) and easing or builtins [ easing ], duration = duration , start = getTickCount ( ), onChange = onChange , onEnd = onEnd })
return #anims
end
function destroyAnimation ( a )
if anims [ a ] then
table . remove ( anims , a )
end
end
addEventHandler ( "onClientRender" , root , function( )
local now = getTickCount ( )
for k , v in ipairs ( anims ) do
v . onChange ( interpolateBetween ( v . from , 0 , 0 , v . to , 0 , 0 , ( now - v . start ) / v . duration , v . easing ))
if now >= v . start + v . duration then
if type ( v . onEnd ) == "function" then
v . onEnd ( )
end
table . remove ( anims , k )
end
end
end )
choosed = 0
function renderZoneBox ()
local progress = math . sin ( getTickCount ()/ 450 )* 4
local r = interpolateBetween ( 255 , 255 , 255 , 20 , 250 , 0 ,( getTickCount ()- tick )/ 2000 , "SineCurve" )
cameraX , cameraY = cameraX - 0.1 , cameraY - 0.1
setCameraMatrix ( cameraX , cameraY , 500 , cameraX + 1 , cameraY + 1 , 0 )
dxDrawImage ( screenW * 0.0000 , screenH * 0.0000 , screenW * 1.0000 , screenH * 1.0000 , ":im-logowanie/misc/69.png" , 0 , 0 , 0 , tocolor ( 255 , 255 , 255 , 255 ), false )
dxDrawImage ( screenW * 0.3703 , screenH * 0.1935 , screenW * 0.2755 , screenH * 0.0852 , ":im-logowanie/misc/logo_1.png" , 0 , 0 , 0 , tocolor ( 255 , 255 , 255 , ALPHA1 ), false )
dxDrawImage ( screenW * 0.6240 , screenH * 0.2074 , screenW * 0.0464 , screenH * 0.0463 , ":im-logowanie/misc/icon.png" , 0 , 0 , 0 , tocolor ( 255 , 255 , 255 , ALPHA1 ), false )
if choosed == 1 then
dxDrawText ( "SPAWN LOS SANTOS" , screenW * 0.4297 , screenH * 0.3574 , screenW * 0.6005 , screenH * 0.4130 , tocolor ( 255 , 255 , 255 , r ), 1.00 , font , "center" , "center" , false , false , false , false , false )
dxDrawImage ( screenW * 0.3911 , screenH * 0.3574 , screenW * 0.0323 , screenH * 0.0556 , ":im-logowanie/misc/wyb.png" , 0 , 0 , 0 , tocolor ( 255 , 255 , 255 , 255 ), false )
else
dxDrawText ( "SPAWN LOS SANTOS" , screenW * 0.4297 , screenH * 0.3574 , screenW * 0.6005 , screenH * 0.4130 , tocolor ( 140 , 140 , 140 , a ), 1.00 , font , "center" , "center" , false , false , false , false , false )
dxDrawImage ( screenW * 0.3911 , screenH * 0.3574 , screenW * 0.0323 , screenH * 0.0556 , ":im-logowanie/misc/niewyb.png" , 0 , 0 , 0 , tocolor ( 255 , 255 , 255 , a ), false )
end
if choosed == 2 then
dxDrawText ( "PRZECHO LOS SANTOS" , screenW * 0.4297 , screenH * 0.4296 , screenW * 0.6005 , screenH * 0.4852 , tocolor ( 255 , 255 , 255 , r ), 1.00 , font , "center" , "center" , false , false , false , false , false )
dxDrawImage ( screenW * 0.3911 , screenH * 0.4333 , screenW * 0.0323 , screenH * 0.0556 , ":im-logowanie/misc/wyb.png" , 0 , 0 , 0 , tocolor ( 255 , 255 , 255 , 255 ), false )
else
dxDrawText ( "PRZECHO LOS SANTOS" , screenW * 0.4297 , screenH * 0.4296 , screenW * 0.6005 , screenH * 0.4852 , tocolor ( 140 , 140 , 140 , a ), 1.00 , font , "center" , "center" , false , false , false , false , false )
dxDrawImage ( screenW * 0.3911 , screenH * 0.4333 , screenW * 0.0323 , screenH * 0.0556 , ":im-logowanie/misc/niewyb.png" , 0 , 0 , 0 , tocolor ( 255 , 255 , 255 , a ), false )
end
if choosed == 3 then
dxDrawText ( "TW?J DOM" , screenW * 0.4297 , screenH * 0.5083 , screenW * 0.6005 , screenH * 0.5639 , tocolor ( 255 , 255 , 255 , r ), 1.00 , font , "center" , "center" , false , false , false , false , false )
dxDrawImage ( screenW * 0.3911 , screenH * 0.5083 , screenW * 0.0323 , screenH * 0.0556 , ":im-logowanie/misc/wyb.png" , 0 , 0 , 0 , tocolor ( 255 , 255 , 255 , 255 ), false )
else
dxDrawText ( "TW?J DOM" , screenW * 0.4297 , screenH * 0.5083 , screenW * 0.6005 , screenH * 0.5639 , tocolor ( 140 , 140 , 140 , a ), 1.00 , font , "center" , "center" , false , false , false , false , false )
dxDrawImage ( screenW * 0.3911 , screenH * 0.5083 , screenW * 0.0323 , screenH * 0.0556 , ":im-logowanie/misc/niewyb.png" , 0 , 0 , 0 , tocolor ( 255 , 255 , 255 , a ), false )
end
if info then
dxDrawText ( info , screenW * 0.4406 , screenH * 0.2880 , screenW * 0.5766 , screenH * 0.3269 , tocolor ( 255 , 255 , 255 , a ), 1.00 , "default" , "center" , "center" , false , false , false , false , false )
else
dxDrawText ( "Kliknij k??ko obok wybranego przez Ciebie spawnu" , screenW * 0.4406 , screenH * 0.2880 , screenW * 0.5766 , screenH * 0.3269 , tocolor ( 255 , 255 , 255 , a ), 1.00 , font123 , "center" , "center" , false , false , false , false , false )
end
if not isMouseIn123 ( screenW * 0.4297 , screenH * 0.6093 , screenW * 0.1365 , screenH * 0.0398 ) then
dxDrawImage ( screenW * 0.4297 , screenH * 0.6093 , screenW * 0.1365 , screenH * 0.0398 , ":im-logowanie/misc/button.png" , 0 , 0 , 0 , tocolor ( 255 , 255 , 255 , a ), false )
dxDrawText ( "Wybierz" , screenW * 0.4177 , screenH * 0.6176 , screenW * 0.5745 , screenH * 0.6444 , tocolor ( 255 , 255 , 255 , a ), 1.00 , font12 , "center" , "center" , false , false , false , false , false )
else
dxDrawImage ( screenW * 0.4297 , screenH * 0.6093 , screenW * 0.1365 , screenH * 0.0398 , ":im-logowanie/misc/button.png" , 0 , 0 , 0 , tocolor ( 255 , 255 , 255 , a ), false )
dxDrawText ( "Wybierz" , screenW * 0.4177 , screenH * 0.6176 , screenW * 0.5745 , screenH * 0.6444 , tocolor ( 16 , 114 , 211 , a ), 1.00 , font12 , "center" , "center" , false , false , false , false , false )
end
end
addEventHandler ( "onClientClick" , root , function( btn , state )
if getElementData ( localPlayer , "player:online" ) then return end
if getElementData ( localPlayer , "panel:logowania" ) then return end
if btn == "left" and state == "down" then
if isMouseIn123 ( screenW * 0.3943 , screenH * 0.3667 , screenW * 0.0240 , screenH * 0.0370 ) then
data . tick = getTickCount ()+ 1000
choosed = 1 end
if isMouseIn123 ( screenW * 0.3943 , screenH * 0.4426 , screenW * 0.0240 , screenH * 0.0370 ) then choosed = 2 end
if isMouseIn123 ( screenW * 0.3943 , screenH * 0.5176 , screenW * 0.0240 , screenH * 0.0370 ) then choosed = 3
end
if isMouseIn123 ( screenW * 0.4297 , screenH * 0.6093 , screenW * 0.1365 , screenH * 0.0398 ) and choosed == 1 then -- sf SPAWN
setElementData ( localPlayer , "player:spawn" ,{ 1654.12 ,- 1661.48 , 22.52 })
closeZones ()
end
if isMouseIn123 ( screenW * 0.4297 , screenH * 0.6093 , screenW * 0.1365 , screenH * 0.0398 ) and choosed == 2 then -- przecho SF
setElementData ( localPlayer , "player:spawn" ,{ 760.42 ,- 1361.90 , 13.52 + 0.1 })
closeZones ()
end
if isMouseIn123 ( screenW * 0.4297 , screenH * 0.6093 , screenW * 0.1365 , screenH * 0.0398 ) and choosed == 3 then -- dom
local domek = getElementData ( localPlayer , "player:house" )
if not domek then
setElementData ( localPlayer , "player:spawn" ,{ 1654.12 ,- 1661.48 , 22.52 + 0.1 })
outputChatBox ( "* Nie posiadasz domku, lub straci? wa?no??." )
closeZones ()
end
end
if isMouseIn123 ( screenW * 0.4297 , screenH * 0.6093 , screenW * 0.1365 , screenH * 0.0398 ) and choosed == 0 then -- nic
info = "Najpierw wybierz spawn!"
return
end
--[[if isMouseIn123 ( screenW * 0.4089 , screenH * 0.5370 , screenW * 0.1979 , screenH * 0.0306 ) and data . showed then -- LV
setElementData ( localPlayer , "player:spawn" ,{ 2013.32 , 1246.07 , 10.82 + 0.1 })
closeZones ()
end
if isMouseIn123 ( screenW * 0.4089 , screenH * 0.5981 , screenW * 0.1979 , screenH * 0.0306 ) and data . showed then
local domek = getElementData ( localPlayer , "player:house" )
if not domek then
setElementData ( localPlayer , "player:spawn" ,{ 389.59 , - 1524.33 , 32.27 + 0.1 })
outputChatBox ( "* Nie posiadasz domku, lub straci? wa?no??." )
end ]]--
end
end )
function closeZones ()
showChat ( true )
showCursor ( false )
fadeCamera ( false )
setElementAlpha ( localPlayer , 255 )
-- setElementData ( localPlayer , "player:logged" )
stopSound ( data . misc )
showPlayerHudComponent ( "radar" , false )
showPlayerHudComponent ( "crosshair" , false )
showPlayerHudComponent ( "weapon" , false )
showPlayerHudComponent ( "radar" , true )
showPlayerHudComponent ( "health" , false )
showPlayerHudComponent ( "breath" , false )
-- showPlayerHudComponent ( "tab" , false )
showPlayerHudComponent ( "clock" , false )
showPlayerHudComponent ( "ammo" , false )
data . showed = false
-- Usuwamy elementy
triggerServerEvent ( "core:spawnPlayer" , localPlayer )
setTimer ( triggerEvent , 250 , 1 , "gui:start" , localPlayer )
removeEventHandler ( "onClientRender" , root , renderZoneBox )
setElementData ( localPlayer , "zalogowany" , true )
end
function showZones ( misc )
data . misc = misc
data . showed = true
showChat ( false )
showPlayerHudComponent ( "all" , false )
guiSetInputMode ( "no_binds_when_editing" )
addEventHandler ( "onClientRender" , root , renderZoneBox )
animate ( 0 , 255 , "Linear" , 1000 , function( value ) a = value end )
end
[ Dodano : 2020-05-05, 19:47 ]
za? jak wgra?em inny panel logowania to jak klikn??em by mnie zrespi?o w domu to zrespi?o mnie w innych kordach ni? blip domu
[ Dodano : 2020-05-05, 20:03 ]
teraz wy?wietla mi taki b??d: https://imgur.com/a/0VFZCYs
[ Dodano : 2020-05-05, 20:04 ]
B??d ten dotyczy tego:
addEvent ( "SprawdzDom" , true )
function SprawdzDom ( gracz )
local dbdomy = exports [ "pystories-db" ]: dbGet ( "SELECT d.id,d.lokator1,d.lokator2,d.lokator3,d.descr,d.vwi,d.drzwi,d.punkt_wyjscia,d.interiorid,d.ownerid,d.zamkniety,d.koszt,d.paidTo,datediff(d.paidTo,now()) paidTo_dni FROM lss_domy d LEFT JOIN pystories_users c ON c.id=d.ownerid AND d.ownerid IS NOT NULL;" )
for __ , v in ipairs ( dbdomy ) do
local uid = tonumber ( getElementData ( gracz , "player:sid" ))
local r = v . ownerid
v . drzwi = split ( v . drzwi , "," )
for ii , vv in ipairs ( v . drzwi ) do v . drzwi [ ii ]= tonumber ( vv ) end
if r then if r == uid then
setElementData ( gracz , "player:house" , true )
tak =({ v . drzwi [ 1 ], v . drzwi [ 2 ], v . drzwi [ 3 ]})
setElementData ( gracz , "player:spawn" , tak )
end end
end
for __ , v in ipairs ( dbdomy ) do
local uid = tonumber ( getElementData ( gracz , "player:sid" ))
v . drzwi = split ( v . drzwi , "," )
for ii , vv in ipairs ( v . drzwi ) do v . drzwi [ ii ]= tonumber ( vv ) end
setElementData ( gracz , "player:house" , true )
tak =({ v . drzwi [ 1 ], v . drzwi [ 2 ], v . drzwi [ 3 ]})
setElementData ( gracz , "player:spawn" , tak )
end
end
addEventHandler ( "SprawdzDom" , root , SprawdzDom )
a dok?adniej tej linijki: for ii,vv in ipairs(v.drzwi) do v.drzwi[ii]=tonumber(vv) end
[ Dodano : 2020-05-05, 20:45 ]
u mnie tak wygl?da funkcja na respienie w domu:
if isMouseIn123 ( screenW * 0.4297 , screenH * 0.6093 , screenW * 0.1365 , screenH * 0.0398 ) and choosed == 3 then -- dom
local domek = getElementData ( localPlayer , "player:house" )
outputChatBox ( "test" )
if not domek then
setElementData ( localPlayer , "player:spawn" ,{ 1654.12 ,- 1661.48 , 22.52 + 0.1 })
outputChatBox ( "* Nie posiadasz domku, lub straci? wa?no??." )
closeZones ()
end
end
[ Dodano : 2020-05-06, 07:34 ]
Dok?adnie chodzi o t? funkcj?
if isMouseIn123 ( screenW * 0.4297 , screenH * 0.6093 , screenW * 0.1365 , screenH * 0.0398 ) and choosed == 3 then -- dom
local domek = getElementData ( localPlayer , "player:house" )
outputChatBox ( "test" )
if not domek then
setElementData ( localPlayer , "player:spawn" ,{ 1654.12 ,- 1661.48 , 22.52 + 0.1 })
outputChatBox ( "* Nie posiadasz domku, lub straci? wa?no??." )
closeZones ()
end
end gdy klikam guzik to nic si? nie dzieje poza wy?wietleniem napisu TEST
Tagi: wybór :: spawnu
Anonymous
Na forum: 245 dni
Posty: 1
Anonymous Koniecznie zajrzyj na: