thegost Posted November 16, 2015 Share Posted November 16, 2015 (edited) Hey ALL I have one script good House Robbery But He have problem and how WHEN PEOPLE(Criminals) GO FOR hr ( houserobbery ) A share of stay in 0 % (The percent not increases and hr not finich) layover and not increase the Faster Help In this script possible : server: houserobTime = (1000*60)*15 -- 1 min. until houserob cancels newHouserobTime = (1000*60)*5 -- 1 min. until houserob cancels ppP = 0.5 -- 1 % per Player in the circle every 5 sec robberTeams = { ["Criminal"] = true,["Sons Of Anarchy"] = true,["CLO"] = true, ["Official Gangs"] = true} houserob = {} houserob[1] = {2398.1826171875,-1893.1015625,13.3828125} houserob[2] = {2101.4228515625,-1806.6171875,13.5546875} houserob[3] = {427.2880859375,-1759.33203125,8.1472320556641} houserob[4] = {479.3154296875,-1534.490234375,19.641231536865} houserob[5] = {997.5947265625,-916.9677734375,42.1796875} houserob[6] = {2421.115234375,-1225.072265625,25.148614883423} houserob[7] = {1941.6552734375,-2116.6669921875,13.6953125} houserob[8] = {1834.2509765625,-1682.2880859375,13.439321517944} houserob[9] = {1929.76171875,-1775.720703125,13.546875} houserob[10] = {980.1845703125,-676.259765625,121.97625732422} houserob[11] = {-2321.94140625,-156.609375,35.5546875} houserob[12] = {-2494.0869140625,-27.7158203125,25.765625} houserob[13] = {-2673.0634765625,262.4248046875,4.6328125} houserob[14] = {-2766.0546875,787.8828125,52.78125} houserob[15] = {-2442.828125,753.923828125,35.171875} houserob[16] = {-2626.1259765625,1410.14453125,7.09375} houserob[17] = {-2522.6962890625,1216.8056640625,37.428329467773} houserob[18] = {-1724.7724609375,1360.3515625,7.1875} houserob[19] = {-1911.1806640625,830.68359375,35.171875} houserob[20] = {-1722.484375,-117.34375,3.5489187240601} houserob[21] = {1383, 1023.6, 10.8} houserob[22] = {1694.1, 2198.3, 10.8} houserob[23] = {2442.5009765625,2059.21484375,10.8203125} houserob[24] = {2628.7392578125,1844.1953125,10.8203125} houserob[25] = {2506.900390625,1247.271484375,10.8203125} houserob[26] = {2543.064453125,1018.7802734375,10.812517166138} houserob[27] = {2392.185546875,696.220703125,11.39614200592} houserob[28] = {1608.7568359375,712.177734375,10.8203125} houserob[29] = {946.73046875,1732.1171875,8.8515625} houserob[30] = {1461.6484375,2775.41796875,10.8203125} local informTeams = {["Police"]=true,["Desert Eagles"]=true,["Official Squads"]=true} function addHouserob() firstTime = nil triggerClientEvent("showHouserobBlip", getRootElement(), 0) if houserobMarker then destroyElement(houserobMarker) houserobMarker = nil end if houserobBlip then destroyElement(houserobBlip) houserobBlip = nil end if houserobPickup then destroyElement(houserobPickup) houserobPickup = nil end if houserobTimer then killTimer(houserobTimer) houserobTimer = nil end if checkTimer then killTimer(checkTimer) checkTimer = nil end if houserobCircle then destroyElement(houserobCircle) houserobCircle = nil end houserobNumber = math.random(#houserob) if houserobNumber then houserobPickup = createPickup(houserob[houserobNumber][1],houserob[houserobNumber][2],houserob[houserobNumber][3],3,1274, 0, 0 ) houserobMarker = createMarker(houserob[houserobNumber][1],houserob[houserobNumber][2],houserob[houserobNumber][3]-3,"cylinder", 20, 255, 100, 100, 20) setElementData(houserobMarker, "percent", 0) triggerClientEvent("showHouserobBlip", getRootElement(), 1, houserob[houserobNumber][1],houserob[houserobNumber][2],houserob[houserobNumber][3]) houserobBlip = createBlip(houserob[houserobNumber][1],houserob[houserobNumber][2],houserob[houserobNumber][3],43, 2, 255, 255, 255, 255, 0, 9999, getRootElement()) setElementVisibleTo (houserobBlip, getRootElement ( ), false ) houserobCircle = createColCircle(houserob[houserobNumber][1],houserob[houserobNumber][2], 10) addEventHandler("onPickupHit", houserobPickup, startHouserob) addEventHandler("onColShapeHit", houserobCircle, showProcess) addEventHandler("onColShapeLeave", houserobCircle, hideProcess) local x,y,z = getElementPosition(houserobCircle) for k, v in ipairs(getElementsByType("player")) do if getPlayerTeam(v) and informTeams[getTeamName(getPlayerTeam(v))] then exports.RPGcommands:sendMessage("*HOUSEROB* There is a house robbery taking place at "..getZoneName(x,y,z)..", "..getZoneName(x,y,z,true)..".",255,0,0,v) end end end end function startHouserob(player) if robberTeams[getTeamName(getPlayerTeam(player))] then exports.RPGcommands:sendMessage("Call more players to do a faster houserob!", 255, 100, 0, player) if houserobPickup then destroyElement(houserobPickup) houserobPickup = nil end houserobTimer = setTimer(stopHouserobUnfinished, houserobTime, 1) local x, y, z = getElementPosition(houserobMarker) local zone = getZoneName(x,y,z,false) local zone1 = getZoneName(x,y,z,true) checkHouseForPercentage() end end function checkHouseForPercentage() checkTimer = nil if houserobBlip then count = 0 for i, robber in ipairs (getElementsWithinColShape(houserobCircle, "player")) do if not isPedDead(robber) and robberTeams[getTeamName(getPlayerTeam(robber))] then count = count +1 wl = getElementData(robber, "wanted") +1 if wl > 36 then wl = 36 end exports.RPGPolice:setWantedLevel(robber, wl) end end if not firstTime then firstTime = 0 for i, robber in pairs (getElementsWithinColShape(houserobCircle, "player")) do if not isPedDead(robber) and robberTeams[getTeamName(getPlayerTeam(robber))] then showProcess(robber) end end end if count > 0 then local percent = getElementData(houserobMarker, "percent") local percent = percent + (count*ppP) if percent > 0 then triggerClientEvent("showHouserobBlip", getRootElement(), 2, houserob[houserobNumber][1],houserob[houserobNumber][2],houserob[houserobNumber][3]) end if percent > 100 then setElementData(houserobMarker, "percent", 100) nextStep() else setElementData(houserobMarker, "percent", percent) end end checkTimer = setTimer(checkHouseForPercentage, 5000, 1) end end function showProcess(robber) if getElementType(robber) == "player" and robberTeams[getTeamName(getPlayerTeam(robber))] then triggerClientEvent("showProcess", getRootElement(), robber, houserobMarker) end end function hideProcess(robber) if getElementType(robber) == "player" and robberTeams[getTeamName(getPlayerTeam(robber))] then triggerClientEvent("hideProcess", getRootElement(), robber) end end function nextStep() for i, robber in pairs (getElementsWithinColShape(houserobCircle, "player")) do if not isPedDead(robber) and isPedOnGround(robber) and robberTeams[getTeamName(getPlayerTeam(robber))] then exports.RPGcommands:giveMoney(robber, 10000) exports.RPGcommands:sendMessage("You got $10000 from the rob, go to the a warehouse in the city to get more money!", 0, 255, 0, robber) triggerClientEvent("showWarehouses", robber) end end firstTime = nil triggerClientEvent("showHouserobBlip", getRootElement(), 0) if houserobMarker then destroyElement(houserobMarker) houserobMarker = nil end if houserobBlip then destroyElement(houserobBlip) houserobBlip = nil end if houserobPickup then destroyElement(houserobPickup) houserobPickup = nil end if houserobTimer then killTimer(houserobTimer) houserobTimer = nil end if checkTimer then killTimer(checkTimer) checkTimer = nil end if houserobCircle then destroyElement(houserobCircle) houserobCircle = nil end setTimer(addHouserob, newHouserobTime, 1) end function stopHouserobUnfinished () firstTime = nil triggerClientEvent("showHouserobBlip", getRootElement(), 0) if houserobMarker then destroyElement(houserobMarker) houserobMarker = nil end if houserobBlip then destroyElement(houserobBlip) houserobBlip = nil end if houserobPickup then destroyElement(houserobPickup) houserobPickup = nil end if houserobTimer then killTimer(houserobTimer) houserobTimer = nil end if checkTimer then killTimer(checkTimer) checkTimer = nil end if houserobCircle then destroyElement(houserobCircle) houserobCircle = nil end setTimer(addHouserob, newHouserobTime, 1) end function waitTime() setTimer(addHouserob, 5000, 1) end addEventHandler("onResourceStart", getResourceRootElement(getThisResource()), waitTime) HELP ME PLEASE!! Edited November 18, 2015 by Guest Link to comment
Addlibs Posted November 16, 2015 Share Posted November 16, 2015 (edited) I doubt that you own any rights to this script. Edited November 16, 2015 by Guest Link to comment
thegost Posted November 16, 2015 Author Share Posted November 16, 2015 Yes I have , I and My friend NoBiTa create this script but we see outher scrits the robbers.... and we add scripts part and create this , but not work good can help me please ? Link to comment
Addlibs Posted November 16, 2015 Share Posted November 16, 2015 If you created it you should be able to sort this out yourself. The code shows you're competent enough, and you even failed to provide the relevant /debugscript lines (if there aren't any, you could say that there are none) To summarise, please provide the relevant /debugscript lines if you expect people to help. Link to comment
thegost Posted November 16, 2015 Author Share Posted November 16, 2015 I use this in consele ( /debugscript robbery ) and not see any Link to comment
Addlibs Posted November 16, 2015 Share Posted November 16, 2015 In the client console (F8), use /debugscript 3 Link to comment
thegost Posted November 16, 2015 Author Share Posted November 16, 2015 I use /debugscript 3 and not see nothing Link to comment
thegost Posted November 16, 2015 Author Share Posted November 16, 2015 Help fix The script please! Link to comment
Saml1er Posted November 17, 2015 Share Posted November 17, 2015 I use /debugscript 3 and not see nothing You have to be logged in and you need to be an admin then do /debugscript 3 in chat. Your code is way too long for anyone to read. Please copy-paste in pastebin.com Link to comment
thegost Posted November 17, 2015 Author Share Posted November 17, 2015 The erro in function checkHouseForPercentage() checkTimer = nil if houserobBlip then for i, robber in ipairs (getElementsWithinColShape(houserobCircle, "player")) do if not isPedDead(robber) and robberTeams[getTeamName(getPlayerTeam(robber))] then count = count +1 wl = getElementData(robber, "wanted") +1 if wl > 36 then wl = 36 exports.RPGPolice:setWantedLevel(robber, wl) end end if not firstTime then firstTime = 0 for i, robber in pairs (getElementsWithinColShape(houserobCircle, "player")) do if not isPedDead(robber) and robberTeams[getTeamName(getPlayerTeam(robber))] then showProcess(robber) end end if count > 0 then local percent = getElementData(houserobMarker, "percent") local percent = percent + (count*ppP) if percent > 0 then triggerClientEvent("showHouserobBlip", getRootElement(), 2, houserob[houserobNumber][1],houserob[houserobNumber][2],houserob[houserobNumber][3]) else if percent > 100 then setElementData(houserobMarker, "percent", 100) nextStep() else setElementData(houserobMarker, "percent", percent) end end checkTimer = setTimer(checkHouseForPercentage, 5000, 1) end end help? Link to comment
Saml1er Posted November 17, 2015 Share Posted November 17, 2015 add debugs and you will find out which line is causing it. Do it like this: function checkHouseForPercentage() checkTimer = nil outputChatBox("1") if houserobBlip then outputChatBox("2") for i, robber in ipairs (getElementsWithinColShape(houserobCircle, "player")) do if not isPedDead(robber) and robberTeams[getTeamName(getPlayerTeam(robber))] then count = count +1 wl = getElementData(robber, "wanted") +1 if wl > 36 then wl = 36 exports.RPGPolice:setWantedLevel(robber, wl) end end if not firstTime then outputChatBox("3") firstTime = 0 for i, robber in pairs (getElementsWithinColShape(houserobCircle, "player")) do if not isPedDead(robber) and robberTeams[getTeamName(getPlayerTeam(robber))] then showProcess(robber) end end outputChatBox("4") if count > 0 then outputChatBox("5") local percent = getElementData(houserobMarker, "percent") local percent = percent + (count*ppP) if percent > 0 then triggerClientEvent("showHouserobBlip", getRootElement(), 2, houserob[houserobNumber][1],houserob[houserobNumber][2],houserob[houserobNumber][3]) outputChatBox("7") else if percent > 100 then setElementData(houserobMarker, "percent", 100) nextStep() else setElementData(houserobMarker, "percent", percent) outputChatBox("8") end end outputChatBox("Last") checkTimer = setTimer(checkHouseForPercentage, 5000, 1) end end Link to comment
thegost Posted November 17, 2015 Author Share Posted November 17, 2015 I See tomorow because now i go sleep but thanks Link to comment
thegost Posted November 18, 2015 Author Share Posted November 18, 2015 Not work the erro in : for i, robber in ipairs (getElementsWithinColShape(houserobCircle, "player")) do if not isPedDead(robber) and robberTeams[getTeamName(getPlayerTeam(robber))] then count = count +1 wl = getElementData(robber, "wanted") +1 if wl > 36 then wl = 36 exports.RPGPolice:setWantedLevel(robber, wl) end end ERRO: "end" expected (to close "for" at line 85) near "" Link to comment
Saml1er Posted November 18, 2015 Share Posted November 18, 2015 Yes, 1LoL1 is right. count = count +1 wl = getElementData(robber, "wanted") +1 if wl > 36 then wl = 36 exports.RPGPolice:setWantedLevel(robber, wl) end end end-- you just needed to add this Link to comment
thegost Posted November 18, 2015 Author Share Posted November 18, 2015 THis Fix But now have erro in Count: in : function checkHouseForPercentage() checkTimer = nil outputChatBox("1") if houserobBlip then outputChatBox("2") for i, robber in ipairs (getElementsWithinColShape(houserobCircle, "player")) do if not isPedDead(robber) and robberTeams[getTeamName(getPlayerTeam(robber))] then count = count +1 wl = getElementData(robber, "wanted") +1 if wl > 36 then wl = 36 exports.RPGPolice:setWantedLevel(robber, wl) end end end if not firstTime then outputChatBox("3") firstTime = 0 for i, robber in pairs (getElementsWithinColShape(houserobCircle, "player")) do if not isPedDead(robber) and robberTeams[getTeamName(getPlayerTeam(robber))] then showProcess(robber) end end end outputChatBox("4") if count > 0 then outputChatBox("5") local percent = getElementData(houserobMarker, "percent") local percent = percent + (count*ppP) if percent > 0 then triggerClientEvent("showHouserobBlip", getRootElement(), 2, houserob[houserobNumber][1],houserob[houserobNumber][2],houserob[houserobNumber][3]) outputChatBox("7") else if percent > 100 then setElementData(houserobMarker, "percent", 100) nextStep() else setElementData(houserobMarker, "percent", percent) outputChatBox("8") end end end outputChatBox("Last") checkTimer = setTimer(checkHouseForPercentage, 5000, 1) end end ERRO:attempt to perform arithmetic on global "count" (a nil value) Link to comment
Saml1er Posted November 18, 2015 Share Posted November 18, 2015 Because count is not defined. I accidently removed it. function checkHouseForPercentage() checkTimer = nil outputChatBox("1") if houserobBlip then count = 0 -- this line needs to be added outputChatBox("2") Link to comment
thegost Posted November 18, 2015 Author Share Posted November 18, 2015 Not work erro: server.lua:89:attempt to perform arithmedic on a boolean valeu Link to comment
Addlibs Posted November 18, 2015 Share Posted November 18, 2015 Which line of the extract corresponds to line 89 of the full code? Link to comment
thegost Posted November 18, 2015 Author Share Posted November 18, 2015 NO! Because Not work? Link to comment
Addlibs Posted November 19, 2015 Share Posted November 19, 2015 (edited) If you don't understand basic English, then you best seek support in your native language forum section. Edited November 19, 2015 by Guest Link to comment
Saml1er Posted November 19, 2015 Share Posted November 19, 2015 Can you tell us which line it is in lua code? Take a screen or something. I really won't bother trying to understand your code if I find it time consuming. Link to comment
thegost Posted November 19, 2015 Author Share Posted November 19, 2015 in / debugscript 3 not pops up the line the erro Link to comment
Addlibs Posted November 19, 2015 Share Posted November 19, 2015 in / debugscript 3 not pops up the line the erroWe don't want the error message, we want line 89 (referring to your previous post, “server.lua:89:attempt to perform arithmedic on a boolean valeu”) and all the other relevant lines. Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now