Blinker.
Members-
Posts
148 -
Joined
-
Last visited
Everything posted by Blinker.
-
Worked! , Many thanks mate
-
it should be like that? function exampleCode() if(true == false and false ~= true) then sound = playSound("File.mp3") end end function onGuiClick (button, state, absoluteX, absoluteY) if (source == startbutton) then local musicName = guiGridListGetItemText ( gridlist, guiGridListGetSelectedItem ( gridlist ), 1 ) if musicName == "Music 3" then setSoundVolume(sound,1) end end if (source == stopbutton) then stopSound(sound) end end
-
function exampleCode() if(true == false and false ~= true) then sound = playSound("File.mp3") end end function onGuiClick (button, state, absoluteX, absoluteY) if (source == startbutton) then local musicName = guiGridListGetItemText ( gridlist, guiGridListGetSelectedItem ( gridlist ), 1 ) if musicName == "Music 3" then setSoundVolume(sound,1) else if (source == stopbutton) then stopSound(sound) end end end end Should be like that ? I didn't understand it well
-
well , I tried that function onGuiClick (button, state, absoluteX, absoluteY) if (source == startbutton) then local musicName = guiGridListGetItemText ( gridlist, guiGridListGetSelectedItem ( gridlist ), 1 ) if musicName == "Music 3" then sound = playSound("music.mp3") setSoundVolume(sound,1) else if (source == stopbutton) then stopSound(sound) end end end end Still Can't Make the music Stop.
-
hello guys , i need a little help here with start / stop sound. well , i tried two methodes stopSound and setSoundVolume and both didn't work. here's my lua (client-side) function onGuiClick (button, state, absoluteX, absoluteY) if (source == startbutton) then local musicName = guiGridListGetItemText ( gridlist, guiGridListGetSelectedItem ( gridlist ), 1 ) if musicName == "Music 3" then local sound = playSound("music.mp3") setSoundVolume(sound,1) else if (source == stopbutton) then stopSound("music.mp3") --setSoundVolume(sound,0) end end end end the music starts when i click on the start button, but it doesn't stop when i click on the stop button. thanks in advance.
-
1 more question , after i did that , if i want to draw a text with the team name i get Attempt to concatenate a DataValue what's wrong ? thanks
-
client side function draw(target) local scareSound = playSound("scare.mp3") setSoundVolume(scareSound, 1) dxDrawImage(math.random(-5,0),math.random(-5,0),sw+5,sh+5,'scare.jpg',0,0,0,tocolor(255,255,255,math.random(200,240)),true) end function drawHandler() addEventHandler("onClientRender",root,draw) end addEvent("draw",true) addEventHandler("draw",root,drawHandler) server side function getPlayerFromPartialName(name) local name = name and name:gsub("#%x%x%x%x%x%x", ""):lower() or nil if name then for _, player in ipairs(getElementsByType("player")) do local name_ = getPlayerName(player):gsub("#%x%x%x%x%x%x", ""):lower() if name_:find(name, 1, true) then return player end end end end addCommandHandler("scare", function(player, command, target) local target = getPlayerFromPartialName(target) if target then triggerClientEvent("draw", localPlayer,target) end end )
-
Hello , is there a way to copy a defined thing from client side to server side ? Like if I type in a box a name and I press a button then a team should be created with that name . for example --client side function setteambutton (button,state, absoluteX,absoluteY) if source == abutton then team = guiGetText (edit) triggerServerEvent("create", root, create) end end addEventHandler ("onClientGuiClick", getRootElement (), setteambutton) --server side function create() createTeam (team) end addEvent ("create", true) addEventHandler ("create", root, create) thanks in advance
-
function onGuiClick (button, state, absoluteX, absoluteY) if (source == proceed1) then executeCommandHandler ("nothing123") endend should this work? , honestly I don't understand it mate EDIT : that works , thanks for your help
-
hello guys , i've been working for couple of hours on a script i don't want to get stucked here. i edited admin_report.lua in admin , i want to make a new gui , so if i click on proceed the report would open. --[[********************************** * * Multi Theft Auto - Admin Panel * * gui\admin_report.lua * * Original File by lil_Toady * **************************************]] aReportForm = nil function aReport ( player ) if ( aReportForm == nil ) then local x, y = guiGetScreenSize() aReportForm = guiCreateWindow ( x / 2 - 150, y / 2 - 150, 300, 300, "Contact", false ) guiCreateLabel ( 0.05, 0.11, 0.20, 0.09, "Category:", true, aReportForm ) guiCreateLabel ( 0.05, 0.21, 0.20, 0.09, "Subject:", true, aReportForm ) guiCreateLabel ( 0.05, 0.30, 0.20, 0.07, "Message:", true, aReportForm ) aReportCategory = guiCreateEdit ( 0.30, 0.10, 0.65, 0.09, "Question", true, aReportForm ) guiEditSetReadOnly ( aReportCategory, true ) aReportDropDown = guiCreateStaticImage ( 0.86, 0.10, 0.09, 0.09, "client\\images\\dropdown.png", true, aReportForm ) guiBringToFront ( aReportDropDown ) aReportCategories = guiCreateGridList ( 0.30, 0.10, 0.65, 0.30, true, aReportForm ) guiGridListAddColumn( aReportCategories, "", 0.85 ) guiSetVisible ( aReportCategories, false ) guiGridListSetItemText ( aReportCategories, guiGridListAddRow ( aReportCategories ), 1, "Rights", false, false ) aReportSubject = guiCreateEdit ( 0.30, 0.20, 0.65, 0.09, "", true, aReportForm ) aReportMessage = guiCreateMemo ( 0.05, 0.38, 0.90, 0.45, "~nicknames(old: | new:):\n~Your real name:\n~how old are you:", true, aReportForm ) aReportAccept = guiCreateButton ( 0.40, 0.88, 0.25, 0.09, "Send", true, aReportForm ) aReportCancel = guiCreateButton ( 0.70, 0.88, 0.25, 0.09, "Cancel", true, aReportForm ) addEventHandler ( "onClientGUIClick", aReportForm, aClientReportClick ) addEventHandler ( "onClientGUIDoubleClick", aReportForm, aClientReportDoubleClick ) end guiBringToFront ( aReportForm ) showCursor ( true ) end addCommandHandler ( "nothing123", aReport ) function aReportClose ( ) if ( aReportForm ) then removeEventHandler ( "onClientGUIClick", aReportForm, aClientReportClick ) removeEventHandler ( "onClientGUIDoubleClick", aReportForm, aClientReportDoubleClick ) destroyElement ( aReportForm ) aReportForm = nil showCursor ( false ) end end function aClientReportDoubleClick ( button ) if ( button == "left" ) then if ( source == aReportCategories ) then if ( guiGridListGetSelectedItem ( aReportCategories ) ~= -1 ) then local cat = guiGridListGetItemText ( aReportCategories, guiGridListGetSelectedItem ( aReportCategories ), 1 ) guiSetText ( aReportCategory, cat ) guiSetVisible ( aReportCategories, false ) end end end end function aClientReportClick ( button ) if ( source == aReportCategory ) then guiBringToFront ( aReportDropDown ) end if ( source ~= aReportCategories ) then guiSetVisible ( aReportCategories, false ) end if ( button == "left" ) then if ( source == aReportAccept ) then if ( ( string.len ( guiGetText ( aReportSubject ) ) < 1 ) or ( string.len ( guiGetText ( aReportMessage ) ) < 5 ) ) then aMessageBox ( "error", "Subject/Message missing." ) else aMessageBox ( "info", "Your message has been submited and will be processed as soon as possible." ) setTimer ( aMessageBoxClose, 3000, 1, true ) local tableOut = {} tableOut.category = guiGetText ( aReportCategory ) tableOut.subject = guiGetText ( aReportSubject ) tableOut.message = guiGetText ( aReportMessage ) triggerServerEvent ( "aMessage", getLocalPlayer(), "new", tableOut ) aReportClose () end elseif ( source == aReportSubject ) then elseif ( source == aReportMessage ) then elseif ( source == aReportCancel ) then aReportClose () elseif ( source == aReportDropDown ) then guiBringToFront ( aReportCategories ) guiSetVisible ( aReportCategories, true ) end end end ------------------------------ -----EDIT ------------------------------ local sW, sH = guiGetScreenSize() window1 = guiCreateWindow(sW / 2 - 150, sH / 2 - 150, 298, 171, "Request Rights", false) guiWindowSetSizable(window1, false) proceed1 = guiCreateButton(10, 123, 123, 38, "Proceed", false, window1) guiSetFont(proceed1, "default-bold-small") close1 = guiCreateButton(152, 122, 122, 39, "Close", false, window1) guiSetFont(close1, "default-bold-small") label1 = guiCreateLabel(9, 20, 279, 25, "Here, you can submit a Request if you wish to get Rights in order to manage cw's or fw's.", false, window1) guiSetFont(label1, "default-small") guiLabelSetHorizontalAlign(label1, "left", true) label2 = guiCreateLabel(8, 47, 159, 18, "Our rules are the followings:", false, window1) guiSetFont(label2, "default-bold-small") label3 = guiCreateLabel(10, 66, 157, 16, "You Should:", false, window1) guiSetFont(label3, "default-small") guiLabelSetColor(label3, 25, 255, 7) label4 = guiCreateLabel(170, 66, 123, 16, "You shouldn't:", false, window1) guiSetFont(label4, "default-small") guiLabelSetColor(label4, 237, 0, 0) label5 = guiCreateLabel(9, 76, 158, 51, "~Respect others\n~Wait if other clans are playing a cw\n~mute annoyers/insulters\n~kick hackers/cheaters \n", false, window1) guiSetFont(label5, "default-small") label6 = guiCreateLabel(166, 77, 127, 50, "~Interrupt cw's/fw's\n~kick for 'no reason'\n~Abuse admin powers\n~spec if players don't accept\n", false, window1) guiSetFont(label6, "default-small") guiSetVisible( window1, false ) showCursor ( false ) function onresourceStart () bindKey ("F4", "down", showPanel) end addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()), onresourceStart) addEventHandler ( "onClientGUIClick", root, setStats ) function showPanel () getVisible = guiGetVisible (window1) playerName = getPlayerName ( getLocalPlayer() ) if (getVisible == true) then guiSetVisible (window1, false) showCursor (false) end if (getVisible == false) then guiSetVisible (window1, true) showCursor (true) end end function onGuiClick (button, state, absoluteX, absoluteY) if (source == close1) then guiSetVisible (window1, false) showCursor (false) end end addEventHandler ("onClientGUIClick", getRootElement(), onGuiClick) function onGuiClick (button, state, absoluteX, absoluteY) if (source == proceed1) then guiSetVisible (aReportForm, true) showCursor (true) end end addEventHandler ("onClientGUIClick", getRootElement(), onGuiClick) well , the error shows at line 165 "Bad Argument @ 'guiSetVisible' [expected -element at argument 1 , got nil ]" the report panel doesn't show when i click on proceed button. Please help, a lot of thanks
-
this didn't work mate look this is the whole script (its not mine) but this was for dm (wins not working , it was working onplayerwasted) i am trying to fix it for dd gRoot = getRootElement() LastWinners={"","","","",""} function onPlayerQuit ( ) local playeraccount = getPlayerAccount ( source ) if ( playeraccount ) and not isGuestAccount ( playeraccount ) then local playermoney = getPlayerMoney ( source ) local playerpoints = getElementData(source,"Points") local playertime = getElementData(source,"Playtime") local playerwins = getElementData(source,"Wins") local playerdeaths = getElementData(source,"Deaths") local playerhunters = getElementData(source,"Hunters") setAccountData ( playeraccount, "money", playermoney ) setAccountData ( playeraccount, "points", playerpoints ) setAccountData ( playeraccount, "playtime", playertime ) setAccountData ( playeraccount, "wins", playerwins ) setAccountData ( playeraccount, "deaths", playerdeaths ) setAccountData ( playeraccount, "hunters", playerhunters ) end end function onPlayerLogin (_, playeraccount ) if ( playeraccount ) then local playermoney = getAccountData ( playeraccount, "money" ) local playerpoints = getAccountData ( playeraccount, "points" ) local playertime = getAccountData ( playeraccount, "playtime" ) local playerwins = getAccountData ( playeraccount, "wins" ) local playerdeaths = getAccountData ( playeraccount, "deaths" ) local playerhunters = getAccountData ( playeraccount, "hunters" ) setPlayerMoney ( source, playermoney ) setElementData(source,"Points",playerpoints or 0) setElementData(source,"Playtime",playertime or 0) setElementData(source,"Wins",playerwins or 0) setElementData(source,"Deaths",playerdeaths or 0) setElementData(source,"Hunters",playerhunters or 0) end end addEventHandler ( "onPlayerQuit", getRootElement ( ), onPlayerQuit ) addEventHandler ( "onPlayerLogin", getRootElement ( ), onPlayerLogin) function BuyNos (player, command) if (getPlayerMoney(player) > 10000) then local auto = getPedOccupiedVehicle(player) local nick = getPlayerName(player) addVehicleUpgrade(auto,1010) setPlayerMoney(player, getPlayerMoney(player) - 10000 ) outputChatBox("#50B50D[sHOP] " .. nick .. " #50B50Dbought for #FFFFFF$10000 #50B50Dnitro!", getRootElement(), 255, 255, 255, true) else outputChatBox("#50B50DNot enough money.", player, 255, 255, 255, true) end end addCommandHandler("nos", BuyNos) function BuyRepair (player, command) if (getPlayerMoney(player) > 20000) then local auto = getPedOccupiedVehicle(player) local nick = getPlayerName(player) fixVehicle(auto) setPlayerMoney(player, getPlayerMoney(player) - 20000 ) outputChatBox("#50B50D[sHOP] " .. nick .. " #50B50Dbought for #FFFFFF$20000 #50B50Drepair!", getRootElement(), 255, 255, 255, true) else outputChatBox("#50B50DNot enough money.", player, 255, 255, 255, true) end end addCommandHandler("fix", BuyRepair) function BuyFlip (player, command) if (getPlayerMoney(player) > 20000) then local auto = getPedOccupiedVehicle(player) local nick = getPlayerName(player) rx, ry, rz = getVehicleRotation (auto) setVehicleRotation (auto, rx +180, ry, rz +180) setPlayerMoney(player, getPlayerMoney(player) - 20000 ) outputChatBox("#50B50D[sHOP] " .. nick .. " #50B50Dbought for #FFFFFF$20000 #50B50Dflip!", getRootElement(), 255, 255, 255, true) else outputChatBox("#50B50DNot enough money.", player, 255, 255, 255, true) end end addCommandHandler("flip", BuyFlip) addEventHandler ("onPlayerChat",getRootElement(), function(message,type) local nick = getPlayerName(source) if (string.find(message,"!points")) and not (string.find(message," !points")) then local playerpoints = getElementData(source,"Points") outputChatBox("#50B50D[POINTS] " .. nick .. " #50B50D has #FFFFFF" .. playerpoints .. "#50B50D points", getRootElement(), 255, 255, 255, true) else if (string.find(message,"!cash")) and not (string.find(message," !cash")) then outputChatBox("#50B50D[CASH] " .. nick .. " #50B50D has #FFFFFF" .. getPlayerMoney(source) .. "$#50B50D money ", getRootElement(), 255, 255, 255, true) else if (string.find(message,"!playtime")) and not (string.find(message," !playtime")) then local playertime = getElementData(source,"Playtime") outputChatBox("#50B50D[PLAYTIME] " .. nick .. " #50B50D has played for #50B50D" .. playertime .. "#50B50D minutes", getRootElement(), 255, 255, 255, true) else if (string.find(message,"!wins")) and not (string.find(message," !wins")) then local playerwins = getElementData(source,"Wins") outputChatBox("#50B50D[WINS] " .. nick .. " #50B50D has #FFFFFF" .. playerwins .. "#50B50D wins", getRootElement(), 255, 255, 255, true) else if (string.find(message,"!deaths")) and not (string.find(message," !deaths")) then local playerdeaths = getElementData(source,"Deaths") outputChatBox("#50B50D[DEATHS] " .. nick .. " #50B50D has #FFFFFF" .. playerdeaths .. "#50B50D deaths", getRootElement(), 255, 255, 255, true) else if (string.find(message,"!hunters")) and not (string.find(message," !hunters")) then local playerhunters = getElementData(source,"Hunters") outputChatBox("#191970* " .. nick .. " #8bbae9 has #FFFFFF" .. playerhunters .. "#8bbae9 hunters", getRootElement(), 255, 255, 255, true) end end end end end end end) function updatePlayersStats ( ) for index, player in ipairs ( getElementsByType "player" ) do setElementData ( player, "Money", getPlayerMoney ( player ) ) end end setTimer ( updatePlayersStats, 5000, 0 ) function UpdateMinute ( ) for index, player in ipairs ( getElementsByType "player" ) do setElementData(player,"Playtime",tonumber(getElementData(player,"Playtime"))+1) end end setTimer ( UpdateMinute, 60000, 0 ) function checkForHunter(number,sort,model) thePlayer = source if sort == "vehiclechange" then if model == 425 then if getElementData(thePlayer,"playerGotHunter") == false then setElementData(thePlayer,"playerGotHunter",true) outputChatBox ( getPlayerName(source).." #FFFFFFgot #abcdef400 points #FFFFFFand #abcdef5000$ #FFFFFFhunter bonus!", getRootElement(), 255, 255, 255, true ) setElementData(thePlayer,"Points",tonumber(getElementData(thePlayer,"Points"))+400) givePlayerMoney(thePlayer,5000) setElementData(thePlayer,"Hunters",tonumber(getElementData(thePlayer,"Hunters"))+1) end end end end addEventHandler("onPlayerPickUpRacePickup",getRootElement(),checkForHunter) addEvent("onPlayerDestructionDerbyWin",true) addEventHandler("onPlayerDestructionDerbyWin", root, function ( ) setElementData(source,"Wins",tonumber(getElementData(source,"Wins"))+1) end ) thanks
-
function Winsadd () local Wins = getElementData(thePlayer,"Wins") local thePlayer = source setElementData(thePlayer,"Wins",tonumber(getElementData(thePlayer,"Wins"))+1) end addEvent("onPlayerDestructionDerbyWin",true) addEventHandler("onPlayerDestructionDerbyWin",getRootElement(),Winsadd) Still not working
-
hello guys , i need your help , i am stuck at Wins its not working and i don't know what's the problem ... function Winsadd () local Wins = getElementData(thePlayer,"Wins") setElementData(thePlayer,"Wins",tonumber(getElementData(thePlayer,"Wins"))+1) end addEvent("onPlayerDestructionDerbyWin",true) addEventHandler("onPlayerDestructionDerbyWin",getRootElement(),Winsadd) Thanks
-
can you please edit on the script i gave , i got nothing when i add this to mine.. thanks.
-
well , that fixed it to center on all resolution to the left , i need it to the right thanks
-
can you please help me with it ? i tried a lot .. i want to put that text into the rectangle , the rectangle is centered on all resolutions but the text isn't , only works on 800x600
-
Isn't there a way to make it appear same on all ?
-
hello , i've been working on how to make a text appear same at all resolutions and didn't get a result if anyone could help me with that i would appreciate it. function drawText() local width1 = dxGetTextWidth(hexColorHome..homeName.."("..homeAlivePlayers..") ".."#ffffff "..displayHome, 1, 'default-bold') local width2 = dxGetTextWidth(hexColorVisit..visitName.."("..visitAlivePlayers..") ".."#ffffff "..displayVisit, 1, 'default-bold') width = width1 if width < width2 then width = width2 end local x = sW - 42 - width dxDrawRectangle(x + 68,(sH/1.85)-50,width - 40,40, tocolor(0,0,0,120)) dxDrawText ( hexColorHome..homeName.."("..homeAlivePlayers..") ".."#ffffff "..displayHome, x + 72, (sH/2.21)+5, x + width, sH, tocolor(255, 102, 1, 255), 1, "default-bold", 'left', 'top', false, false, false, true, true, 0, 0, 0) dxDrawText ( hexColorVisit..visitName.."("..visitAlivePlayers..") ".."#ffffff "..displayVisit, x + 72, (sH/2.05)+5, x + width, sH, tocolor(255, 0, 0, 255), 1, "default-bold", 'left', 'top', false, false, false, true, true, 0, 0, 0) end addEventHandler("onClientRender", root, drawText) well , i tried it on 800x600 it works good, the text is in the rectangle but when i tried a lower or higher resolution i got a trouble the text isn't in the rectangle please help. thanks in advance