szeroki
BlueRP.pl Zapraszam GTA5
Wiek: 36 Na forum: 3876 dni Posty: 104
Piwa : 9
server.lua
addEvent ( "Logowanie:rozpocznij" , true )
addEventHandler ( "Logowanie:rozpocznij" , root , function ( login , haslo )
local q = exports [ "fr-core" ]: wykonajKwerende ( "SELECT * FROM FR_Accounts WHERE Login = ?" , login )
if #q == 0 then
return triggerClientEvent ( "Logowanie:blad" , source , "Konto nie istnieje w bazie danych" )
end
for _ , v in pairs ( q ) do
if v . haslo ~= haslo then
return triggerClientEvent ( "Logowanie:blad" , source , "Has?o do konta '" .. login .. "' jest b??dne" )
end
end
local konto = getAccount ( login , haslo )
if konto == false then
local account = addAccount ( tostring ( login ), tostring ( haslo ) )
for i = 0 , 5 do
outputChatBox ( " " , root )
end
else
local account = logIn ( source , konto , haslo )
end
triggerClientEvent ( "Logowanie:zakoncz" , source )
for i = 0 , 10 do
outputChatBox ( " " , source )
end
for _ , v in pairs ( q ) do
if v . admin == 1 then
setElementData ( source , "ranga" , "Admin" )
ranga = "#FF0000Administrator"
elseif v . moderator == 1 then
setElementData ( source , "ranga" , "Mod" )
ranga = "#008000Moderator"
elseif v . admin == 0 and v . moderator == 0 then
setElementData ( source , "ranga" , "Gracz" )
ranga = "#FFFFFFGracz"
end
setElementData ( source , "uid" , v [ "UID" ] )
end
outputChatBox ( "#FF00FFPomy?lnie zalogowano jako " .. ranga , source , 0 , 255 , 0 , true )
setPlayerName ( source , login )
setPedWalkingStyle ( source , 118 )
toggleControl ( source , "fire" , false )
toggleControl ( source , "aim_weapon" , false )
setElementData ( source , "zalogowany" , true )
local h = getAccountData ( getPlayerAccount ( source ), "h" ) or 0
local m = getAccountData ( getPlayerAccount ( source ), "m" ) or 0
local s = getAccountData ( getPlayerAccount ( source ), "s" ) or 0
setAccountData ( getPlayerAccount ( source ), "h" , h )
setAccountData ( getPlayerAccount ( source ), "m" , m )
setAccountData ( getPlayerAccount ( source ), "s" , s )
end )
local function getUID ()
local u = exports [ "fr-core" ]: wykonajKwerende ( "SELECT * FROM FR_Accounts" )
for k , _ in ipairs ( u ) do
liczba = k
end
if liczba == 0 or not liczba then
return false
end
return liczba
end
addEvent ( "Rejestracja:rozpocznij" , true )
addEventHandler ( "Rejestracja:rozpocznij" , root , function ( login , haslo , haslo2 )
local u = exports [ "fr-core" ]: wykonajKwerende ( "SELECT * FROM FR_Accounts WHERE Login = ?" , login )
if #u == 1 then
return triggerClientEvent ( "Logowanie:blad" , source , "Konto '" .. login .. "' ju? istnieje w bazie danych" )
end
local uid = getUID ()
if not uid then
uid = 1
elseif uid then
uid = uid + 1
end
local u = exports [ "fr-core" ]: wykonajKwerende ( "INSERT INTO FR_Accounts ( Login, haslo, UID, admin, moderator ) VALUES ( ?,?,?,?,? )" , login , haslo , uid , "0" , "0" )
triggerClientEvent ( "Rejestracja:zakoncz" , source )
uid = 0
end )
addEventHandler ( "onPlayerJoin" , root , function ()
spawnPlayer ( source , - 2620.01440 , 2262.51392 , 8.16689 )
fadeCamera ( source , true )
end )
a to
client.lua
mojeW , mojeH = 640 , 480
sW , sH = guiGetScreenSize ()
w , h = ( sW / mojeW ), ( sH / mojeH )
button = {}
logowanie = {}
login = {}
okno = {}
rejestracja = {}
local font = guiCreateFont ( "RobotoSlab-Bold.ttf" , 10 )
-- okno g ?? wne
okno . glowne = guiCreateGridList ( 71 * w , 0 * h , 149 * w , 480 * h , false )
guiSetAlpha ( okno . glowne , 0.91 )
guiSetVisible ( okno . glowne , false )
button . logowanie = guiCreateButton ( 16 * w , 199 * h , 116 * w , 51 * h , "Panel\nlogowania" , false , okno . glowne )
button . rejestracja = guiCreateButton ( 16 * w , 326 * h , 116 * w , 51 * h , "Panel\nrejestracji" , false , okno . glowne )
guiSetFont ( button . logowanie , font )
guiSetFont ( button . rejestracja , font )
informacja = guiCreateLabel ( 269 * w , 34 * h , 327 * w , 25 * h , "" , false )
guiSetFont ( informacja , "default-bold-small" )
guiLabelSetHorizontalAlign ( informacja , "center" , false )
guiLabelSetVerticalAlign ( informacja , "center" )
guiLabelSetColor ( informacja , 255 , 0 , 0 )
-- okno logowania
okno . logowanie = guiCreateGridList ( 269 * w , 169 * h , 266 * w , 214 * h , false )
guiSetAlpha ( okno . logowanie , 0.80 )
guiSetVisible ( okno . logowanie , false )
label = guiCreateLabel ( 30 * w , 32 * h , 76 * w , 23 * h , "Login :" , false , okno . logowanie )
guiSetFont ( label , font )
guiLabelSetHorizontalAlign ( label , "center" , false )
guiLabelSetVerticalAlign ( label , "center" )
logowanie [ 1 ] = guiCreateEdit ( 47 * w , 61 * h , 168 * w , 23 * h , "" , false , okno . logowanie )
guiSetFont ( logowanie [ 1 ], font )
label2 = guiCreateLabel ( 30 * w , 94 * h , 76 * w , 23 * h , "Has?o :" , false , okno . logowanie )
guiSetFont ( label2 , font )
guiLabelSetHorizontalAlign ( label2 , "center" , false )
guiLabelSetVerticalAlign ( label2 , "center" )
logowanie [ 2 ] = guiCreateEdit ( 47 * w , 122 * h , 168 * w , 23 * h , "" , false , okno . logowanie )
guiSetFont ( logowanie [ 2 ], font )
guiEditSetMasked ( logowanie [ 2 ], true )
login . zaloguj = guiCreateButton ( 52 * w , 162 * h , 163 * w , 37 * h , "Zaloguj na posta?" , false , okno . logowanie )
guiSetFont ( login . zaloguj , font )
-- okno rejestracji
okno . rejestracja = guiCreateGridList ( 277 * w , 127 * h , 264 * w , 283 * h , false )
guiSetAlpha ( okno . rejestracja , 0.88 )
guiSetVisible ( okno . rejestracja , false )
label3 = guiCreateLabel ( 10 * w , 22 * h , 123 * w , 22 * h , "Login :" , false , okno . rejestracja )
guiSetFont ( label3 , font )
guiLabelSetHorizontalAlign ( label3 , "center" , false )
guiLabelSetVerticalAlign ( label3 , "center" )
rejestracja [ 3 ] = guiCreateEdit ( 52 * w , 52 * h , 158 * w , 22 * h , "" , false , okno . rejestracja )
guiSetFont ( rejestracja [ 3 ], font )
label4 = guiCreateLabel ( 10 * w , 84 * h , 123 * w , 22 * h , "Has?o :" , false , okno . rejestracja )
guiSetFont ( label4 , font )
guiLabelSetHorizontalAlign ( label4 , "center" , false )
guiLabelSetVerticalAlign ( label4 , "center" )
rejestracja [ 4 ] = guiCreateEdit ( 52 * w , 112 * h , 158 * w , 22 * h , "" , false , okno . rejestracja )
guiSetFont ( rejestracja [ 4 ], font )
label5 = guiCreateLabel ( 42 * w , 144 * h , 123 * w , 22 * h , "Potwierd? has?o :" , false , okno . rejestracja )
guiLabelSetHorizontalAlign ( label5 , "center" , false )
guiSetFont ( label5 , font )
guiLabelSetVerticalAlign ( label5 , "center" )
rejestracja [ 5 ] = guiCreateEdit ( 52 * w , 176 * h , 158 * w , 22 * h , "" , false , okno . rejestracja )
guiSetFont ( rejestracja [ 5 ], font )
rejestracja . rejestruj = guiCreateButton ( 32 * w , 229 * h , 196 * w , 39 * h , "Zarejestruj posta?" , false , okno . rejestracja )
guiSetFont ( rejestracja . rejestruj , font )
local function drawImageRejestracja ()
dxDrawImage ( 224 * w , 338 * h , 35 * w , 31 * h , "images/strzalka.png" , 0 , 0 , 0 , tocolor ( 255 , 255 , 255 , 255 ), true )
end
local function drawImageLogowanie ()
dxDrawImage ( 224 * w , 211 * h , 35 * w , 31 * h , "images/strzalka.png" , 0 , 0 , 0 , tocolor ( 255 , 255 , 255 , 255 ), true )
end
local function drawLogo ()
dxDrawText ( "Blue-Life-RPG" , 19 * w , 93 * h , 278 * w , 138 * h , tocolor ( 0 , 0 , 0 , 255 ), 1.10 * w , "pricedown" , "center" , "center" , false , false , true , false , false )
dxDrawText ( "Blue-Life-RPG" , 19 * w , 91 * h , 278 * w , 136 * h , tocolor ( 0 , 0 , 0 , 255 ), 1.10 * w , "pricedown" , "center" , "center" , false , false , true , false , false )
dxDrawText ( "Blue-Life-RPG" , 17 * w , 93 * h , 276 * w , 138 * h , tocolor ( 0 , 0 , 0 , 255 ), 1.10 * w , "pricedown" , "center" , "center" , false , false , true , false , false )
dxDrawText ( "Blue-Life-RPG" , 17 * w , 91 * h , 276 * w , 136 * h , tocolor ( 0 , 0 , 0 , 255 ), 1.10 * w , "pricedown" , "center" , "center" , false , false , true , false , false )
dxDrawText ( "Blue-Life-RPG" , 18 * w , 92 * h , 277 * w , 137 * h , tocolor ( 255 , 255 , 255 , 255 ), 1.10 * w , "pricedown" , "center" , "center" , false , false , true , false , false )
end
addEventHandler ( "onClientResourceStart" , resourceRoot , function ()
guiSetVisible ( okno . glowne , true )
showCursor ( true )
addEventHandler ( "onClientRender" , root , drawLogo )
showPlayerHudComponent ( "all" , false )
showChat ( false )
smoothMoveCamera ( - 2277.73511 , 2306.43286 , 45.27243 , - 2331.82642 , 2315.02612 , 28.38352 , - 2566.84131 , 2343.00513 , 30.79271 , - 2627.19043 , 2342.30176 , 12.15888 , 60000 )
setElementData ( localPlayer , "blur" , true )
interSound ( 0 )
end )
local function openPanelLogin ()
if guiGetVisible ( okno . logowanie ) == false then
guiSetVisible ( okno . logowanie , true )
addEventHandler ( "onClientRender" , root , drawImageLogowanie )
else
guiSetVisible ( okno . logowanie , false )
removeEventHandler ( "onClientRender" , root , drawImageLogowanie )
end
if guiGetVisible ( okno . rejestracja ) == true then
guiSetVisible ( okno . rejestracja , false )
removeEventHandler ( "onClientRender" , root , drawImageRejestracja )
guiSetText ( rejestracja [ 3 ], "" )
guiSetText ( rejestracja [ 4 ], "" )
guiSetText ( rejestracja [ 5 ], "" )
end
end
local function openPanelRegister ()
if guiGetVisible ( okno . rejestracja ) == false then
guiSetVisible ( okno . rejestracja , true )
addEventHandler ( "onClientRender" , root , drawImageRejestracja )
else
guiSetVisible ( okno . rejestracja , false )
removeEventHandler ( "onClientRender" , root , drawImageRejestracja )
end
if guiGetVisible ( okno . logowanie ) == true then
guiSetVisible ( okno . logowanie , false )
removeEventHandler ( "onClientRender" , root , drawImageLogowanie )
guiSetText ( logowanie [ 1 ], "" )
guiSetText ( logowanie [ 2 ], "" )
end
end
addEventHandler ( "onClientGUIClick" , root , function ()
if source == button . logowanie then
openPanelLogin ()
sound = playSound ( "click.wav" , false )
setSoundVolume ( sound , 1 )
elseif source == button . rejestracja then
openPanelRegister ()
sound = playSound ( "click.wav" , false )
setSoundVolume ( sound , 1 )
elseif source == login . zaloguj then
local login = guiGetText ( logowanie [ 1 ] )
if login == "" then return guiSetText ( informacja , "Wpisz login!" ) end
local haslo = guiGetText ( logowanie [ 2 ] )
if haslo == "" then guiSetText ( informacja , "Wpisz has?o!" ) return end
triggerServerEvent ( "Logowanie:rozpocznij" , localPlayer , login , haslo )
elseif source == rejestracja . rejestruj then
-- playSoundFrontEnd ( 44 )
local login1 = guiGetText ( rejestracja [ 3 ] )
if login1 == "" then return guiSetText ( informacja , "Wpisz login!" ) end
local haslo1 = guiGetText ( rejestracja [ 4 ] )
if haslo1 == "" then return guiSetText ( informacja , "Wpisz has?o!" ) end
local haslo2 = guiGetText ( rejestracja [ 5 ] )
if haslo2 == "" then return guiSetText ( informacja , "Potwierd? has?o!" ) end
if haslo1 ~= haslo2 then return guiSetText ( informacja , "Wpisa?e? 2 r??ne has?a!" ) end
triggerServerEvent ( "Rejestracja:rozpocznij" , localPlayer , login1 , haslo1 , haslo2 )
end
end )
addEvent ( "Logowanie:blad" , true )
addEventHandler ( "Logowanie:blad" , root , function ( txt , type )
if source == localPlayer then
guiSetText ( informacja , txt )
end
if not isTimer ( timer ) then
timer = setTimer ( guiSetText , 5000 , 1 , informacja , "" )
end
sound = playSound ( "blad.wav" , false )
setSoundVolume ( sound , 1 )
end )
addEvent ( "Logowanie:zakoncz" , true )
addEventHandler ( "Logowanie:zakoncz" , root , function ()
if source == localPlayer then
guiSetVisible ( okno . glowne , false )
guiSetVisible ( okno . logowanie , false )
showCursor ( false )
showChat ( true )
showPlayerHudComponent ( "all" , true )
fadeCamera ( false )
setTimer ( fadeCamera , 3000 , 1 , true )
removeEventHandler ( "onClientRender" , root , drawImageLogowanie )
removeEventHandler ( "onClientRender" , root , drawLogo )
setTimer ( setCameraTarget , 2000 , 1 , source )
-- setTimer ( removeCamHandler , 2000 , 1 )
guiSetVisible ( informacja , false )
setElementData ( source , "blur" , false )
playSound ( "alarm.wav" , false )
exports . spawn : openSpawn ( source )
-- exports [ "fr-characters" ]: openCharactersList ( source )
end
end )
addEvent ( "Rejestracja:zakoncz" , true )
addEventHandler ( "Rejestracja:zakoncz" , root , function ()
if source == localPlayer then
openPanelLogin ()
sound = playSound ( "complete.wav" , false )
setSoundVolume ( sound , 1 )
end
end )
local sm = {}
sm . moov = 0
sm . object1 , sm . object2 = nil , nil
function removeCamHandler ()
if( sm . moov == 1 ) then
sm . moov = 0
end
end
function camRender ()
if ( sm . moov == 1 ) then
local x1 , y1 , z1 = getElementPosition ( sm . object1 )
local x2 , y2 , z2 = getElementPosition ( sm . object2 )
setCameraMatrix ( x1 , y1 , z1 , x2 , y2 , z2 )
end
end
addEventHandler ( "onClientPreRender" , root , camRender )
function smoothMoveCamera ( x1 , y1 , z1 , x1t , y1t , z1t , x2 , y2 , z2 , x2t , y2t , z2t , time )
if( sm . moov == 1 ) then return false end
sm . object1 = createObject ( 1337 , x1 , y1 , z1 )
sm . object2 = createObject ( 1337 , x1t , y1t , z1t )
setElementAlpha ( sm . object1 , 0 )
setElementAlpha ( sm . object2 , 0 )
setObjectScale ( sm . object1 , 0.01 )
setObjectScale ( sm . object2 , 0.01 )
moveObject ( sm . object1 , time , x2 , y2 , z2 , 0 , 0 , 0 , "Linear" )
moveObject ( sm . object2 , time , x2t , y2t , z2t , 0 , 0 , 0 , "OutInBounce" )
sm . moov = 1
setTimer ( removeCamHandler , time , 1 )
setTimer ( destroyElement , time , 1 , sm . object1 )
setTimer ( destroyElement , time , 1 , sm . object2 )
return true
end
function stopS ()
timer = setTimer ( wycisz , 200 , 0 )
end
function interSound ( type )
if type == 0 then
muzyka = playSound ( "muzyka.mp3" )
elseif type == 1 then
stopSound ( muzyka )
end
end
function wycisz ()
if getSoundVolume ( muzyka ) <= 0 then
stopSound ( muzyka )
killTimer ( timer )
return end
volume = tonumber ( getSoundVolume ( muzyka ) )
volume = volume - 0.05
setSoundVolume ( muzyka , volume )
end
Podpis
**⚡┃CyanRP┃⚡ **
**💻┃*Adres IP:*** *wyspa.cyanrp.pl*
**📱┃*Link do serwera discord:*** *https://discord.gg/MJKqHksanU