
myonlake
Members-
Posts
2,312 -
Joined
-
Days Won
41
Everything posted by myonlake
-
Try these. Didn't find anything else related to it. Client-side (fr_client.lua) (updatePlayerBlips) (line 708) function updatePlayerBlips() if not g_PlayerData then return end local wnd = isWindowOpen(wndSpawnMap) and wndSpawnMap or wndSetPos local mapControl = getControl(wnd, 'map') for elem,player in pairs(g_PlayerData) do if not player.gui.mapBlip then player.gui.mapBlip = guiCreateStaticImage(0, 0, 9, 9, elem == g_Me and 'localplayerblip.png' or 'playerblip.png', false, mapControl) player.gui.mapLabelShadow = guiCreateLabel(0, 0, 100, 14, player.name, false, mapControl) local labelWidth = guiLabelGetTextExtent(player.gui.mapLabelShadow) guiSetSize(player.gui.mapLabelShadow, labelWidth, 14, false) guiSetFont(player.gui.mapLabelShadow, 'default-bold-small') guiLabelSetColor(player.gui.mapLabelShadow, 255, 255, 255) player.gui.mapLabel = guiCreateLabel(0, 0, labelWidth, 14, player.name, false, mapControl) guiSetFont(player.gui.mapLabel, 'default-bold-small') guiLabelSetColor(player.gui.mapLabel, 0, 0, 0) --[[for i,name in ipairs({'mapBlip', 'mapLabelShadow'}) do addEventHandler('onClientGUIDoubleClick', player.gui[name], function() server.warpMe(elem) closeWindow(wnd) end, false ) end]] end local x, y = getElementPosition(elem) x = math.floor((x + 3000) * g_MapSide / 6000) - 4 y = math.floor((3000 - y) * g_MapSide / 6000) - 4 guiSetPosition(player.gui.mapBlip, x, y, false) guiSetPosition(player.gui.mapLabelShadow, x + 14, y - 4, false) guiSetPosition(player.gui.mapLabel, x + 13, y - 5, false) end end Client-side (fr_client.lua) (spawnMapDoubleClick) (line 854) --[[function spawnMapDoubleClick(relX, relY) setPlayerPosition(relX*6000 - 3000, 3000 - relY*6000, 0) closeWindow(wndSpawnMap) end]]
-
Try this. Server-side addEventHandler("onResourceStart", resourceRoot, function() local root = xmlLoadFile("homes.xml") local houseroot = xmlFindChild(root, "houses", 0) if (houseroot) then allHouses = {} for i,v in ipairs (xmlNodeGetChildren(houseroot)) do local x = xmlNodeGetAttribute(v, "x") local y = xmlNodeGetAttribute(v, "y") local z = xmlNodeGetAttribute(v, "z") local number = xmlNodeGetAttribute(v, "num") if not (xmlNodeGetAttribute(v, "owner") == "") then local marker = createMarker(tonumber(x), tonumber(y), tonumber(z), "corona", 1, 0, 0, 0, 0) -- When bought local pickup = createPickup(tonumber(x), tonumber(y), tonumber(z) + 0.7, 3, 1272) setElementData(marker, "housenumber", tonumber(number)) setElementData(pickup, "housenumber", tonumber(number)) else local marker = createMarker(tonumber(x), tonumber(y), tonumber(z), "corona", 1, 0, 0, 0, 0) -- When not bought local pickup = createPickup(tonumber(x), tonumber(y), tonumber(z) + 0.7, 3, 1273) setElementData(marker, "housenumber", tonumber(number)) setElementData(pickup, "housenumber", tonumber(number)) end outputDebugString("House " .. tostring(number) .. " loaded!") end xmlUnloadFile(root) end end ) addEventHandler("onMarkerHit", root, function(hitElement, matchingDimension) if (getElementType(hitElement) == "player") and not (isPedInVehicle (hitElement)) then if (getElementData (source, "housenumber")) then local housenumber = getElementData(source, "housenumber") local root = xmlLoadFile("homes.xml") local houseHeadRootNode = xmlFindChild(root, "houses", 0) local houseRootNode = xmlFindChild (houseHeadRootNode, "house", tonumber(housenumber)) if (tostring(xmlNodeGetAttribute (houseRootNode, "owner")) == "") then triggerClientEvent(hitElement, "viewHouseGUIwindow", hitElement, "Nobody!", tostring(xmlNodeGetAttribute(houseRootNode, "cost")), housenumber) xmlUnloadFile(root) else triggerClientEvent (hitElement, "viewHouseGUIwindow", hitElement, tostring(xmlNodeGetAttribute(houseRootNode, "owner")), tostring(xmlNodeGetAttribute(houseRootNode, "cost")), housenumber) xmlUnloadFile(root) end end end end ) addEvent("HouseSystemBuyHouse", true) addEventHandler ("HouseSystemBuyHouse", root, function(housenumber) local root = xmlLoadFile("homes.xml") local houseHeadRootNode = xmlFindChild(root, "houses", 0) local houseRootNode = xmlFindChild(houseHeadRootNode, "house", tonumber(housenumber)) local price = xmlNodeGetAttribute(houseRootNode, "cost") local owner = xmlNodeGetAttribute(houseRootNode, "owner") if not (isGuestAccount (getPlayerAccount(source))) then if (owner == "") and (getPlayerMoney (source) >= tonumber(price)) then local x = xmlNodeGetAttribute(houseRootNode, "x") local y = xmlNodeGetAttribute(houseRootNode, "y") local z = xmlNodeGetAttribute(houseRootNode, "z") takePlayerMoney(source,tonumber(price)) xmlNodeSetAttribute(houseRootNode, "owner", getAccountName(getPlayerAccount(source))) outputChatBox("Congratulations, you are the new owner!", source, 255, 0, 0, false) outputChatBox("Price: ".. tostring(price) .. "$!", source, 255, 0, 0, false) destroyElement(getPickupByHousenumber(housenumber)) local pickup = createPickup(tonumber(x), tonumber(y), tonumber(z) + 0.7, 3, 1272) setElementData(pickup, "housenumber", tonumber(housenumber)) xmlSaveFile(root) elseif not (owner == "") then outputChatBox("Sorry, This house is already bought!", source, 255, 0, 0, false) elseif (getPlayerMoney (source) < tonumber(price)) then outputChatBox("Sorry, you are too poor!", source, 255, 0, 0, false) end else outputChatBox("Please log in!", source, 255, 0, 0, false) end triggerClientEvent(source, "hideHouseGuiWindow", source) xmlUnloadFile(root) end ) addEvent("HouseSystemSellHouse", true) addEventHandler("HouseSystemSellHouse", root, function(housenumber) local root = xmlLoadFile("homes.xml") local houseHeadRootNode = xmlFindChild(root, "houses", 0) local houseRootNode = xmlFindChild(houseHeadRootNode, "house", tonumber(housenumber)) local price = xmlNodeGetAttribute(houseRootNode, "cost") local owner = xmlNodeGetAttribute(houseRootNode, "owner") if not (isGuestAccount(getPlayerAccount(source))) then if (owner == getAccountName(getPlayerAccount(source))) then local x = xmlNodeGetAttribute(houseRootNode, "x") local y = xmlNodeGetAttribute(houseRootNode, "y") local z = xmlNodeGetAttribute(houseRootNode, "z") givePlayerMoney(source, tonumber(price)/2) xmlNodeSetAttribute(houseRootNode, "owner", "") outputChatBox("Congratulations, you have sold the home!", source, 255, 0, 0, false) outputChatBox("Obtain: ".. tostring(price)/2 .. "$!", source, 255, 0, 0, false) destroyElement(getPickupByHousenumber(housenumber)) local pickup = createPickup(tonumber(x), tonumber(y), tonumber(z) + 0.7, 3, 1273) setElementData(pickup, "housenumber", tonumber(housenumber)) xmlSaveFile(root) elseif not (owner == getAccountName(getPlayerAccount(source))) then outputChatBox("This isn't your house!", source, 255, 0, 0, false) end else outputChatBox("Please log in!", source, 255, 0, 0, false) end triggerClientEvent(source, "hideHouseGuiWindow", source) xmlUnloadFile(root) end ) addEvent("HouseSystemEnterHouse", true) addEventHandler("HouseSystemEnterHouse", root, function(housenumber) local root = xmlLoadFile("homes.xml") local houseHeadRootNode = xmlFindChild(root, "houses", 0) local houseRootNode = xmlFindChild(houseHeadRootNode, "house", tonumber(housenumber)) local x,y,z = getElementPosition(source) if (xmlNodeGetAttribute(houseRootNode, "owner") == "") then local interiornumber = xmlNodeGetAttribute(houseRootNode, "interior") local interiorRootNode = xmlFindChild(xmlFindChild(root, "interiors", 0), "interior", tonumber(interiornumber)) setElementData(source, "posx", x) setElementData(source, "posy", y) setElementData(source, "posz", z) setElementInterior(source, tonumber(xmlNodeGetAttribute(interiorRootNode, "id")), tonumber(xmlNodeGetAttribute(interiorRootNode, "x")), tonumber(xmlNodeGetAttribute(interiorRootNode, "y")), tonumber(xmlNodeGetAttribute(interiorRootNode, "z"))) setElementDimension(source, xmlNodeGetAttribute(houseRootNode, "dim")) outputChatBox("Welcome! This house isn't bought yet!", source, 0, 255, 0, false) outputChatBox("To Exit This House, Type /exithouse", source, 255, 255, 0, false) triggerClientEvent(source, "hideHouseGuiWindow", source) elseif (getAccountName(getPlayerAccount(source)) == xmlNodeGetAttribute(houseRootNode, "owner")) then local interiornumber = xmlNodeGetAttribute(houseRootNode, "interior") local interiorRootNode = xmlFindChild(xmlFindChild (root, "interiors", 0), "interior", tonumber(interiornumber)) setElementData(source, "posx", x) setElementData(source, "posy", y) setElementData(source, "posz", z) setElementInterior(source, tonumber(xmlNodeGetAttribute(interiorRootNode, "id")), tonumber(xmlNodeGetAttribute(interiorRootNode, "x")), tonumber(xmlNodeGetAttribute(interiorRootNode, "y")), tonumber(xmlNodeGetAttribute(interiorRootNode, "z"))) setElementDimension(source,xmlNodeGetAttribute(houseRootNode, "dim")) outputChatBox("Welcome!", source, 0, 255, 0, false) outputChatBox("To Exit Your House, Type /exithouse", source, 255, 255, 0, false) triggerClientEvent(source, "hideHouseGuiWindow", source) elseif not (getAccountName(getPlayerAccount(source)) == xmlNodeGetAttribute(houseRootNode, "owner")) then outputChatBox("You aren't the owner of this home!", source, 255, 0, 0, false) outputChatBox("If you are, make sure you are logged in!", source, 255, 0, 0, false) end xmlUnloadFile(root) end ) addCommandHandler("exithouse", function(thePlayer, cmd) if (getElementInterior(thePlayer) ~= 0) and (getElementData(thePlayer, "posx")) and (getElementData(thePlayer, "posy")) and (getElementData(thePlayer, "posz")) then setElementPosition(thePlayer, getElementData (thePlayer, "posx"), getElementData (thePlayer, "posy"), getElementData (thePlayer, "posz")) setElementInterior(thePlayer, 0) setElementDimension(thePlayer, 0) removeElementData(thePlayer, "posx") removeElementData(thePlayer, "posy") removeElementData(thePlayer, "posz") end end ) addCommandHandler("createhouse", function(thePlayer, cmd, interiorid, dimension, price) if (interiorid) and (dimension) and (price) and (not isPedInVehicle(thePlayer)) then if (hasObjectPermissionTo(thePlayer, "command.aexec", false)) then local x, y, z = getElementPosition(thePlayer) local root = xmlLoadFile("homes.xml") local housesRoot = xmlFindChild(root, "houses",0) local newHouse = xmlCreateChild(housesRoot, "house") xmlNodeSetAttribute(newHouse, "num", tonumber(getHouseCount()) xmlNodeSetAttribute(newHouse, "interior", interiorid) xmlNodeSetAttribute(newHouse, "x", x) xmlNodeSetAttribute(newHouse, "y", y) xmlNodeSetAttribute(newHouse, "z", z) xmlNodeSetAttribute(newHouse, "cost", price) xmlNodeSetAttribute(newHouse, "owner", "") xmlNodeSetAttribute(newHouse, "dim", dimension) outputChatBox("The house will appear when you restart the resource!", thePlayer, 255, 0, 0, false) xmlSaveFile(root) xmlUnloadFile(root) else outputChatBox("Admin only!", thePlayer, 255, 0, 0, false) end else outputChatBox("Wrong syntax, or get out of your vehicle!", thePlayer, 255, 0, 0, false) outputChatBox("SYNTAX: /" .. cmd .. " [interior ID] [Dimension] [price in $]", thePlayer, 255, 0, 0, false) outputChatBox(" Interior ID - standard 0-21 - the standard houses.", thePlayer, 255, 0, 0, false) outputChatBox(" Dimension - number between 0 and 65535, always take another each interior!", thePlayer, 255, 0, 0, false) outputChatBox(" Price - How much does the home cost?", thePlayer, 255, 0, 0, false) end end ) function getHouseCount() local root = xmlLoadFile("homes.xml") local housesRoot = xmlFindChild(root, "houses", 0) houses = 0 for i,v in ipairs(xmlNodeGetChildren(housesRoot)) do houses = houses+1 end xmlUnloadFile(root) return houses end function getMarkerByHousenumber(housenumber) for i,v in ipairs(getElementsByType("marker")) do if (tonumber(getElementData(v, "housenumber")) == tonumber(housenumber)) then return v end end end function getPickupByHousenumber(housenumber) for i,v in ipairs(getElementsByType("pickup")) do if (tonumber(getElementData(v, "housenumber")) == tonumber(housenumber)) then return v end end end
-
Copy my code again, didn't see the second check.
-
Stop bumping because... 1. It's not allowed, 2. You don't seem to know what bumping means removeWorldModel
-
You don't know what you're doing if you're doing it that way. getRealTime() fetches the server's time. If you really want that, then okay, I have included two types of code below. In real life time: Server-side function SpawnZombie() local pacecount = 0 local time = getRealTime() if (time.hour > 0) and (time.hour < 7) then while pacecount < 5 do if (table.getn(everyZombie)+pacecount < newZombieLimit) and (ZombieStreaming == 1) then local xcoord = 0 local xdirection = math.random(1,2) if xdirection == 1 then xcoord = math.random(15,40) else xcoord = math.random(-40,-15) end local ycoord = 0 local ydirection = math.random(1,2) if ydirection == 1 then ycoord = math.random(15,40) else ycoord = math.random(-40,-15) end if (table.getn(getAlivePlayers()) > 0) then local lowestcount = 99999 local lowestguy = nil for PKey,thePlayer in ipairs(getAlivePlayers()) do if isElement(thePlayer) then if (getElementData(thePlayer, "dangercount")) and (getElementData(thePlayer, "zombieProof") ~= true) and (getElementData(thePlayer, "alreadyspawned") == true) then if (getElementData(thePlayer, "dangercount") < lowestcount) then local safezone = 0 local gx, gy, gz = getElementPosition(thePlayer) for theKey,theradar in ipairs(getElementsByType("radararea")) do if getElementData(theradar, "zombieProof") == true then if isInsideRadarArea(theradar, gx, gy) then safezone = 1 end end end if safezone == 0 then lowestguy = thePlayer lowestcount = getElementData(thePlayer, "dangercount") end end end end end pacecount = pacecount+1 if isElement(lowestguy) then triggerClientEvent("Spawn_Placement", lowestguy, ycoord, xcoord) else pacecount = pacecount+1 end else pacecount = pacecount+1 end else pacecount = pacecount+1 end end end end In-game time: Server-side function SpawnZombie() local pacecount = 0 local hour, minute = getTime() if (hour > 0) and (hour < 7) then while pacecount < 5 do if (table.getn(everyZombie)+pacecount < newZombieLimit) and (ZombieStreaming == 1) then local xcoord = 0 local xdirection = math.random(1,2) if xdirection == 1 then xcoord = math.random(15,40) else xcoord = math.random(-40,-15) end local ycoord = 0 local ydirection = math.random(1,2) if ydirection == 1 then ycoord = math.random(15,40) else ycoord = math.random(-40,-15) end if (table.getn(getAlivePlayers()) > 0) then local lowestcount = 99999 local lowestguy = nil for PKey,thePlayer in ipairs(getAlivePlayers()) do if isElement(thePlayer) then if (getElementData(thePlayer, "dangercount")) and (getElementData(thePlayer, "zombieProof") ~= true) and (getElementData(thePlayer, "alreadyspawned") == true) then if (getElementData(thePlayer, "dangercount") < lowestcount) then local safezone = 0 local gx, gy, gz = getElementPosition(thePlayer) for theKey,theradar in ipairs(getElementsByType("radararea")) do if getElementData(theradar, "zombieProof") == true then if isInsideRadarArea(theradar, gx, gy) then safezone = 1 end end end if safezone == 0 then lowestguy = thePlayer lowestcount = getElementData(thePlayer, "dangercount") end end end end end pacecount = pacecount+1 if isElement(lowestguy) then triggerClientEvent("Spawn_Placement", lowestguy, ycoord, xcoord) else pacecount = pacecount+1 end else pacecount = pacecount+1 end else pacecount = pacecount+1 end end end end
-
You're welcome.
-
Your script has way too many timers, which can cause server to lag or clients to crash. I suggest no using timers at all, because I honestly can't see any idea why to use timers. Secondly, this is the wrong section to post your issues with scripts. Here is the section for script issues » Try the code below. Server-side local arte = createMarker(-2200.11, 2400.68, 4.97, "corona", 1, 255, 255, 255, 255) createBlipAttachedTo(arte, 25) outputChatBox("* Artefakt pojawia sie w okolicach miasteczka Bayside!", root, 244, 211, 27, false) addEventHandler("onMarkerHit", arte, function(hitElement, matchingDimension) if getElementType(hitElement) == "player" and matchingDimension then outputChatBox("* " .. getPlayerName(hitElement) .. " podnosi artefakt!", root, 244, 211, 27, false) attachElements(arte, hitElement) -- zdrowie, naprawa pojazdu setTimer( setElementHealth(hitElement, 1000) outputChatBox("* Artefakt ulecza Cie!", hitElement, 244, 211, 27, false) playSoundFrontEnd(hitElement, 45) end, 160000, 1, hitElement) -- kasa setTimer(function(hitElement) givePlayerMoney(hitElement, math.random(10000, 50000)) outputChatBox("* Artefakt dodaje Ci pieniedzy!", hitElement, 244, 211, 27, false) playSoundFrontEnd(hitElement, 45) end, 300000, 1, hitElement) -- armor setTimer(function(hitElement) setPedArmor(hitElement, 1000) outputChatBox("* Artefakt dodaje Ci armora!", hitElement, 244, 211, 27, false) playSoundFrontEnd(hitElement, 45) end, 360000, 1, hitElement) end end ) addEventHandler("onPlayerWasted", root, function(ammo, killer, weapon, bodypart, stelath) detachElements(arte, source) outputChatBox("* Artefakt zostal upuszczony!", root, 244, 211, 27, false) end )
-
This is true. Element datas are attached to the element and if the element doesn't exist, the data won't be there either.
-
/resetclock to reset the ticker. Client-side local screenX, screenY = guiGetScreenSize() local second = 0 local display = false addCommandHandler("clock", function() if isTimer(clocktimer) then killTimer(clocktimer) else clocktimer = setTimer(function() second = second+1 end, 1000, 0) end end ) addCommandHandler("resetclock", function() second = 0 end ) addCommandHandler("display", function(cmd) if display then removeEventHandler("onClientRender", root, displayClock) display = false else addEventHandler("onClientRender", root, displayClock) display = true end end ) function displayClock() dxDrawRectangle(screenX * 0.40, screenY * 0.09, 250, 50, tocolor(0,0,0,150)) dxDrawText(second, screenX * 0.48, screenY * 0.1, screenX, screenY, tocolor(255,255,255), 2) end
-
Forgot one thing. Client-side local screenX, screenY = guiGetScreenSize() local second = 0 local display = false addCommandHandler("clock", function() if isTimer(clocktimer) then killTimer(clocktimer) else clocktimer = setTimer(function() second = second+1 end, 1000, 0) end end ) addCommandHandler("display", function(cmd) if display then removeEventHandler("onClientRender", root, displayClock) display = false else addEventHandler("onClientRender", root, displayClock) display = true end end ) function displayClock() dxDrawRectangle(screenX * 0.40, screenY * 0.09, 250, 50, tocolor(0,0,0,150)) dxDrawText(second, screenX * 0.48, screenY * 0.1, screenX, screenY, tocolor(255,255,255), 2) end
-
I do not understand your code at all. It should always return a zero value because you're minusing it from tick count and another tick count. There's no sense at all. This is one example how to make a timer clock. /clock = toggle the clock ticking /display = toggle the clock display Client-side local screenX, screenY = guiGetScreenSize() local second = 0 local display = false addCommandHandler("clock", function() if isTimer(clocktimer) then killTimer(clocktimer) else clocktimer = setTimer(function() second = second+1 end, 1000, 0) end end ) addCommandHandler("display", function(cmd) if display then removeEventHandler("onClientRender", root, displayClock) else addEventHandler("onClientRender", root, displayClock) end end ) function displayClock() dxDrawRectangle(screenX * 0.40, screenY * 0.09, 250, 50, tocolor(0,0,0,150)) dxDrawText(second, screenX * 0.48, screenY * 0.1, screenX, screenY, tocolor(255,255,255), 2) end
-
I don't think there's nothing we can do about it. Perhaps file a Mantis Bug Tracker report for MTA Developers to fix the bug. I can also see a bug in the rendering of radar areas, it simply makes it very weird looking and never stays where it should.
-
You have to check all seats and if they are occupied or not. warpPedIntoVehicle getPedOccupiedVehicleSeat getVehicleMaxPassengers getVehicleOccupants
-
Just do this since I red your code wrong. Client-side addEventHandler("onClientResourceStart", resourceRoot, function() fadeCamera(true, 5) setCameraMatrix(1468.8785400391, -919.25317382813, 100.153465271, 1468.388671875, -918.42474365234, 99.881813049316) end )
-
You're welcome but copy the code once more, fixed one thing.
-
This is because the timer wasn't stopped. Copy my code again. EDIT: Copy the code once more, forgot something else.
-
You're welcome, but as a pro-tip, I suggest that you should always go through the code many times yourself and look at what's wrong, it is very simple to notice that something is wrong. This way you can prevent mass posts.
-
Exactly. Webhosts do not allow database connections from anywhere else than the server, you can bypass this with PHPSDK for MTA
-
You forgot the event arguments. Client-side local vehHealth = guiCreateLabel(0.48, 0.965, 0.3, 0.1, "Vehicle Health: N/A", true) addEventHandler("onClientVehicleEnter", root, function(player, seat) local vehicleHealth = getPedOccupiedVehicle(player) if vehicleHealth then hpTimer = setTimer(function(player) if isPedInVehicle(player) then guiSetText(vehHealth, "Vehicle Health: " .. math.ceil(getElementHealth(vehicleHealth))) else killTimer(hpTimer) end end, 50, 0, player) end end ) addEventHandler("onClientVehicleExit", root, function(player, seat) guiSetText(vehHealth, "Vehicle Health: N/A") if isTimer(hpTimer) then killTimer(hpTimer) end end )
-
Replace the below code with the one you can find from the script. Server-side triggerClientEvent(source, "onClientPlayerSerialFetched", source, getPlayerSerial(target))
-
Huh? Boolean value can be true or false, your post doesn't tell me whether is works or not. Any errors in debug?
-
Remember to change the source elements to localPlayer.
-
You only had to change one line of code above there. Well did it work or not?