-
Posts
1,803 -
Joined
-
Last visited
-
Days Won
8
Everything posted by Citizen
-
Delete your resources folder and extract it again from the archive you got with github.
-
It means that the script that contains this: addEvent("onPlayerChatMessage", true) wasn't added to the meta.xml or there is a syntax error somewhere in this script file. There is no syntax error in the Anubhav's code so fix the rest of the code or put it in another script file.
-
Sorry, made a typo here: if hitElement == Policeped and theButton == "left" and theState == "up" then it's clickedElement and not hitElement Try again and be sure to tell us if /debugscript 3 is showing anything. Note: use /debugscript 3 before starting the resource your code is in. if not, then put some outputs where the code should go step by step. if an output isn't working, then you know there is a problem from the if statement above or something similar. This way, you can check your if statements, if triggers are working properly etc.
-
If I explain more that I already did, the code will be done and you won't learn anything. I wrote everything in english (each steps and things you have to write in this script), you just have to translate these lines in Lua. So no, I won't explain more. No, for the same reasons that above and you already have examples on the wiki for each function. For example, read the wiki page of setElementData, and the example if you scroll a bit down on that page. Examples from the wiki are good enough to let everybody understand how the function should be used. So try yourself. If you do a fake try (I mean: "I'll just write some bullshit and Citizen will fix it") I'll just tell you to try harder. By the way, I didn't wrote the dx part since it's 95% the same as the armor and hp bar.
-
This doesn't make any sense. I couldn't guess what you mean't by saying that. Because the login and password are just wrong ?
-
Don't define a function inside another one.
-
You have to create the functions to get and set the player hunger and create a timer to decrease it every X milliseconds when the player logs in. You can then use the get function to update your dx bar. function setPlayerHunger( thePlayer, hunger ) -- check if thePlayer ~= nil and thePlayer element type is "player" and the lua type of hunger == "number" -- set an element data on thePlayer using the key "hunger" and hunger (from the argument) as value --return what setElementData function returned --endif -- returns false here end function getPlayerHunger( thePlayer ) -- check if thePlayer ~= nil and thePlayer element type is "player" -- get value of the element data on thePlayer using the same key ("hunger") -- returns what the getElementData above returned or 0 if it returned false --endif end function decreaseHunger( thePlayer ) -- check if thePlayer ~= nil and thePlayer element type is "player" -- get the hunger of that player using getPlayerHunger -- check if that value is <= 0 -- get the player health -- decrease it -- set the new health for that player -- else -- decrease the hunger -- set the new hunger using setPlayerHunger -- endif --endif end function whenPlayerLogsIn() --you can rename it if you want -- set the hunger to whatever value you want for that player (100 or using getAccountData if you saves it in database) -- set an infinite timer that will call decreaseHunger and giving the player element as argument -- save that timer inside an element data on the player using the key "hungerTimer" (will be needed to kill it later) end -- When the player logs in (there is an event for that): execute the function above function whenPlayerQuitOrLogsOff() --you can rename it if you want -- get the hunger timer of that player stored in its element data with the key "hungerTimer" -- check if the value you got from the line above is not false and if it's a timer (use isTimer) -- kill that timer -- endif end -- When the player logs off (there is an event for that): execute the function above -- When the player quits (there is an event for that): execute the same function above
-
Hummm the two piece of code I gave you were only for the two bars (health and armor) not for the background oO But if you say you fixed it, then it's okay.
-
Read the wiki page of onElementClicked event (also the examples are here to help you to understand how it does work) https://wiki.multitheftauto.com/wiki/OnElementClicked function pedclick ( theButton, theState, thePlayer ) local clickedElement = source --the wiki says that source is the element clicked --if the element clicked is your ped and he clicked with the left mouse button and only when he released it if hitElement == Policeped and theButton == "left" and theState == "up" then triggerClientEvent ( thePlayer, "pedClick") end end addEventHandler( "onElementClicked", root, pedclick )
-
I need the full code of this part: Client Take job: isPedInVehicle getElementType guiSetVisible showCursor addEvent( "pedClick", true ) addEventHandler( "pedClick", root, guiwindow ) And this one: Server: on clicking the ped: triggerClientEvent onElementClicked And please do it.
-
Hummm almost lol. Put it right next to the addEventHandler.
-
Heuuu nan le plus connu c'est Valhalla. M'enfin bon, si je veux trouver un serveur RP, je chercherai directement dans le serverbrowser. C'est plus largement plus rapide que de poster sur le forum.
-
Modify your code to looks like this (I only modified these lines but the first part has nothing to do with the bind problem: guiGridListAddColumn(GUIEditor.gridlist[1], "Name", 0.2) --removed useless variable here guiGridListAddColumn(GUIEditor.gridlist[1], "Message", 0.8 ) --removed useless variable here guiSetVisible(GUIEditor.window[1], false) --Make it invisible by default bindKey ( "F2", "down", winshow ) --Use the client syntax (you were using the server one) Don't forget you can use /debugscript 3 to see the errors on both sides (server and client). You need to be logged in as admin to be able to use /debuscript 3
-
Sure, here is how to add a click listener on a gui element: function onMyButtonClicked( button ) outputChatBox("Hey you clicked on myButton with the "..button.." mouse button.") end local myButton = guiCreateButton( ... ) addEventHandler("onClientGUIClick", myButton, onMyButtonClicked, false) If the problem is somewhere else, please show us the code.
-
Lol ok you were right, the resolution is 1360x768. I never saw that resolution on any computer lol (but 1366x768 is common on laptops). Yeah, it helps a lot, I could fix the health and armor bars: Replace line 11 by this: local maxHealthWidth = screenX*0.0654 - 0.003 dxDrawRectangle(screenX*0.238 , screenY*0.819, hp*maxHealthWidth/100, screenY*0.0142, tocolor(135, 34, 34, 200)) Replace line 16 by this: local maxArmorWidth = screenX*0.0654 - 0.003 dxDrawRectangle(screenX*0.238 , screenY*0.8523, arm*maxArmorWidth/100, screenY*0.0142, tocolor(93, 125, 150, 200)) The problem seems to come from the radar positioning/sizing. I would like to see this part of the radar code. Or maybe a fullscreen (do not edit) of the hud in your resolution. Thanks.
-
Ok try this, I fixed some stuff and renamed some variables/functions to match the conventions. --//Register the account function RegisterPlayer(login, password, sex) if not getAccount(login) then addAccount(login, password) else outputChatBox("#CC0033[sERVER]: #339933This nickname is already registered, choose a other nickname", source, 0, 0, 0, true) return 0 end local playerAccount = getAccount(login, password) setAccountData(playerAccount, "money", math.random(5000,10000)) setAccountData(playerAccount, "sex", sex) setAccountData(playerAccount, "password", password) setAccountData(playerAccount, "Kills", 0) setAccountData(playerAccount, "Deads", 0) setAccountData(playerAccount, "canSelectTeam", 1) logIn(source, playerAccount, password) outputChatBox("#CC0033[sERVER]: #339933You have successfully registered and logged in automatically, do not forget your password ", source, 0, 0, 0, true) outputChatBox("#339933[sERVER] #ffffffYour login #CC0033"..login.." #ffffffand password #CC0033"..password.."#ffffff! Good game !", source, 0, 0, 0, true) --//Remove the ability to change nickname after joined on the [sERVER]. addEventHandler("onPlayerChangeNick", source, cancelChangeNick) triggerClientEvent("login_sucsess", root, source) triggerClientEvent("step1gangs", source) end addEvent("submitRegister", true) addEventHandler("submitRegister", root, RegisterPlayer) --//Enter in Account function loginPlayer(login, password, checkBoxStat) local account = getAccount (login, password) if account then logIn (source, login, password) local playerAccount = getAccount(login, password) setAccountData(playerAccount, "savePassword", checkBoxStat) --//Remove the ability to change nickname after joined on the [sERVER]. addEventHandler("onPlayerChangeNick", source, cancelChangeNick) triggerClientEvent("login_sucsess", source, source) triggerEvent("getSavePassword", playerAccount) if not (getAccountData (playerAccount, "canSelectTeam") == 1) then triggerClientEvent("step1gangs", source) else local team = getAccountData (playerAccount, "onSavedTeam") local skin = getAccountData(playerAccount, "onSavedSkin") local weapon1 = getAccountData(playerAccount, "onSavedWeapon1") local weapon2 = getAccountData(playerAccount, "onSavedWeapon2") local weapon3 = getAccountData(playerAccount, "onSavedWeapon3") callClientFunction(source, "checkSpawns", team, skin, weapon1, weapon2, weapon3) end else outputChatBox ("#CC0033[sERVER]: #ffffffWrong #CC0033username #ffffffand/or #CC0033password!", source, 255, 255, 255, true) end end addEvent("submitLogin", true) addEventHandler("submitLogin", root, loginPlayer) --//Check password saved or no function getSavePassword( login ) local playerAccount = getAccount( login ) if playerAccount then local savePass = getAccountData(playerAccount, "savePassword") if savePass then local password = getAccountData(playerAccount, "password") triggerClientEvent("addPassword", root, password, login) end else outputChatBox ( "I got no account" ) end end addEvent("getSavePassword", true) addEventHandler("getSavePassword", root, getSavePassword) function cancelChangeNick(oldNick, newNick) cancelEvent() end --//Logged players after stop gamemode function logOutPlayer(theResourceStopped) if getResourceName(theResourceStopped) == "GangWar" then for k, players in ipairs(getElementsByType("player")) do kickPlayer(players, "Restarting Gamemode") end end end addEventHandler("onResourceStop", root, logOutPlayer) The problem was at line 32, you should use login as second argument
-
1366x768* Ok I'll check if I can make it only using the screenshots. If I can't, I will need the way you calculate the position and size of the radar (border included). Hmmm yeah, the way you calculate the bars width.
-
1 - say hello before anything else 2 - learn the basics of scripting, I would recommend to learn C before. 3 - Learn the MTA Scripting: https://wiki.multitheftauto.com/wiki/Scr ... troduction 4 - Use a proper ide (Notepad from windows isn't piece of paper, it has nothing to do with scripting) 5 - And finally do not copy/paste piece of code you do not understand (so mine too) GUIEditor = { window = {}, button = {}, gridlist = {}, edit = {} } addEventHandler("onClientResourceStart", resourceRoot, function() GUIEditor.window[1] = guiCreateWindow(252, 144, 712, 475, "Support Panel", false) guiWindowSetSizable(GUIEditor.window[1], false) GUIEditor.button[1] = guiCreateButton(585, 398, 111, 50, "Send", false, GUIEditor.window[1]) addEventHandler("onClientGUIClick", GUIEditor.button[1], onClickSend, false) guiSetProperty(GUIEditor.button[1], "NormalTextColour", "FFAAAAAA") GUIEditor.edit[1] = guiCreateEdit(35, 394, 540, 54, "", false, GUIEditor.window[1]) GUIEditor.gridlist[1] = guiCreateGridList(12, 27, 684, 361, false, GUIEditor.window[1]) local name = guiGridListAddColumn(GUIEditor.gridlist[1], "Name", 0.2) local message = guiGridListAddColumn(GUIEditor.gridlist[1], "Message", 0.8 ) end ) function onClickSend(button, state) if button == "left" then local editmsg = tostring( guiGetText( GUIEditor.edit[1] ) ) local playerName = getPlayerName( localPlayer ) local row = guiGridListAddRow ( GUIEditor.gridlist[1] ) guiGridListSetItemText ( GUIEditor.gridlist[1], row, 1, editmsg, false, false ) guiGridListSetItemText ( GUIEditor.gridlist[1], row, 1, playerName, false, false ) end )
-
Which script are you using ?
-
And you are wrong again ... The code is obviously not okay ! Did you see the screenshots he made come on, use your brain. @Dzsozi: I need to know the screen resolution of the first screenshot and if both screenshots had been just cropped/trimmed and not zoomed in or out
-
Half of this is correct. You need a variable to store the current progression (so 0 at the begining). Then use a setTimer that will increase by 1 the variable each 5 seconds. Use dxDrawText inside an onClientRender event that will print the variable and the symbol %
-
Ok so you want someone to make this gamemode for you and for free ? That's not gonna happen. A lot of other members came here to ask us to write a script/gamemode for them but without success. This is what you need to do it yourself: https://wiki.multitheftauto.com/wiki/Main_Page
-
He obviously did, but somewhere else in his code. Otherwise he wouldn't be able to take a screenshot ...
-
There is no coordinate to get ... Please read again my post. Feel free to use google translate if english isn't your native language.