Jump to content

TheGamingMann

Members
  • Posts

    54
  • Joined

  • Last visited

Everything posted by TheGamingMann

  1. I FEEL SO DUMB... I spelt type wrong in my meta... Fixed it.
  2. function cancelEvent() cancelEvent() setElementHealth(getRootElement(), 100) outputChatBox("Test") end addEventHandler("onClientPlayerDamage", getRootElement(), cancelEvent) Thats the new code. None of those in the function are running. Here is my meta.xml "TheGamingMann" name="Server Info" version="1.0" description="Sets the server info on resource start."/>
  3. I am not quite sure what is going on. But my script keeps giving me this error and its not working. Here's my code: function cancelDamage() cancelEvent() end addEventHandler("onClientDamage", getLocalPlayer(), cancelDamage) This is a client side script as well.
  4. AHHH! I got it thanks. I forgot to change the argument on the event handler to root. My bad. Thanks man.
  5. Thanks for the quick reply but I tried it and it doesn't seem to work. The vehicle stay on when I disconnect and reconnect.
  6. Hey guys I am making a function that will shut a vehicles engine off when the player leaves the server. This i not working at the moment. Any help would be appreciated. function engineOffLeave() if (getPedOccupiedVehicle(source) == true) then local vehicle = getPedOccupiedVehicle(source) if (getVehicleEngineState(source) == true) then setVehicleEngineState(source, false) end end end addEventHandler("onPlayerQuit", root, engineOffLeave) Thanks guys.
  7. Thanks man that worked. Thank you so much for helping. There are so many friendly people on here. Have a good night/day.
  8. Those are just test messages. the problem I am having is it sends the message globally if there is no player by the name in the server.
  9. Hello. I am attempting to make a custom PM system but I am having some issues. I get no errors but it sends the pm to me no matter what... I am confused. *EDIT* So I figured this out the PM works... it sends right but it sends to global when there is no one in the server with that name. or partial name... still really confused. function privateMessageTwo(player, command, sentTo, ...) if (command == "pm") then local messageTable = {...} local message = table.concat(messageTable, " ") local sendTo = getPlayerFromPartialName(sentTo, player) if (sendTo ~= "") then if (message ~= "") then outputChatBox("#00FF00[PM FROM]#FFFFFF"..getPlayerName(player).."#BDBDBD: "..message, sendTo, 255, 255, 255, true) outputChatBox("#00FF00[PM TO]#FFFFFF"..getPlayerName(sendTo).."#BDBDBD: "..message, player, 255, 255, 255, true) else outputChatBox("Failed No Message") end else outputChatBox("Failed No Name") end else outputChatBox("Failed No Command") end end addCommandHandler("pm", privateMessageTwo) 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
  10. Thanks man. I didn't notice that spelling mistake I feel like such a noob now lol. My bad. But thanks again man.
  11. Not I am trying to update the players load count like deliver count when they login. Currently it does not update the score board so it stays blank until they deliver a load.
  12. People don't like to help others with leaked RP scripts. I am not sure if they are yours or not but guessing by the way that you don't know what resource to look at I think its leaked. So I would not be willing to help you. Sorry. I am not sure about others but I think most people would say they wont help you with leaked scripts.
  13. Hey guys again. I got the system to work now I am just trying to update the scoreboard with the players load count when they login. It does not seem to show up on the scoreboard until a load is complete. Any help will be greatly appreciated. s_login.lua function loginHandler(password) local account = getAccount(getPlayerName(source)) if (account ~= false) then local loggedIn = logIn(source, account, password) if (loggedIn ~= false) then outputChatBox(" ", source) outputChatBox(" ", source) outputChatBox(" ", source) outputChatBox(" ", source) outputChatBox(" ", source) outputChatBox(" ", source) outputChatBox(" ", source) outputChatBox(" ", source) outputChatBox(" ", source) outputChatBox(" ", source) outputChatBox("Welcome back "..getPlayerName(source):gsub('#%x%x%x%x%x%x', '')..".", source, 18, 11, 150) triggerClientEvent("hideLoginWindow", source) else outputChatBox(" ", source) outputChatBox(" ", source) outputChatBox(" ", source) outputChatBox(" ", source) outputChatBox(" ", source) outputChatBox(" ", source) outputChatBox(" ", source) outputChatBox(" ", source) outputChatBox(" ", source) outputChatBox(" ", source) outputChatBox("Invalid password entered.", source) end else if (password ~= "" and password ~= nil) then local accountAdded = addAccount(getPlayerName(source), password) if (accountAdded) then outputChatBox("Thank you for registering "..getPlayerName(source):gsub('#%x%x%x%x%x%x', '')..".", source, 112, 0, 0) outputChatBox("If you click 'Submit' again you can login.", source, 112, 0, 0) end else outputChatBox("You must enter a password.", source) end end end addEvent("accLogReg", true) addEventHandler("accLogReg", root, loginHandler) function saveAccount() local playerAcc = getPlayerAccount(source) local playerCash = getPlayerMoney(source) setAccountData(playerAcc, "hdt.cash", playerCash) end addEventHandler("onPlayerQuit", getRootElement(), saveAccount) function loadAccount() local playerAcc = getPlayerAccount(source) if (playerAcc) then local playerCash = getAccountData(playerAcc, "hdt.cash") local playerLoads = getAccountData(playerAcc, "hdt.loads") if (playerCash) then setPlayerMoney(source, playerCash) end if (playerLoads) then setElemntData(source, "Completed Loads", playerLoads) else setElementData(source, "Completed Loads", 0) end end end addEventHandler("onPlayerLogin", getRootElement(), loadAccount) I think that is the only file that matters. If you don't think so let me know and I can get your more. Thanks.
  14. Sorry for the long reply. I was a little busy. I got it working now due to your code. Thanks man.
  15. Thanks for the quick reply, I just tried that and it still doesn't seem to show up at all in the scoreboard.
  16. Hey guys. I am trying to make to a completed loads Column for my server, I have the Column made but I cant seem to get it to display numbers. Any help would be greatly appreciated. c_scoreboard.lua function addColums() call(getResourceFromName("hdt-scoreboard"), "scoreboardAddColumn", "Completed Loads", 100) end addEventHandler("onClientResourceStart", getRootElement(), addColums) s_load.lua function finishLoad(player, cash) local cash = tostring(cash) givePlayerMoney(player, tonumber(cash)) setLoadCount() end addEvent("finishRoute", true) addEventHandler("finishRoute", root, finishLoad) function setLoadCount() local playerAcc = getPlayerAccount(source) local loads = getAccountData(playerAcc, "hdt.loads") if (loads) then setAccountData(playerAcc, "hdt.loads", loads+1) setElementData(source, "Completed Loads", loads) end end If you need the meta's for both scripts let me know. Thanks again guys.
  17. Thanks TAPL. It works. I thought I tried that before the post.. Odd. But thanks again man.
  18. This is what I have, here are my two pieces of code. It keeps saying that argument 2 is nil. addEventHandler("onClientGUIAccepted", edtInfo, function() local password = guiGetText(edtInfo) triggerServerEvent("accLogReg", localPlayer, password) end ) function createRegister() local screenW, screenH = guiGetScreenSize() wdwAccount = guiCreateWindow((screenW - 378) / 2, (screenH - 109) / 2, 378, 109, "Register/Login", false) guiWindowSetSizable(wdwAccount, false) lblPassword = guiCreateLabel(10, 37, 102, 15, "Enter a Password", false, wdwAccount) guiSetFont(lblPassword, "default-bold-small") edtInfo = guiCreateEdit(127, 33, 240, 24, "", false, wdwAccount) addEventHandler("onClientGUIAccepted", edtInfo, guiEditSetMasked(edtInfo, true) btnSubmit = guiCreateButton(112, 67, 153, 30, "Submit", false, wdwAccount) --addEventHandler("onClientGUIClick", btnSubmit, accRequest, false) end
  19. So I have tested that the key is bound and it is.. The issue is the key doesn't seem to log me in when I hit it. Any help would be great. This is also not throwing any errors at the debug so. c_login.lua function showRegister() if not guiGetVisible(wdwAccount) then guiSetVisible(wdwAccount, true) guiSetInputEnabled(true) showCursor(true, true) bindKey("enter", "down", accRequest) end end function hideRegister() guiSetVisible(wdwAccount, false) showCursor(false, false) guiSetInputEnabled(false) triggerEvent("showSpawnWindow", localPlayer) unbindKey(localPlayer, "enter", "down", accRequest) end addEvent("hideLoginWindow", true) addEventHandler("hideLoginWindow", localPlayer, hideRegister) function accRequest(key, keyState) local password = guiGetText(edtInfo) triggerServerEvent("accLogReg", localPlayer, password) end Thanks in advance.
  20. Okay... It worked.. I guess the issue was that the "cash" variable wasn't in a string format so it was not converting correctly. It now works and I changed the code a little so it does not output to the chat. Thanks man.
  21. Hello. So I am simply getting an error that is saying bad argument. I have tried many things to sort this out and have not solved the issue yet. Code below. c_load.lua: function loadHandler(button, state) if button == "left" and state == "up" then local row, col = guiGridListGetSelectedItem(glistLoadList) local startpos = guiGridListGetItemData(glistLoadList, row, 2) local endpos = guiGridListGetItemData(glistLoadList, row, 3) local cash = guiGridListGetItemData(glistLoadList, row, 4) if row and col and row ~= -1 and col ~=-1 then startx, starty, startz = unpack(startpos) endx, endy, endz = unpack(endpos) cash = unpack(cash) createLoadStart() end end end function createLoadStart() startMarker = createMarker(startx, starty, startz, "checkpoint", 7) startBlip = createBlip(startx, starty, startz, 0, 2, 0, 0, 255) hideLoad() end function startLoading() local vehicle = getPedOccupiedVehicle(localPlayer) if isElementWithinMarker(localPlayer, startMarker) then if vehicle then if (getElementModel(vehicle)) == 403 or (getElementModel(vehicle)) == 515 or (getElementModel(vehicle)) == 514 then trailer = createVehicle(435, -99, -57, 3.5, 0, 0, 167) guiSetText(lblLoading, "Loading...") guiSetVisible(lblLoading, true) attachTrailerToVehicle(vehicle, trailer) setElementFrozen(vehicle, true) setTimer(function () guiSetVisible(lblLoading, false) setElementFrozen(vehicle, false) end, 10*1000, 1) destroyElement(startMarker) destroyElement(startBlip) endMarker = createMarker(endx, endy, endz, "checkpoint", 7) endBlip = createBlip(endx, endy, endz, 0, 2, 255, 0, 0) end else outputChatBox("You need to be in some sort of 18 Wheeler to take a job.", localPlayer) end else outputChatBox("You need to be in the load marker to get the trailer.", localPlayer) end end addCommandHandler("load", startLoading) function startUnLoading() local person = localPlayer local vehicle = getPedOccupiedVehicle(localPlayer) if isElementWithinMarker(localPlayer, endMarker) then if vehicle then if getVehicleTowingVehicle(trailer) == vehicle then guiSetText(lblLoading, "Unloading...") guiSetVisible(lblLoading, true) setElementFrozen(vehicle, true) setTimer(function () guiSetVisible(lblLoading, false) setElementFrozen(vehicle, false) detachTrailerFromVehicle(vehicle) destroyElement(trailer) end, 10*1000, 1) destroyElement(endMarker) destroyElement(endBlip) triggerServerEvent("finishRoute", localPlayer, person, cash) end end else outputChatBox("You need to be in the unload marker to unload the trailer.", localPlayer) end end addCommandHandler("unload", startUnLoading) s_load.lua: function finishLoad(person, cash) givePlayerMoney(person, tonumber(cash)) end addEvent("finishRoute", true) addEventHandler("finishRoute", root, finishLoad) Thanks in advance guys.
  22. You are just setting their positions. I am new to this so it may be wrong but you want to "spawnPlayer" instead of setting the position when they die.
  23. Will try your code Anu whe n Iget home. Thanks for the help.
×
×
  • Create New...