-
Posts
708 -
Joined
-
Last visited
Everything posted by K4stic
-
then player take that job it must set element's so must work but then i hit the marker nothing
-
Try GUIEditor_Window = {} GUIEditor_Button = {} GUIEditor_Label = {} GUIEditor_Grid = {} GUIEditor_Column = {} GUIEditor_Window[1] = guiCreateWindow(303,111,463,438,"SACR Police computer",false) guiSetVisible ( GUIEditor_Window[1], false ) GUIEditor_Grid[1] = guiCreateGridList(10,26,204,375,false,GUIEditor_Window[1]) GUIEditor_Column[1] = guiGridListAddColumn(GUIEditor_Grid[1],"Wanted player",0.5) GUIEditor_Column[2] = guiGridListAddColumn(GUIEditor_Grid[1],"Wanted player",0.5) GUIEditor_Button[1] = guiCreateButton(9,408,205,21,"Blip player",false,GUIEditor_Window[1]) GUIEditor_Label[1] = guiCreateLabel(218,27,241,74,"My informations:",false,GUIEditor_Window[1]) GUIEditor_Label[2] = guiCreateLabel(226,46,224,27,"Account name:",false,GUIEditor_Window[1]) GUIEditor_Label[3] = guiCreateLabel(226,65,227,27,"Arrests:",false,GUIEditor_Window[1]) GUIEditor_Label[4] = guiCreateLabel(226,85,233,26,"Hours:",false,GUIEditor_Window[1]) GUIEditor_Label[5] = guiCreateLabel(226,106,231,28,"Group:",false,GUIEditor_Window[1]) GUIEditor_Label[6] = guiCreateLabel(216,122,240,51,"Wanted player information:",false,GUIEditor_Window[1]) GUIEditor_Label[7] = guiCreateLabel(229,143,213,27,"Account name:",false,GUIEditor_Window[1]) GUIEditor_Label[8] = guiCreateLabel(229,166,223,21,"Hours:",false,GUIEditor_Window[1]) GUIEditor_Label[9] = guiCreateLabel(227,188,214,22,"Group:",false,GUIEditor_Window[1]) GUIEditor_Label[10] = guiCreateLabel(227,207,221,22,"Wanted level:",false,GUIEditor_Window[1]) GUIEditor_Button[2] = guiCreateButton(225,380,224,49,"Close",false,GUIEditor_Window[1]) function setplayers () for id, player in ipairs(getElementsByType("player")) do if (getPlayerWantedLevel(player) > 0) then local row = guiGridListAddRow ( GUIEditor_Grid[1] ) guiGridListSetItemText ( GUIEditor_Grid[1], row, 1, GUIEditor_Column[1], getPlayerName( player ), false, false ) end end end addEventHandler ( "onClientResourceStart", getThisResource(), setplayers )
-
pls post full client side
-
not work not visible blips or markers to hit
-
Not Create blips and no error's in debugscript
-
NOT Work So take full code: polesToFix = { {1332.9365234375, -1411.30078125, 12}, {1470.1435546875, -1447.119140625, 12}, {1515.50390625, -1586.787109375, 12}, {1544.9814453125, -1726.63671875, 12}, {1460.6865234375, -1420.0810546875, 12}, {1863.583984375, -1255.1982421875, 12}, {2061.3095703125, -1289.392578125, 22.5}, {1862.3125, -1455.162109375, 12.2} } function unpackPoles() return unpack(polesToFix[math.random(#polesToFix)]) end local markerjob = createMarker( 733.13671875, -1347.9580078125, 13.510824203491, "Cylinder", 1.5, 0, 0, 255, 150) local skins = {"Electrician (skin: 16)"} windowjob = guiCreateWindow(0.700,0.28,0.2800,0.4500,"Electrician job",true) guiSetVisible(windowjob, false) infomemo = guiCreateMemo(0.0347,0.0600,0.9369,0.4100,"As an electrician, you will go around the city of Los Santos, to the red flag, and fix the poles.",true,windowjob) skinsgrid = guiCreateGridList(0.0347,0.5300,0.9369,0.350,true,windowjob) guiGridListSetSelectionMode(skinsgrid,2) _skins = guiGridListAddColumn(skinsgrid,"Skins",0.95) takebtn = guiCreateButton(0.1000,0.9000,0.3000,0.0700,"Accept",true,windowjob) closebtn = guiCreateButton(0.6000,0.9000,0.3000,0.0700,"Cancel",true,windowjob) infolbl = guiCreateLabel(0.2681,0.4800,0.4637,0.0538,"Choose your skin :",true,windowjob) guiLabelSetColor(infolbl,255,255,255) guiLabelSetVerticalAlign(infolbl,"center") guiLabelSetHorizontalAlign(infolbl,"center",false) guiSetFont(infolbl,"default-bold-small") local resX, resY = guiGetScreenSize() local width2, height2 = 1269, 75 local X2 = resX / 2 - width2 / 2 local Y2 = resY / 2 - height2 / 2 jobs_electitian_label_timeLeft = guiCreateLabel(X2, Y2, width2, height2, "Time until finished: ", false) guiSetPosition(jobs_electitian_label_timeLeft, 10, 10, false) guiSetVisible(jobs_electitian_label_timeLeft, false) guiSetFont(jobs_electitian_label_timeLeft, "sa-header") guiLabelSetColor(jobs_electitian_label_timeLeft, 5, 221, 35) guiLabelSetHorizontalAlign(jobs_electitian_label_timeLeft, "center", false) guiLabelSetVerticalAlign(jobs_electitian_label_timeLeft, "center") for index, skin in ipairs(skins) do local row = guiGridListAddRow (skinsgrid) guiGridListSetItemText(skinsgrid, row, _skins, tostring(skin), false, false) end addEventHandler("onClientGUIClick", root, function () if (source == takebtn) then local row,col = guiGridListGetSelectedItem(skinsgrid) if (row and col and row ~= -1 and col ~= -1) then local skinName = guiGridListGetItemText(skinsgrid, row, 1) if skinName == "Electrician (skin: 16)" then triggerServerEvent("electrition:takeJob",localPlayer, 16) end guiSetVisible ( windowjob, false ) showCursor ( false ) else outputChatBox("Please,select a skin of the list.",255,0,0) end elseif (source == closebtn) then guiSetVisible ( windowjob, false ) showCursor ( false ) end end) function Elecjob(hitElement) if (hitElement == localPlayer) then if not guiGetVisible(windowjob) then guiSetVisible(windowjob, true) showCursor(true) end end end addEventHandler("onClientMarkerHit", markerjob, Elecjob) function Elecjobleave(leaveElement) if getElementType(leaveElement) == "player" and (leaveElement == localPlayer) then if guiGetVisible(windowjob) then guiSetVisible(windowjob, false) showCursor(false) end end end addEventHandler("onClientMarkerLeave", markerjob, Elecjobleave) function removeElecWindow() guiSetVisible(windowjob, false) showCursor(false) end addEventHandler("onClientGUIClick", closebtn , removeElecWindow, false) function createPoleMarkerAndBlip() if getElementData(source, "Occupation") == "Electrician" and getElementType(source) == 'player' then local x, y, z = unpackPoles() electritionPoleMarker = createMarker(x, y, z, "cylinder", 3, 200, 200, 0, 85, source) setElementData(electritionPoleMarker, "Electrician", "poleMarker", true) electritonPoleBlip = createBlip(x, y, z, 19) end end addEvent("electrition:createPoles", true) addEventHandler("electrition:createPoles", root, createPoleMarkerAndBlip) addEventHandler("onClientPlayerJoin", root, createPoleMarkerAndBlip) addEventHandler("onClientResourceStart", root, createPoleMarkerAndBlip) addEventHandler("onClientMarkerHit", electritionPoleMarker, function(player, dimension) if isPlayerInVehicle ( player ) or ( doesPlayerHaveJetPack ( player ) ) then outputChatBox("Get out of the vehicle, to fix the pole.", 255, 0, 0) return end if source == electritionPoleMarker and player == localPlayer and getElementData(player, "Occupation") == "Electrician" then setElementFrozen(localPlayer, true) showCursor(true) guiSetVisible(jobs_electitian_label_timeLeft, true) triggerServerEvent("electrain:fixPole:animation", localPlayer) guiSetText(jobs_electitian_label_timeLeft, "Time Left: 20") setTimer(function() guiSetText(jobs_electitian_label_timeLeft, "Time Left: 19") end, 1000, 1) setTimer(function() guiSetText(jobs_electitian_label_timeLeft, "Time Left: 18") end, 2000, 1) setTimer(function() guiSetText(jobs_electitian_label_timeLeft, "Time Left: 17") end, 3000, 1) setTimer(function() guiSetText(jobs_electitian_label_timeLeft, "Time Left: 16") end, 4000, 1) setTimer(function() guiSetText(jobs_electitian_label_timeLeft, "Time Left: 15") end, 5000, 1) setTimer(function() guiSetText(jobs_electitian_label_timeLeft, "Time Left: 14") end, 6000, 1) setTimer(function() guiSetText(jobs_electitian_label_timeLeft, "Time Left: 13") end, 7000, 1) setTimer(function() guiSetText(jobs_electitian_label_timeLeft, "Time Left: 12") end, 8000, 1) setTimer(function() guiSetText(jobs_electitian_label_timeLeft, "Time Left: 11") end, 9000, 1) setTimer(function() guiSetText(jobs_electitian_label_timeLeft, "Time Left: 10") end, 10000, 1) setTimer(function() guiSetText(jobs_electitian_label_timeLeft, "Time Left: 9") end, 11000, 1) setTimer(function() guiSetText(jobs_electitian_label_timeLeft, "Time Left: 8") end, 12000, 1) setTimer(function() guiSetText(jobs_electitian_label_timeLeft, "Time Left: 7") end, 13000, 1) setTimer(function() guiSetText(jobs_electitian_label_timeLeft, "Time Left: 6") end, 14000, 1) setTimer(function() guiSetText(jobs_electitian_label_timeLeft, "Time Left: 5") end, 15000, 1) setTimer(function() guiSetText(jobs_electitian_label_timeLeft, "Time Left: 4") end, 16000, 1) setTimer(function() guiSetText(jobs_electitian_label_timeLeft, "Time Left: 3") end, 17000, 1) setTimer(function() guiSetText(jobs_electitian_label_timeLeft, "Time Left: 2") end, 18000, 1) setTimer(function() guiSetText(jobs_electitian_label_timeLeft, "Time Left: 1") end, 19000, 1) startTimerWhenMarkerHit = setTimer(function() destroyElement(electritonPoleBlip) destroyElement(electritionPoleMarker) triggerEvent("electrition:createPoles", localPlayer) triggerServerEvent("electrition:fixPole", localPlayer) showCursor(false, false) setElementFrozen(localPlayer, false) guiSetVisible(jobs_electitian_label_timeLeft, false) end, 20000, 1) end end )
-
not work and i have remove the ! at lines 2 and 14 and i remove the ) at line 14 because is output me errors
-
try this: for _, player in ipairs ( getElementsByType( "player" ) ) do local wanted = getPlayerWantedLevel ( player ) if wanted > 0 then local row = guiGridListAddRow ( GUIEditor_Grid[1] ) guiGridListSetItemText ( GUIEditor_Grid[1], row, 1, GUIEditor_Column[1], getPlayerName( player ), false, false ) guiGridListSetItemText ( GUIEditor_Grid[1], row, 1, GUIEditor_Column[2], wanted, false, false ) end end
-
try this: for _,player in ipairs(getElementsByType("player")) do if (getPlayerWantedLevel(player) > 0) then local row = guiGridListAddRow ( GUIEditor_Grid[1] ) guiGridListSetItemText ( GUIEditor_Grid[1], row, 1, tostring( player [ 1 ] ), getPlayerName( player ), false, false ) guiGridListSetItemText ( GUIEditor_Grid[1], row, 1, tostring( player [ 2 ] ), getPlayerWantedLevel( player )) end end
-
Try this: function playerLogin (thePreviousAccount, theCurrentAccount, autoLogin) if not (isGuestAccount (getPlayerAccount (source))) then local accountData = getAccountData (theCurrentAccount, "funmodev2-money") if (accountData) then local playerMoney = getAccountData (theCurrentAccount, "funmodev2-money") local playerSkin = getAccountData (theCurrentAccount, "funmodev2-skin") local playerHealth = getAccountData (theCurrentAccount, "funmodev2-health") local playerArmor = getAccountData (theCurrentAccount, "funmodev2-armor") local playerX = getAccountData (theCurrentAccount, "funmodev2-x") local playerY = getAccountData (theCurrentAccount, "funmodev2-y") local playerZ = getAccountData (theCurrentAccount, "funmodev2-z") local playerInt = getAccountData (theCurrentAccount, "funmodev2-int") local playerDim = getAccountData (theCurrentAccount, "funmodev2-dim") local playerWanted = getAccountData (theCurrentAccount, "funmodev2-wantedlevel") local playerTeam = getAccountData (theCurrentAccount, "funmodev2-Team") local playerWeaponID0 = getAccountData (theCurrentAccount, "funmodev2-weaponID0") local playerWeaponID1 = getAccountData (theCurrentAccount, "funmodev2-weaponID1") local playerWeaponID2 = getAccountData (theCurrentAccount, "funmodev2-weaponID2") local playerWeaponID3 = getAccountData (theCurrentAccount, "funmodev2-weaponID3") local playerWeaponID4 = getAccountData (theCurrentAccount, "funmodev2-weaponID4") local playerWeaponID5 = getAccountData (theCurrentAccount, "funmodev2-weaponID5") local playerWeaponID6 = getAccountData (theCurrentAccount, "funmodev2-weaponID6") local playerWeaponID7 = getAccountData (theCurrentAccount, "funmodev2-weaponID7") local playerWeaponID8 = getAccountData (theCurrentAccount, "funmodev2-weaponID8") local playerWeaponID9 = getAccountData (theCurrentAccount, "funmodev2-weaponID9") local playerWeaponID10 = getAccountData (theCurrentAccount, "funmodev2-weaponID10") local playerWeaponID11 = getAccountData (theCurrentAccount, "funmodev2-weaponID11") local playerWeaponID12 = getAccountData (theCurrentAccount, "funmodev2-weaponID12") local playerWeaponAmmo0 = getAccountData (theCurrentAccount, "funmodev2-weaponAmmo0") local playerWeaponAmmo1 = getAccountData (theCurrentAccount, "funmodev2-weaponAmmo1") local playerWeaponAmmo2 = getAccountData (theCurrentAccount, "funmodev2-weaponAmmo2") local playerWeaponAmmo3 = getAccountData (theCurrentAccount, "funmodev2-weaponAmmo3") local playerWeaponAmmo4 = getAccountData (theCurrentAccount, "funmodev2-weaponAmmo4") local playerWeaponAmmo5 = getAccountData (theCurrentAccount, "funmodev2-weaponAmmo5") local playerWeaponAmmo6 = getAccountData (theCurrentAccount, "funmodev2-weaponAmmo6") local playerWeaponAmmo7 = getAccountData (theCurrentAccount, "funmodev2-weaponAmmo7") local playerWeaponAmmo8 = getAccountData (theCurrentAccount, "funmodev2-weaponAmmo8") local playerWeaponAmmo9 = getAccountData (theCurrentAccount, "funmodev2-weaponAmmo9") local playerWeaponAmmo10 = getAccountData (theCurrentAccount, "funmodev2-weaponAmmo10") local playerWeaponAmmo11 = getAccountData (theCurrentAccount, "funmodev2-weaponAmmo11") local playerWeaponAmmo12 = getAccountData (theCurrentAccount, "funmodev2-weaponAmmo12") local role = getAccountData (theCurrentAccount, "funmodev2-role") spawnPlayer (source, playerX, playerY, playerZ +1, 0, playerSkin, playerInt, playerDim) setPlayerMoney (source, playerMoney) setElementData(source, "Role", role) setTimer (setElementHealth, 500, 1, source, playerHealth) setTimer (setPedArmor, 500, 1, source, playerArmor) setTimer (setPlayerWantedLevel, 500, 1, source, playerWanted) giveWeapon(source, playerWeaponID0, playerWeaponAmmo0, true) giveWeapon(source, playerWeaponID1, playerWeaponAmmo1, false) giveWeapon(source, playerWeaponID2, playerWeaponAmmo2, false) giveWeapon(source, playerWeaponID3, playerWeaponAmmo3, false) giveWeapon(source, playerWeaponID4, playerWeaponAmmo4, false) giveWeapon(source, playerWeaponID5, playerWeaponAmmo5, false) giveWeapon(source, playerWeaponID6, playerWeaponAmmo6, false) giveWeapon(source, playerWeaponID7, playerWeaponAmmo7, false) giveWeapon(source, playerWeaponID8, playerWeaponAmmo8, false) giveWeapon(source, playerWeaponID9, playerWeaponAmmo9, false) giveWeapon(source, playerWeaponID10, playerWeaponAmmo10, false) giveWeapon(source, playerWeaponID11, playerWeaponAmmo11, false) giveWeapon(source, playerWeaponID12, playerWeaponAmmo12, false) setCameraTarget (source, source) fadeCamera(source, true, 2.0) else spawnPlayer (source, 1481.0855712891, -1771.2996826172, 18.795753479004, 0,78, 0, 0) setPlayerMoney (source, 200) setElementData(source, "Role", role) setCameraTarget (source, source) fadeCamera(source, true, 2.0) end end end addEventHandler ("onPlayerLogin", getRootElement(), playerLogin) function onLogout () kickPlayer (source, nil, "Logging out is disallowed.") end addEventHandler ("onPlayerLogout", getRootElement(), onLogout) function onQuit (quitType, reason, responsibleElement) if not (isGuestAccount (getPlayerAccount (source))) then account = getPlayerAccount (source) if (account) then local x,y,z = getElementPosition (source) setAccountData (account, "funmodev2-money", tostring (getPlayerMoney (source))) setAccountData (account, "funmodev2-skin", tostring (getPedSkin (source))) setAccountData (account, "funmodev2-health", tostring (getElementHealth (source))) setAccountData (account, "funmodev2-armor", tostring (getPedArmor (source))) setAccountData (account, "funmodev2-R", r) setAccountData (account, "funmodev2-G", g) setAccountData (account, "funmodev2-B", b) setAccountData (account, "funmodev2-x", x) setAccountData (account, "funmodev2-y", y) setAccountData (account, "funmodev2-z", z) setAccountData (account, "funmodev2-int", getElementInterior (source)) setAccountData (account, "funmodev2-dim", getElementDimension (source)) setAccountData (account, "funmodev2-wantedlevel", getPlayerWantedLevel (source)) setAccountData (account, "funmodev2-weaponID0", getPedWeapon (source, 0)) setAccountData (account, "funmodev2-weaponID1", getPedWeapon (source, 1)) setAccountData (account, "funmodev2-weaponID2", getPedWeapon (source, 2)) setAccountData (account, "funmodev2-weaponID3", getPedWeapon (source, 3)) setAccountData (account, "funmodev2-weaponID4", getPedWeapon (source, 4)) setAccountData (account, "funmodev2-weaponID5", getPedWeapon (source, 5)) setAccountData (account, "funmodev2-weaponID6", getPedWeapon (source, 6)) setAccountData (account, "funmodev2-weaponID7", getPedWeapon (source, 7)) setAccountData (account, "funmodev2-weaponID8", getPedWeapon (source, -- s8) -->) setAccountData (account, "funmodev2-weaponID9", getPedWeapon (source, 9)) setAccountData (account, "funmodev2-weaponID10", getPedWeapon (source, 10)) setAccountData (account, "funmodev2-weaponID11", getPedWeapon (source, 11)) setAccountData (account, "funmodev2-weaponID12", getPedWeapon (source, 12)) setAccountData (account, "funmodev2-weaponAmmo0", getPedTotalAmmo (source, 0)) setAccountData (account, "funmodev2-weaponAmmo1", getPedTotalAmmo (source, 1)) setAccountData (account, "funmodev2-weaponAmmo2", getPedTotalAmmo (source, 2)) setAccountData (account, "funmodev2-weaponAmmo3", getPedTotalAmmo (source, 3)) setAccountData (account, "funmodev2-weaponAmmo4", getPedTotalAmmo (source, 4)) setAccountData (account, "funmodev2-weaponAmmo5", getPedTotalAmmo (source, 5)) setAccountData (account, "funmodev2-weaponAmmo6", getPedTotalAmmo (source, 6)) setAccountData (account, "funmodev2-weaponAmmo7", getPedTotalAmmo (source, 7)) setAccountData (account, "funmodev2-weaponAmmo8", getPedTotalAmmo (source, -- s8) -->) setAccountData (account, "funmodev2-weaponAmmo9", getPedTotalAmmo (source, 9)) setAccountData (account, "funmodev2-weaponAmmo10", getPedTotalAmmo (source, 10)) setAccountData (account, "funmodev2-weaponAmmo11", getPedTotalAmmo (source, 11)) setAccountData (account, "funmodev2-weaponAmmo12", getPedTotalAmmo (source, 12)) setAccountData (account, "funmodev2-role", getElementData ( source, "Role" )) end end end addEventHandler ("onPlayerQuit", getRootElement(), onQuit)
-
i think is then player marker hit
-
Command = get("command") -- getTheCommand function getData(to) local file = xmlLoadFile("data.xml") jTable = {} tTable = {} if file then for k,v in ipairs (xmlNodeGetChildren(xmlFindChild(file,"Jails",0)))do local name = xmlNodeGetAttribute(v,"name") local posX,posY,posZ = xmlNodeGetAttribute(v,"posX"),xmlNodeGetAttribute(v,"posY"),xmlNodeGetAttribute(v,"posZ") local int = xmlNodeGetAttribute(v,"int") local dim = xmlNodeGetAttribute(v,"dim") table.insert(jTable, {name,posX,posY,posZ,int,dim}) end for k,v in ipairs (xmlNodeGetChildren(xmlFindChild(file,"time",0)))do local times = xmlNodeGetAttribute(v,"times") for i =1,50 do local iTime = gettok ( times, i, string.byte(',') ) if iTime then -- if tonumber(iTime) > 59.5 then iTime = math.floor(iTime / 60) iTimeDes = "Minutes" if iTime > 59.5 then iTime = math.floor(iTime / 60) iTimeDes = "Hours" end else iTimeDes = "Seconds" end table.insert(tTable,{iTime,iTimeDes}) end end end end triggerClientEvent(to,"sendDataz",to,jTable,tTable) -- sending to client event end addEvent("getDataz",true) addEventHandler("getDataz",root,getData) addCommandHandler ( Command, -- Adding The Command Handler function ( player, cmd ) if hasObjectPermissionTo ( player, "command.kick" ) then triggerClientEvent(player,"jailShow",player) else outputChatBox(" Access Denied ",player,255,0,0) end end ) function removeVehicle(thePlayer) if isPedInVehicle(thePlayer) then destroyElement(getPedOccupiedVehicle(thePlayer)) end end function JailHim(jailed,theJails,time,timeDes,showWho,timeReady) thePlayer = getPlayerFromName(jailed) if not thePlayer then outputChatBox("#FFFF00Please Select a Player !",source,255,0,0,true) return end removePedFromVehicle(thePlayer) for k,v in ipairs ( jTable ) do if theJails == v[1] then theJail = v end end if theJail then if tostring(time) then if timeReady == true then theTimex = tonumber(time) else theTimex = gettok ( time, 1, string.byte(timeDes) ) end if timeDes == "Hours" then theTimex = math.floor(theTimex*60*60*1000) elseif timeDes == "Minutes" then theTimex = math.floor(theTimex*60*1000) elseif timeDes == "Seconds" then theTimex = math.floor(theTimex*1000) end startJailTimer ( thePlayer , theTimex ) local x,y,z = theJail[2],theJail[3],theJail[4] local int = theJail[5] local dim = theJail[6] setElementInterior ( thePlayer, int ) setElementDimension ( thePlayer, dim ) setElementPosition (thePlayer,x,y,z ) setElementData(thePlayer,"isjailed",true) setElementData(thePlayer,""..getPlayerSerial(thePlayer).."-j",true) toggleControl(thePlayer,"fire",false) if showWho ~= true then outputChatBox("#FFFF00You Jailed [ "..getPlayerName(thePlayer).." #FFFF00] at "..theJail[1].." For "..time,source,255,0,0,true) outputChatBox("#FFFF00You Have Been Jailed By "..getPlayerName(source).." #FFFF00 at "..theJail[1].." For "..time,thePlayer,255,0,0,true) end outputChatBox(""..getPlayerName(thePlayer).." #FF0000 Has Been Jailed For "..time.." for beaking rule",root,255,0,0,true) else outputChatBox("#FFFF00Please Select Time !",source,255,0,0,true) end else outputChatBox("#FFFF00Please Select a Jail !",source,255,0,0,true) end end addEvent("JailHimx",true) addEventHandler("JailHimx",root,JailHim) function unJailHim(jailed,showWho) thePlayer = getPlayerFromName(jailed) if not thePlayer then outputChatBox("#FFFF00Please Select a Player !",source,255,0,0,true) return end if getElementData(thePlayer,"isjailed") == true then setElementInterior ( thePlayer, 0) setElementDimension ( thePlayer, 0 ) setElementPosition ( thePlayer, 1552.9108886719, -1675.5844726563, 16.1953125) setElementData(thePlayer,"isjailed",false) setElementData(thePlayer,""..getPlayerSerial(thePlayer).."-j",false) if showWho ~= true then outputChatBox("#FFFF00You Released "..getPlayerName(thePlayer).." #FFFF00",source,255,0,0,true) outputChatBox("You Have Been Released by "..getPlayerName(source).."",thePlayer,255,0,0,true) end outputChatBox(""..getPlayerName(thePlayer).." #FF0000 Has Been Released ",root,255,0,0,true) stopJailTimer(Player) setPlayerWantedLevel ( thePlayer, 0 ) toggleControl(thePlayer,"fire",true) else outputChatBox("The Player is Not Jailed !",source,255,0,0,true) end end addEvent("unJailHim",true)-- unJail addEventHandler("unJailHim",root,unJailHim) addEvent("onJailEnd",true) addEventHandler("onJailEnd",root,function(player) unJailHim(getPlayerName(player),true) end ) addEventHandler("onPlayerSpawn",root, -- Check If He Is Jailed [ OnSpawn ] function() if getElementData(source,"isjailed") == true then randomJail = jTable[math.random(#jTable)] if randomJail then x,y,z = randomJail[2],randomJail[3],randomJail[4] int = randomJail[5] dim = randomJail[6] setElementInterior ( source, int ) setElementDimension(source,dim) setElementPosition (source,x,y,z ) end end end) addEventHandler("onPlayerJoin",root, -- Check If He Is Jailed - By Serial [ OnJoin ] function() if getElementData(getResourceRootElement(getThisResource()),""..getPlayerSerial(source).."-j") == true then randomJail = jTable[math.random(#jTable)] if randomJail then x,y,z = randomJail[2],randomJail[3],randomJail[4] int = randomJail[5] dim = randomJail[6] setElementInterior (source, int) setElementDimension(source,dim) setElementPosition (source,x,y,z ) -- time = getElementData( source,""..getPlayerSerial(source).."-t",time) or 5 * 1000 startJailTimer(source,time) setElementData(source,"isjailed",true) end end end ) ---- function startJailTimer(Player,theTime) -- to start mission timer .. if Player then TimerDisplay = textCreateDisplay() m,s,cs = msToTimeStr(theTime) fullTime = ''..tostring(m)..':'..tostring(s)..'' TimerText = textCreateTextItem ( "Time Left : "..tostring(fullTime).."", 0.39, 0.7 ,"medium",0,255,0,255,2.0,"left","center",255) textDisplayAddText ( TimerDisplay, TimerText ) textDisplayAddObserver ( TimerDisplay, Player ) sortTimerj(Player,TimerText,theTime) end end --taken from JailTimerr resource function msToTimeStr(ms) if not ms then return '' end if ms < 0 then return "0","00","00" end local centiseconds = tostring(math.floor(math.fmod(ms, 1000)/10)) if #centiseconds == 1 then centiseconds = '0' .. centiseconds end local s = math.floor(ms / 1000) local seconds = tostring(math.fmod(s, 60)) if #seconds == 1 then seconds = '0' .. seconds end local minutes = tostring(math.floor(s / 60)) return minutes, seconds, centiseconds end function sortTimerj ( plr, timer, time ) if timer and time then if isTimer ( timerjTimer ) then killTimer ( timerjTimer ) end timerjTimer = setTimer ( function ( plr ) time = tonumber ( time or 0 ) - 70 m, s, cs = msToTimeStr ( time ) fullTime = ''..tostring(m)..':'..tostring(s)..'' textItemSetText ( timer, "Time Left : "..tostring ( fullTime ) ) if plr then setElementData ( resourceRoot, getPlayerSerial ( plr ).. "-t", time ) end if ( tonumber ( m ) <= 0 and tonumber ( s ) <= 0 and tonumber ( cs ) <= 0 ) then onTimerFinish(plr,timer) if isTimer ( timerjTimer ) then killTimer ( timerjTimer ) timerjTimer = nil end end end , 50 , 0 , plr ) end end function stopJailTimer(Player) textDestroyDisplay(TimerDisplay) if TimerText then textDestroyTextItem(TimerText) end if isTimer(timerjTimer) then killTimer(timerjTimer) end end function onTimerFinish(Player) -- on timer end stopJailTimer(Player) triggerEvent("onJailEnd",Player,Player) end full code i fix the stuck timer but then player jailed and them reconnect the timer lost and error at line 218 says Boolean value and if i jail 1 player and them i jail and second player the first player have timer bug
-
now the timer just stuck -.-
-
what you mean? i have 10 times tryed but no result so i post it here
-
-.- just then i use the old code it wos normal then i put your is make the chatbox crazy -.-
-
make x100 outputChatBox messages with this code -.-
-
The Problem is: Then i hit 'electritionPoleMarker' is nothing do i mean(no timer no froze just nothing) and no error's in debugscript 3 function createPoleMarkerAndBlip() if getElementData(source, "Occupation") == "Electrician" then local x, y, z = unpackPoles() electritionPoleMarker = createMarker(x, y, z, "cylinder", 3, 200, 200, 0, 85, localPlayer) setElementData(electritionPoleMarker, "Electrician", "poleMarker", true) electritonPoleBlip = createBlip(x, y, z, 19) end end addEvent("electrition:createPoles", true) addEventHandler("electrition:createPoles", root, createPoleMarkerAndBlip) addEventHandler("onClientPlayerJoin", root, createPoleMarkerAndBlip) addEventHandler("onClientResourceStart", root, createPoleMarkerAndBlip) addEventHandler("onClientMarkerHit", electritionPoleMarker, function(player) if isPlayerInVehicle ( player ) or ( doesPlayerHaveJetPack ( player ) ) then outputChatBox("Get out of the vehicle, to fix the pole.", 255, 0, 0) return end if source == electritionPoleMarker and player == localPlayer and getElementData(player, "Occupation") == "Electrician" then setElementFrozen(localPlayer, true) showCursor(true) guiSetVisible(jobs_electitian_label_timeLeft, true) triggerServerEvent("electrain:fixPole:animation", localPlayer) guiSetText(jobs_electitian_label_timeLeft, "Time Left: 6") setTimer(function() guiSetText(jobs_electitian_label_timeLeft, "Time Left: 5") end, 1000, 1) setTimer(function() guiSetText(jobs_electitian_label_timeLeft, "Time Left: 4") end, 2000, 1) setTimer(function() guiSetText(jobs_electitian_label_timeLeft, "Time Left: 3") end, 3000, 1) setTimer(function() guiSetText(jobs_electitian_label_timeLeft, "Time Left: 2") end, 4000, 1) setTimer(function() guiSetText(jobs_electitian_label_timeLeft, "Time Left: 1") end, 5000, 1) startTimerWhenMarkerHit = setTimer(function() destroyElement(electritonPoleBlip) destroyElement(electritionPoleMarker) triggerEvent("electrition:createPoles", localPlayer) triggerServerEvent("electrition:fixPole", localPlayer) showCursor(false, false) setElementFrozen(localPlayer, false) guiSetVisible(jobs_electitian_label_timeLeft, false) end, 6000, 1) end end )
-
this is new one then i make the team Civilian and the Occupation Delivery if ( getTeamName ( getPlayerTeam ( thePlayer ) ) == "Civilian Workers" ) and ( getElementData( thePlayer , "Occupation" ) == "Delivery" ) then this is the old one who i used then wos team Delivery if ( getTeamName ( getPlayerTeam ( thePlayer ) ) == "Delivery" ) then
-
not output like not avaible
-
function givemoney(hitElement) if (getElementType(hitElement) == "player") then givePlayerMoney(hitElement, 5000) end end addEventHandler("onMarkerHit", marker, givemoney ) setTimer ( givemoney , 1000, 1)