Jump to content

Snoowy

Members
  • Posts

    10
  • Joined

  • Last visited

Snoowy's Achievements

Member

Member (5/54)

0

Reputation

  1. Snoowy

    MySQL Serial

    Hy! Not working, please help me.. server.lua:12: 'in' expected near '('
  2. Snoowy

    MySQL Serial

    Hy! I started the easily script for today. The command essence the player write /getserial, get the player serial, search for MySQL data, account table, serial column, and if there are write ouputChatBox the yes, if not there are write the outputChatBox no. However command is not working, i write the command in chat, however only write yes. Please help me, and thank you for help! function serialgetme(player, command, serial) local pserial = getPlayerSerial(player) local seri = dbQuery(connection,"SELECT * FROM accounts WHERE serial = ?", pserial) if seri then outputChatBox("yes") else outputChatBox("no") end end addCommandHandler("getserial", serialgetme)
  3. Hello! I started making a account system, however, I missed the registration. How do I do it just to register once? Thank you for help! MySQL Script local connection = nil addEventHandler("onResourceStart",resourceRoot,function(resource) connection = dbConnect("mysql","dbname=ig_mta;host=localhost;port=3306;","root","martinka02") if connection then outputDebugString(getResourceName(resource) .. " : connected to database.") return true else outputDebugString(getResourceName(resource) .. " : Unable to connect with database. Please contact Developer.") return false end end ) function _Query( ... ) if connection then local query = dbQuery(connection, ... ) local result = dbPoll(query,-1) return result else return false end end function _QuerySingle(str,...) if connection then local result = _Query(str,...) if type(result) == 'table' then return result[1] end else return false end end function _Exec(str,...) if connection then local query = dbExec(connection,str,...) return query else return false end end Account System - Server Side addEvent("loginPlayer", true) function loginPlayer(player, username, password, serial) local check = exports.mta_connection:_QuerySingle("SELECT * FROM accounts WHERE username = ?",username) if check then local serial = getPlayerSerial(player) local checkPass = check.password local checkSerial = check.serial if ( checkSerial == serial ) then if (checkPass == password) then logIn(player,tostring(username),tostring(password)) outputDebugString("User is loggined!") triggerClientEvent(player,"showHide",getRootElement()) else exports["notices"]:addNotification(root,"Hibás felhasználónév/jelszó!",'error') end else exports["notices"]:addNotification(root,"Ez a felhasználó nem ehhez a számítógéphez van társítva!",'error') end else exports["notices"]:addNotification(root,"Hibás felhasználónév/jelszó!",'error') end end addEventHandler("loginPlayer", getRootElement(),loginPlayer) addEvent("registerPlayer", true) function registerPlayer(player, username, password, email, serial, ip, money) if ( checkSerial ~= serial ) then local account = getAccount(username) if account == false then local ip = getPlayerIP(player) local money = 100 exports.mta_connection:_Exec("INSERT INTO accounts(username,password,email,serial,ip,money) values (?,?,?,?,?,?)",username,password,email,serial,ip,money) local addAccount = addAccount(tostring(username), tostring(password)) if addAccount then exports["notices"]:addNotification(root,"A felhasználó sikeresen létrehozva!",'succes') else exports["notices"]:addNotification(root,"Hiba történt! Keress fel egy fejlesztőt a problémával kapcsolatban!",'error') end else exports["notices"]:addNotification(root,"Ez a felhasználónév már foglalt! Válassz másikat!",'error') end else exports["notices"]:addNotification(root,"Ehhez a számítógéphez van felhasználó társítva!",'error') end end addEventHandler("registerPlayer", getRootElement(), registerPlayer)
  4. Hy! I started the login panel. What should I do to adapt to any screen resolution? ( Not * and / ) dxDrawImage ( 1006, 0, 362, 90, 'panel.png') -- A kép kirajzolása
  5. Thank you, but I didn't think so. As it looks in a picture, as health decreases a hexagonal pixel to pixel shifts from left to right. This is i drawing to DxDrawLine hexagon: dxDrawLine(999+40, 78, 1079, 78, tocolor(217, 14, 14, 200), 1.7, false) -- Alja dxDrawLine(1039, 78, 1019, 45, tocolor(217, 14, 14, 200), 1.5, false) -- Bal alja dxDrawLine(1019, 45, 1040, 10, tocolor(217, 14, 14, 200), 1.5, false) -- Bal fent dxDrawLine(1039, 11, 1079, 11, tocolor(217, 14, 14, 200), 1.7, false) -- Teteje dxDrawLine(1078, 11, 1098, 45, tocolor(217, 14, 14, 200), 1.7, false) -- Jobb fent dxDrawLine(1098, 44, 1079, 78, tocolor(217, 14, 14, 200), 1.7, false) -- Jobb lent
  6. function dxDrawCircle( posX, posY, radius, width, angleAmount, startAngle, stopAngle, color, postGUI ) if ( type( posX ) ~= "number" ) or ( type( posY ) ~= "number" ) then return false end local function clamp( val, lower, upper ) if ( lower > upper ) then lower, upper = upper, lower end return math.max( lower, math.min( upper, val ) ) end radius = type( radius ) == "number" and radius or 50 width = type( width ) == "number" and width or 5 angleAmount = type( angleAmount ) == "number" and angleAmount or startAngle = clamp( type( startAngle ) == "number" and startAngle or 0, 0, 360 ) stopAngle = clamp( type( stopAngle ) == "number" and stopAngle or 360, 0, 360 ) color = color or tocolor( 255, 255, 255, 200 ) postGUI = type( postGUI ) == "boolean" and postGUI or false if ( stopAngle < startAngle ) then local tempAngle = stopAngle stopAngle = startAngle startAngle = tempAngle end for i = startAngle, stopAngle, angleAmount do local startX = math.cos( math.rad( i ) ) * ( radius - width ) local startY = math.sin( math.rad( i ) ) * ( radius - width ) local endX = math.cos( math.rad( i ) ) * ( radius + width ) local endY = math.sin( math.rad( i ) ) * ( radius + width ) dxDrawLine( startX + posX, startY + posY, endX + posX, endY + posY, color, width, postGUI ) end return true end What edited? addEventHandler( "onClientRender", root, function( ) -- We're starting to draw the circle at 0° which means that the first point of the arc is ( 200+50 | 200 ) -- Therefore the last point is ( 200 | 200+50 ). > Our arc is the "lower right" quarter of the circle. dxDrawCircle( 200, 200, 45, 5, 1, 0, 90 ) end )
  7. Thank you, it's not radar, health, armor, hunger etc. HUD, but thank you. IIYAMA, i have modified angleAmount for 45, but not working.
  8. Hy. Sorry, i dont know the dxcircle. What is edit the script? function dxDrawCircle( posX, posY, radius, width, angleAmount, startAngle, stopAngle, color, postGUI ) if ( type( posX ) ~= "number" ) or ( type( posY ) ~= "number" ) then return false end local function clamp( val, lower, upper ) if ( lower > upper ) then lower, upper = upper, lower end return math.max( lower, math.min( upper, val ) ) end radius = type( radius ) == "number" and radius or 50 width = type( width ) == "number" and width or 5 angleAmount = type( angleAmount ) == "number" and angleAmount or 1 startAngle = clamp( type( startAngle ) == "number" and startAngle or 0, 0, 360 ) stopAngle = clamp( type( stopAngle ) == "number" and stopAngle or 360, 0, 360 ) color = color or tocolor( 255, 255, 255, 200 ) postGUI = type( postGUI ) == "boolean" and postGUI or false if ( stopAngle < startAngle ) then local tempAngle = stopAngle stopAngle = startAngle startAngle = tempAngle end for i = startAngle, stopAngle, angleAmount do local startX = math.cos( math.rad( i ) ) * ( radius - width ) local startY = math.sin( math.rad( i ) ) * ( radius - width ) local endX = math.cos( math.rad( i ) ) * ( radius + width ) local endY = math.sin( math.rad( i ) ) * ( radius + width ) dxDrawLine( startX + posX, startY + posY, endX + posX, endY + posY, color, width, postGUI ) end return true end
  9. Hy! I'm started today the special HUD. The shape of HUD hexagon. How to create the hud? ( similar the circle hud, however not filled, just outline. ) I try the ImageSection, however not work. ( Similar the circle loading... ) MY TRY: ( Not working ) eX, eY = 1366, 768 -- Sjáat képernyőméret local x, y = guiGetScreenSize() -- Játékos képernyőméretének lekérése function dxdrawok() local health, armor = getElementHealth (localPlayer), getPedArmor(localPlayer) -- Élet lekérése showPlayerHudComponent("all", false) -- HUD kikapcsolása ( összes ) dxDrawImage ( 1006/eX*x, -2/eY*y, 362/eX*x, 90/eY*y, 'files/hud.png') -- A kép kirajzolása dxDrawImageSection(1017, 8, 85, 71*health/100, 0, 0, 85, 71*health/100, 'files/health.png') -- Élet karika kirajzolása dxDrawImageSection(1103, 8, 85, 71*armor/100, 0, 0, 85, 71*armor/100, 'files/armor.png') -- Élet karika kirajzolása dxDrawRectangle(1039, 76, 41, 2, tocolor(255, 255, 255, 255), false) end addEventHandler("onClientRender", root, dxdrawok)
  10. Hello! I started today new HUD. I would not normally, but hexagonal shape.. How is it possible to create this? ( I mean a hexagon, if health dwindle, hexagon too dwindle ). Thank you in advance! ( Sorry for bad Englis )
×
×
  • Create New...