Jump to content

Lorder

Members
  • Posts

    84
  • Joined

  • Last visited

Everything posted by Lorder

  1. Lorder

    Mysql Error

    I enter all the information correctly, but I get an error. local db local defaultJSON = toJSON({host = "127.0.0.1", port = "3306", usr = "root", passwd = "456654asd", dbname = "ucd"}) -- Load the credentials in from credentials.json local f = File("credentials.json") if (not f) then f = File.new("credentials.json") f:write(defaultJSON, true) -- Must select a prettyType after 1.6 (https://wiki.multitheftauto.com/wiki/ToJSON) f:flush() end f.pos = 0 local credentials = fromJSON(f:read(f.size)) f:close() local dbname = credentials.dbname local host = credentials.host local usr = credentials.usr local passwd = credentials.passwd local port = credentials.port db = Connection("mysql", "dbname="..dbname..";host="..host..";port="..port, usr, passwd) function returnConnection() if (db) then outputDebugString("Connection to the MySQL established") return end outputDebugString("Couldn't connect to MySQL") end addEventHandler("onResourceStart", resourceRoot, returnConnection) function getConnection() if (db) then return db end return false end
  2. I do not understand what the problem is Is there someone to help?
  3. I only need admin panel pls help me
  4. how can i send it to a person ? /notifications playername box_c.lua sx,sy = guiGetScreenSize () addEvent ("onNotificationWindowHide",false) addEvent ("onNotificationWindowShow",false) box = false function showBox(value, str) -- value 1 - Info -- value 2 - Error -- value 3 - warning --if box == false then if str and type(str) == "string" and string.len(str) > 0 then box = true if value == "info" then showTipBox (str,"img/info.png") outputConsole ("[INFO]" .. str) elseif value == "error" then showTipBox (str,"img/error.png") outputConsole ("[ERROR]" .. str) elseif value == "warning" then showTipBox (str,"img/warning.png") outputConsole ("[WARNING]" .. str) end end --else -- return false --end end addEvent("CreateBox", true) addEventHandler("CreateBox", getRootElement(), showBox) addEventHandler ("onNotificationWindowHide",getRootElement(), function () box = false end ) tipBox = {} tipBox.path = "" tipBox.show = false tipBox.state = nil tipBox.string = nil tipBox.starTick = nil tipBox.currentY = nil tipBox.time = 800 tipBox.next = nil tipBox.nextPath = "" tipBox.timer = nil tipBox.startY = -180 tipBox.stopY = 30 function showTipBox (str,path) if str then if path == nil then path = "img/info.png" end if fileExists (path) then if tipBox.show == true then tipBox.next = str tipBox.nextPath = path else local sound = playSound ("bip.mp3") setSoundVolume (sound,0.5) tipBox.path = path tipBox.show = true tipBox.state = "starting" tipBox.string = str tipBox.startTick = getTickCount() triggerEvent ("onNotificationWindowShow",getRootElement()) end end end end addEvent("CreateTipBox", true) addEventHandler("CreateTipBox", getRootElement(), showTipBox) addEventHandler ("onClientRender", getRootElement(), function () if tipBox.show == true and tipBox.string then local width = dxGetTextWidth (tipBox.string, 1, "default-bold") if width then if tipBox.state == "starting" then local progress = (getTickCount() - tipBox.startTick) / tipBox.time local intY = interpolateBetween ( tipBox.startY,0,0, tipBox.stopY,0,0, progress,"OutElastic" ) if intY then tipBox.currentY = intY else tipBox.currentY = 100 end if progress > 1 then tipBox.state = "showing" tipBox.timer = setTimer ( function () tipBox.startTick = getTickCount() tipBox.state = "hiding" end ,string.len(tipBox.string)*45+800,1) end elseif tipBox.state == "showing" then tipBox.currentY = tipBox.stopY elseif tipBox.state == "hiding" then local progress = (getTickCount() - tipBox.startTick) / (tipBox.time) local intY = interpolateBetween ( tipBox.stopY,0,0, tipBox.startY,0,0, progress,"Linear" ) if intY then tipBox.currentY = intY else tipBox.currentY = 100 end if progress > 1 then triggerEvent ("onNotificationWindowHide",getRootElement()) if tipBox.next then if isTimer(tipBox.timer) then killTimer(tipBox.timer) end tipBox.show = true tipBox.state = "starting" tipBox.string = tipBox.next tipBox.startTick = getTickCount() tipBox.next = nil tipBox.path = tipBox.nextPath return else tipBox.show = false tipBox.state = nil tipBox.string = nil return end end else return end local width = 512 local x,y = sx/2 - width/2, tipBox.currentY local textX,textY = x+128,tipBox.currentY+44 local textWidth,textHeight = 363,106 dxDrawImage (x,y,width,256,tipBox.path,0,0,0,tocolor(255,255,255),true) dxDrawText (tipBox.string,textX,textY,textX+textWidth,textY+textHeight,tocolor(222,222,222),1,"default-bold","center","center",false,true,true) end end end ) box_s.lua function showBox(player, value, str) if isElement(player) then triggerClientEvent(player, "CreateBox", getRootElement(), value, str) end end script - https://community.multitheftauto.com/index.php?p=resources&s=details&id=5812
  5. function aPlayerWarp ( player ) if ( aWarpForm == nil ) then local x, y = guiGetScreenSize() aWarpForm = guiCreateWindow ( x / 2 - 110, y / 2 - 150, 200, 300, "Player Warp Management", false ) aWarpList = guiCreateGridList ( 0.03, 0.08, 0.94, 0.73, true, aWarpForm ) guiGridListAddColumn( aWarpList, "Player", 0.9 ) aWarpSelect = guiCreateButton ( 0.03, 0.82, 0.94, 0.075, "Select", true, aWarpForm ) aWarpCancel = guiCreateButton ( 0.03, 0.90, 0.94, 0.075, "Cancel", true, aWarpForm ) addEventHandler ( "onClientGUIDoubleClick", aWarpForm, aClientWarpDoubleClick ) addEventHandler ( "onClientGUIClick", aWarpForm, aClientWarpClick ) --Register With Admin Form aRegister ( "PlayerWarp", aWarpForm, aPlayerWarp, aPlayerWarpClose ) end aWarpSelectPointer = player guiGridListClear ( aWarpList ) for id, player in ipairs ( getElementsByType ( "player" ) ) do guiGridListSetItemPlayerName ( aWarpList, guiGridListAddRow ( aWarpList ), 1, getPlayerName ( player ), false, false ) end guiSetVisible ( aWarpForm, false ) guiBringToFront ( aWarpForm ) end function openP() if (guiGetVisible (aWarpForm) == true) then guiSetVisible(aWarpForm, false) showCursor(false) elseif (guiGetVisible (aWarpForm) == false) then guiSetVisible(aWarpForm, true) showCursor(true) end addCommandHandler("panel", aWarpForm) end function aPlayerWarpClose ( destroy ) if ( ( destroy ) or ( aPerformanceWarp and guiCheckBoxGetSelected ( aPerformanceWarp ) ) ) then if ( aWarpForm ) then removeEventHandler ( "onClientGUIDoubleClick", aWarpForm, aClientWarpDoubleClick ) removeEventHandler ( "onClientGUIClick", aWarpForm, aClientWarpClick ) destroyElement ( aWarpForm ) aWarpForm = nil end else guiSetVisible ( aWarpForm, false ) end end function aClientWarpDoubleClick ( button ) if ( button == "left" ) then if ( source == aWarpList ) then if ( guiGridListGetSelectedItem ( aWarpList ) ~= -1 ) then triggerServerEvent ( "aPlayer", getLocalPlayer(), aWarpSelectPointer, "warpto", getPlayerFromNick ( guiGridListGetItemPlayerName ( aWarpList, guiGridListGetSelectedItem ( aWarpList ), 1 ) ) ) aPlayerWarpClose ( false ) end end end end function aClientWarpClick ( button ) if ( button == "left" ) then if ( source == aWarpSelect ) then if ( guiGridListGetSelectedItem ( aWarpList ) ~= -1 ) then triggerServerEvent ( "aPlayer", getLocalPlayer(), aWarpSelectPointer, "warpto", getPlayerFromNick ( guiGridListGetItemPlayerName ( aWarpList, guiGridListGetSelectedItem ( aWarpList ), 1 ) ) ) aPlayerWarpClose ( false ) end elseif ( source == aWarpCancel ) then aPlayerWarpClose ( false ) end end end I added the command but it is not opening @IIYAMA
  6. how to add open command ? function aPlayerWarp ( player ) if ( aWarpForm == nil ) then local x, y = guiGetScreenSize() aWarpForm = guiCreateWindow ( x / 2 - 110, y / 2 - 150, 200, 300, "Player Warp Management", false ) aWarpList = guiCreateGridList ( 0.03, 0.08, 0.94, 0.73, true, aWarpForm ) guiGridListAddColumn( aWarpList, "Player", 0.9 ) aWarpSelect = guiCreateButton ( 0.03, 0.82, 0.94, 0.075, "Select", true, aWarpForm ) aWarpCancel = guiCreateButton ( 0.03, 0.90, 0.94, 0.075, "Cancel", true, aWarpForm ) addEventHandler ( "onClientGUIDoubleClick", aWarpForm, aClientWarpDoubleClick ) addEventHandler ( "onClientGUIClick", aWarpForm, aClientWarpClick ) aRegister ( "PlayerWarp", aWarpForm, aPlayerWarp, aPlayerWarpClose ) end aWarpSelectPointer = player guiGridListClear ( aWarpList ) for id, player in ipairs ( getElementsByType ( "player" ) ) do guiGridListSetItemPlayerName ( aWarpList, guiGridListAddRow ( aWarpList ), 1, getPlayerName ( player ), false, false ) end guiSetVisible ( aWarpForm, true ) guiBringToFront ( aWarpForm ) end function aPlayerWarpClose ( destroy ) if ( ( destroy ) or ( aPerformanceWarp and guiCheckBoxGetSelected ( aPerformanceWarp ) ) ) then if ( aWarpForm ) then removeEventHandler ( "onClientGUIDoubleClick", aWarpForm, aClientWarpDoubleClick ) removeEventHandler ( "onClientGUIClick", aWarpForm, aClientWarpClick ) destroyElement ( aWarpForm ) aWarpForm = nil end else guiSetVisible ( aWarpForm, false ) end end function aClientWarpDoubleClick ( button ) if ( button == "left" ) then if ( source == aWarpList ) then if ( guiGridListGetSelectedItem ( aWarpList ) ~= -1 ) then triggerServerEvent ( "aPlayer", getLocalPlayer(), aWarpSelectPointer, "warpto", getPlayerFromNick ( guiGridListGetItemPlayerName ( aWarpList, guiGridListGetSelectedItem ( aWarpList ), 1 ) ) ) aPlayerWarpClose ( false ) end end end end function aClientWarpClick ( button ) if ( button == "left" ) then if ( source == aWarpSelect ) then if ( guiGridListGetSelectedItem ( aWarpList ) ~= -1 ) then triggerServerEvent ( "aPlayer", getLocalPlayer(), aWarpSelectPointer, "warpto", getPlayerFromNick ( guiGridListGetItemPlayerName ( aWarpList, guiGridListGetSelectedItem ( aWarpList ), 1 ) ) ) aPlayerWarpClose ( false ) end elseif ( source == aWarpCancel ) then aPlayerWarpClose ( false ) end end end
  7. addCommandHandler ( "go", function ( player ) setTimer ( function ( ) for index, thePlayer in ipairs ( getElementsByType ( "player" ) ) do redirectPlayer ( thePlayer, "91.121.70.169", 22017 ) end end ,5000, 1 ) outputChatBox ( "You Will be Moved to the Server in 5 sec ...", player ) outputChatBox ( "Player ".. getPlayerName ( player ) .." Has Moved to the Server !", getRootElement(), 250, 255, 0 ) end ) I want to direct the tournament to the server everywhere
  8. local nearbyPlayers = {} addEventHandler("onPlayerVoiceStart", root, function() local r = 50 local posX, posY, posZ = getElementPosition(source) local chatSphere = createColSphere(posX, posY, posZ, r) nearbyPlayers = getElementsWithinColShape(chatSphere, "player") destroyElement(chatSphere) local empty = exports.voice:getNextEmptyChannel() exports.voice:setPlayerChannel(source, empty) for index, player in ipairs(nearbyPlayers) do exports.voice:setPlayerChannel(player, empty) end end ) addEventHandler("onPlayerVoiceStop", root, function() exports.voice:setPlayerChannel(source) for index, player in ipairs(nearbyPlayers) do exports.voice:setPlayerChannel(player) end nearbyPlayers = {} end )
  9. How can we bind this ? or AddCommand ? @IIYAMA @Slothman
  10. I wrote a script like this, but people can hear us local nearbyPlayers = {} addEventHandler("onPlayerVoiceStart", root, function() local r = 50 local posX, posY, posZ = getElementPosition(source) local chatSphere = createColSphere(posX, posY, posZ, r) nearbyPlayers = getElementsWithinColShape(chatSphere, "player") destroyElement(chatSphere) local empty = exports.voice:getNextEmptyChannel() exports.voice:setPlayerChannel(source, empty) for index, player in ipairs(nearbyPlayers) do exports.voice:setPlayerChannel(player, empty) end end ) addEventHandler("onPlayerVoiceStop", root, function() exports.voice:setPlayerChannel(source) for index, player in ipairs(nearbyPlayers) do exports.voice:setPlayerChannel(player) end nearbyPlayers = {} end )
  11. @IIYAMA @kikos500 I've tried it twice, but it did not work, it does not get much damage from his head
  12. I did so function onPlayerHeadshot( attacker, _, bodypart, loss ) local playerOriginalHealth = getElementHealth( source ) + loss -- get the player's original health local newHealth = math.max(playerOriginalHealth - headshotDamage, 0) setElementHealth( localPlayer, newHealth) -- set the player's new health iprint("playerOriginalHealth:", playerOriginalHealth, ", newHealth:", newHealth) end addEventHandler( "onClientPlayerDamage", localPlayer, onPlayerHeadshot )
  13. I try, but he does not get much damage from his head function onPlayerHeadshot( attacker, _, bodypart, loss ) local playerOriginalHealth = getElementHealth( source ) + loss -- get the player's original health local newHealth = math.max(playerOriginalHealth - headshotDamage, 0) setElementHealth( localPlayer, newHealth) -- set the player's new health iprint("playerOriginalHealth:", playerOriginalHealth, ", newHealth:", newHealth) end addEventHandler( "onClientPlayerDamage", localPlayer, onPlayerHeadshot )
×
×
  • Create New...