NoNamik
Wiek: 35 Na forum: 2185 dni Posty: 289
Nick w MP: JestemNoNamem
Piwa : 374
Witam mam skrypt na przebieralnie i jak sie przebiore pojde na frakcje zmienie skina i klikne w dowolne miejsce myszka to ten skin sie zmienia na ten co mialem ustawiony jak to naprawic?
c.lua
local sx , sy = guiGetScreenSize ()
-- Wyb ? r skina
local m3 = createMarker ( 204.36 , - 160.19 , 1000.52 - 1 , "cylinder" , 1.8 , 0 , 122 , 255 , 255 )
setElementInterior ( m3 , 14 )
setElementDimension ( m3 , 3 )
setElementData ( m3 , 'typ' , 'ubranko' )
local ped = createPed ( 12 , 204.40 , - 157.83 , 1000.52 , 180 )
setElementInterior ( ped , 14 )
setElementDimension ( ped , 3 )
-- 201 , 277 ,
local blur = exports [ 'blur' ]
mojeW , mojeH = 1280 , 1024
sW , sH = guiGetScreenSize ()
w , h = ( sW / mojeW ), ( sH / mojeH )
przeb = false
function mysz ( 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
-- Ustawienia
local skiny_premium = { 145 , 167 , 203 , 204 , 205 , 32 , 256 , 257 , 26 , 38 , 39 , 45 , 81 , 83 , 84 , 87 }
local skiny_meskie = { 0 , 1 , 6 , 7 , 17 , 19 , 20 , 21 , 23 , 24 , 25 , 28 , 29 , 33 , 34 , 36 , 43 , 44 , 46 , 47 , 49 , 52 , 58 , 59 , 61 , 66 , 72 , 78 , 79 , 82 , 95 , 96 , 99 , 100 , 102 , 103 , 104 , 105 , 106 , 107 , 108 , 109 , 110 , 111 , 112 , 113 , 114 , 115 , 116 , 117 , 120 , 122 , 123 , 124 , 133 , 134 , 136 , 137 , 142 , 143 , 144 , 146 , 147 , 155 , 158 , 160 , 163 , 164 , 170 , 173 , 174 , 175 , 176 , 177 , 179 , 184 , 185 , 186 , 187 , 188 , 189 , 202 , 210 , 217 , 223 , 228 , 229 , 236 , 240 , 241 , 242 , 247 , 248 , 249 , 250 , 252 , 253 , 255 , 260 , 262 , 269 , 270 , 271 , 272 , 290 , 291 , 292 , 293 , 294 , 295 , 296 , 297 , 299 , 300 , 303 , 306 , 307 , 308 , 311 }
local skiny_kobiece = { 12 , 13 , 31 , 40 , 41 , 53 , 55 , 88 , 91 , 93 , 135 , 138 , 139 , 140 , 148 , 150 , 169 , 192 , 193 , 197 , 198 , 211 , 216 , 219 , 233 }
-- GUI
local sp = {}
--[[ sp . pr_grid = guiCreateWindow ( 990 / 1280 * sx , 200 / 720 * sy , 270 / 1280 * sx , 447 / 720 * sy , "Wybierz skin" , false )
guiWindowSetMovable ( sp . pr_grid , false )
guiWindowSetSizable ( sp . pr_grid , true )
guiSetVisible ( sp . pr_grid , false )
guiSetAlpha ( sp . pr_grid , 0.9 )--]]
sp . pr_grid = guiCreateGridList ( 977 * w , 613 * h , 257 * w , 305 * h , false )
guiGridListSetSortingEnabled ( sp . pr_grid , false )
guiGridListAddColumn ( sp . pr_grid , "Wybierz odpowiedni skin" , 0.6 )
guiSetVisible ( sp . pr_grid , false )
guiSetAlpha ( sp . pr_grid , 0.8 )
guiSetFont ( sp . pr_grid , "default-bold-small" )
-- Ustawienia2
function przebieralniaStart ()
guiGridListClear ( sp . pr_grid )
local row = guiGridListAddRow ( sp . pr_grid )
guiGridListSetItemText ( sp . pr_grid , row , 1 , "Skiny m?skie" , true , false )
for i , v in ipairs ( skiny_meskie ) do
local row = guiGridListAddRow ( sp . pr_grid )
guiGridListSetItemText ( sp . pr_grid , row , 1 , v , false , false )
end
local row = guiGridListAddRow ( sp . pr_grid )
guiGridListSetItemText ( sp . pr_grid , row , 1 , "Skiny damskie" , true , false )
for i , v in ipairs ( skiny_kobiece ) do
local row = guiGridListAddRow ( sp . pr_grid )
guiGridListSetItemText ( sp . pr_grid , row , 1 , v , false , false )
end
local row = guiGridListAddRow ( sp . pr_grid )
guiGridListSetItemText ( sp . pr_grid , row , 1 , "Skiny premium" , true , false )
for i , v in ipairs ( skiny_premium ) do
local row = guiGridListAddRow ( sp . pr_grid )
guiGridListSetItemText ( sp . pr_grid , row , 1 , v , false , false )
guiGridListSetItemData ( sp . pr_grid , row , 1 , "player:premium" )
guiGridListSetItemColor ( sp . pr_grid , row , 1 , 255 , 255 , 0 )
end
end
-- Sprawdzanie
addEventHandler ( "onClientClick" , root , function( btn , state )
if przeb == true then
if mysz ( 1018 * w , 950 * h , 182 * w , 48 * h ) then
showCursor ( false )
guiSetVisible ( sp . pr_grid , false )
removeEventHandler ( "onClientRender" , root , gui )
przeb = false
end
end
if btn == "left" and state == "down" then
local selectedRow , selectedCol = guiGridListGetSelectedItem ( sp . pr_grid )
if not selectedRow or selectedCol ~= 1 then return end
local premium = guiGridListGetItemData ( sp . pr_grid , selectedRow , selectedCol )
if premium and getElementData ( localPlayer , "premium:level" ) ~= 1 then
outputChatBox ( "* Ten skin jest dla graczy Premium." )
return
end
local model = guiGridListGetItemText ( sp . pr_grid , selectedRow , selectedCol )
if not model then return end
triggerServerEvent ( "changeSkin" , localPlayer , tonumber ( model ))
end
end )
-- Ustawienia 2
addEventHandler ( "onClientMarkerHit" , m3 , function( el , md )
if el ~= localPlayer then return end
if guiGetVisible ( sp . pr_grid ) == false then
--[[if getPlayerName ( el ) ~= "Split" then
outputChatBox ( "* Przebieralnia w trakcie poprawek" , el )
return
end ]]
przebieralniaStart ()
showCursor ( true )
guiSetVisible ( sp . pr_grid , true )
addEventHandler ( "onClientRender" , root , gui )
przeb = true
end
end )
-- Ustawienia 3
--[[ addEventHandler ( "onClientMarkerLeave" , m3 , function( el , md )
if el ~= localPlayer then return end
if guiGetVisible ( sp . pr_grid ) == true then
showCursor ( false )
guiSetVisible ( sp . pr_grid , false )
end
end )--]]
function gui ()
dxDrawLine ( 939 * w - 1 , 556 * h - 1 , 939 * w - 1 , 1014 * h , tocolor ( 0 , 0 , 0 , 255 ), 1 , false )
dxDrawLine ( 1270 * w , 556 * h - 1 , 939 * w - 1 , 556 * h - 1 , tocolor ( 0 , 0 , 0 , 255 ), 1 , false )
dxDrawLine ( 939 * w - 1 , 1014 * h , 1270 * w , 1014 * h , tocolor ( 0 , 0 , 0 , 255 ), 1 , false )
dxDrawLine ( 1270 * w , 1014 * h , 1270 * w , 556 * h - 1 , tocolor ( 0 , 0 , 0 , 255 ), 1 , false )
blur : dxDrawBluredRectangle ( 939 * w , 556 * h , 331 * w , 458 * h , tocolor ( 175 , 175 , 175 , 255 ), false )
if mysz ( 1018 * w , 950 * h , 182 * w , 48 * h ) then
dxDrawLine ( 1018 * w - 1 , 950 * h - 1 , 1018 * w - 1 , 998 * h , tocolor ( 255 , 255 , 255 , 255 ), 1 , false )
dxDrawLine ( 1200 * w , 950 * h - 1 , 1018 * w - 1 , 950 * h - 1 , tocolor ( 255 , 255 , 255 , 255 ), 1 , false )
dxDrawLine ( 1018 * w - 1 , 998 * h , 1200 * w , 998 * h , tocolor ( 255 , 255 , 255 , 255 ), 1 , false )
dxDrawLine ( 1200 * w , 998 * h , 1200 * w , 950 * h - 1 , tocolor ( 255 , 255 , 255 , 255 ), 1 , false )
dxDrawRectangle ( 1018 * w , 950 * h , 182 * w , 48 * h , tocolor ( 255 , 255 , 255 , 150 ), false )
else
dxDrawLine ( 1018 * w - 1 , 950 * h - 1 , 1018 * w - 1 , 998 * h , tocolor ( 255 , 255 , 255 , 255 ), 1 , false )
dxDrawLine ( 1200 * w , 950 * h - 1 , 1018 * w - 1 , 950 * h - 1 , tocolor ( 255 , 255 , 255 , 255 ), 1 , false )
dxDrawLine ( 1018 * w - 1 , 998 * h , 1200 * w , 998 * h , tocolor ( 255 , 255 , 255 , 255 ), 1 , false )
dxDrawLine ( 1200 * w , 998 * h , 1200 * w , 950 * h - 1 , tocolor ( 255 , 255 , 255 , 255 ), 1 , false )
dxDrawRectangle ( 1018 * w , 950 * h , 182 * w , 48 * h , tocolor ( 255 , 255 , 255 , 95 ), false )
end
dxDrawText ( "Przebieralnia" , 993 * w , 566 * h , 1213 * w , 658 * h , tocolor ( 255 , 255 , 255 , 255 ), 1.00 , "default-bold" , "center" , "top" , false , false , false , false , false )
dxDrawLine ( 1046 * w , 586 * h , 1158 * w , 586 * h , tocolor ( 255 , 255 , 255 , 255 ), 1 , false )
dxDrawText ( "Anuluj" , 1018 * w + 1 , 950 * h + 1 , 1200 * w + 1 , 998 * h + 1 , tocolor ( 0 , 0 , 0 , 255 ), 1.00 , "default-bold" , "center" , "center" , false , false , false , false , false )
dxDrawText ( "Anuluj" , 1018 * w , 950 * h , 1200 * w , 998 * h , tocolor ( 255 , 255 , 255 , 255 ), 1.00 , "default-bold" , "center" , "center" , false , false , false , false , false )
end
s.lua
-- Przebieralnia Fort Carson
local m = createMarker ( 1396.95 , - 1570.04 , 14.27 + 1 , "arrow" , 1.2 , 0 , 122 , 255 , 255 )
createBlipAttachedTo ( m , 45 )
-- local b = createBlipAttachedTo ( m , 45 , 2 , 255 , 0 , 0 , 255 , 0 , 475 )
setElementData ( m , 'typ' , 'drzwi' )
-- Wyj ? cie z przebieralni Fort Carson
local m2 = createMarker ( 204.36 , - 168.61 , 1000.52 + 0.8 , "arrow" , 1.2 , 0 , 122 , 255 , 255 )
setElementInterior ( m2 , 14 )
setElementDimension ( m2 , 3 )
setElementData ( m2 , 'typ' , 'drzwi' )
local text = createElement ( "text" )
setElementPosition ( text , 204.36 , - 168.61 , 1000.52 + 1 )
setElementData ( text , "name" , "Wyj?cie\nPrzebieralnia\nLos Santos" )
setElementInterior ( text , 14 )
setElementDimension ( text , 3 )
local text = createElement ( "text" )
setElementPosition ( text , 1396.95 , - 1570.04 , 14.27 + 0.8 )
setElementData ( text , "name" , "Wej?cie\nPrzebieralnia\nLos Santos" )
addEventHandler ( "onMarkerHit" , m , function( el , md )
if getElementType ( el ) ~= "player" then return end
if isPedInVehicle ( el ) then return end
fadeCamera ( el , false )
setElementFrozen ( el , true )
setTimer (function ()
triggerClientEvent ( el , "onClientAddNotification" , el , "Wszed?e?/a? do Przebieralnii." , 'info' , 255 , 255 , 255 , true )
-- outputChatBox ( "#007aff(ⓘ) #FFFFFFWszed?e?(a?) do Przebieralnii." , el , 255 , 255 , 255 , true )
setElementInterior ( el , 14 )
setElementDimension ( el , 3 )
setElementPosition ( el , 204.18 , - 165.04 , 1000.52 )
setElementFrozen ( el , false )
showPlayerHudComponent ( el , "radar" , false )
fadeCamera ( el , true )
end , 1500 , 1 )
end )
addEventHandler ( "onMarkerHit" , m2 , function( el , md )
if isPedInVehicle ( el ) then return end
fadeCamera ( el , false )
setElementFrozen ( el , true )
setTimer (function ()
triggerClientEvent ( el , "onClientAddNotification" , el , "Wyszed?e?/a? z Przebieralnii." , 'info' , 255 , 255 , 255 , true )
-- outputChatBox ( "#007aff(ⓘ) #FFFFFFWyszed?e?(a?) z Przebieralnii." , el , 255 , 255 , 255 , true )
setElementInterior ( el , 0 )
setElementDimension ( el , 0 )
setElementPosition ( el , 1398.29 , - 1575.11 , 14.25 )
setElementFrozen ( el , false )
showPlayerHudComponent ( el , "radar" , true )
fadeCamera ( el , true )
end , 1500 , 1 )
end )
-- Co ? innego
addEvent ( "changeSkin" , true )
addEventHandler ( "changeSkin" , root , function( model )
-- setElementModel ( source , model )
-- setElementData ( source , "gracz_ubranie" , model )
setElementModel ( source , model )
local uid = getElementData ( source , "player:sid" )
local query = exports [ "pystories-db" ]: dbSet ( "UPDATE pystories_users SET skin=? WHERE id=?" , model , uid )
setElementData ( source , "player:skin" , model )
end )