Strikers Posted March 25, 2015 Share Posted March 25, 2015 (edited) quero limitar esse comando para apenas Policiais podem me dizer como eu nao sei programar podem me ajudar? apenas adms podem usar esse comando --***********************************-- --***********************************-- -- Jail System -- -- By Al3grab -- -- Server Side -- --***********************************-- --***********************************-- Command = get("command") -- getTheCommand rRoot = getResourceRootElement(getThisResource()) ------ 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, "function.banPlayer" ) then triggerClientEvent(player,"jailShow",player) else outputChatBox(" Apenas Pm's Podem Usar Esse Comando ",player,255,0,0) end end ) anims = { "F_smklean_loop", "M_smklean_loop", "M_smkstnd_loop", "M_smk_drag", "M_smk_in", "M_smk_loop", "M_smk_out", "M_smk_tap" , } 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("** #FFFF00Selecione o 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,"jailed",true) setElementData(rRoot,""..getPlayerSerial(thePlayer).."-j",true) toggleControl(thePlayer,"fire",false) if showWho ~= true then outputChatBox("** #FFFF00Voce Foi Preso [ "..getPlayerName(thePlayer).." #FFFF00] Na "..Prisao[1].." Pro "..Minuto,source,255,0,0,true) outputChatBox("** #FFFF00Voce Foi Preso Por [ "..getPlayerName(source).." #FFFF00] Na "..Prisao[1].." Por "..Minuto,thePlayer,255,0,0,true) end outputChatBox("** #FFFF00[ "..getPlayerName(thePlayer).." #FFFF00] Foi Preso Pro "..Minuto,root,255,0,0,true) local randomAnim setPedAnimation(thePlayer,"SMOKING",anims[math.random(#anims)],theTimex/2) else outputChatBox("** #FFFF00Selecione Um Tempo !",source,255,0,0,true) end else outputChatBox("** #FFFF00Selecione Uma Prisao !",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("** #FFFF00Selecione o Jogador !",source,255,0,0,true) return end --if getElementData(thePlayer,"jailed") == true then setElementInterior ( thePlayer, 0) setElementDimension ( thePlayer, 0 ) setElementPosition ( thePlayer, 1552.9108886719, -1675.5844726563, 16.1953125) setElementData(thePlayer,"jailed",false) setElementData(rRoot,""..getPlayerSerial(thePlayer).."-j",false) if showWho ~= true then outputChatBox("** #FFFF00Voce Foi Solto [ "..getPlayerName(thePlayer).." #FFFF00]",source,255,0,0,true) outputChatBox("** #FFFF00Voce Foi Solto Por [ "..getPlayerName(source).." #FFFF00]",thePlayer,255,0,0,true) end outputChatBox("** #FFFF00[ "..getPlayerName(thePlayer).." #FFFF00] Foi Liberado ",root,255,0,0,true) setPedAnimation(thePlayer) stopJailTimer(Player) toggleControl(thePlayer,"fire",true) -- setTimer(killPed,1500,1,thePlayer) --else -- outputChatBox("Esse Player Nao Pode Ser Preso !",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,"jailed") == 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(rRoot,""..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(rRoot,""..getPlayerSerial(source).."-t",time) or 5 * 1000 startJailTimer(source,time) setElementData(source,"jailed",true) end end end ) ---- function startJailTimer(Player,theTime) -- to start mission timer .. if Player then TimerDisplay = textCreateDisplay() m,s,cs = msToTimeStr(theTime) fullTime = m..":"..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 ) sortTimerShit(Player,TimerText,theTime) end end --Robbed from JailTimerr resource , and it was robbed from arc_ 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 sortTimerShit(plr,timer,time) -- to sort timer's shit .. if timer and time then if isTimer(timerShitTimer) then killTimer(timerShitTimer) end timerShitTimer = setTimer(function(plr) time = time - 70 m,s,cs = msToTimeStr(time) fullTime = m..":"..s textItemSetText(timer,"Time Left : "..tostring(fullTime).."") if plr then setElementData(rRoot,""..getPlayerSerial(plr).."-t",time) end if ( tonumber(m) <= 0 and tonumber(s) <= 0 and tonumber(cs) <= 0 ) then onTimerFinish(plr,timer) end end , 50 , 0 ,plr ) end end function stopJailTimer(Player) textDestroyDisplay(TimerDisplay) if TimerText then textDestroyTextItem(TimerText) end Edited March 25, 2015 by Guest Link to comment
#RooTs Posted March 25, 2015 Share Posted March 25, 2015 # --***********************************-- # --***********************************-- # -- Jail System -- # -- By Strikers -- # -- Server Side -- # --***********************************-- # --***********************************-- Porquê mudo os créditos do script ? ninguém irá te ajudar assim meu rapaz.. Link to comment
Strikers Posted March 25, 2015 Author Share Posted March 25, 2015 # --***********************************-- # --***********************************-- # -- Jail System -- # -- By Strikers -- # -- Server Side -- # --***********************************-- # --***********************************-- Porquê mudo os créditos do script ? ninguém irá te ajudar assim meu rapaz.. Eu uso oq tem os creditos e porque to com medo de mexer em algo que nao devo e ferrar tudo entao so mudei os creditos pra salvar uma copia Link to comment
xeon17 Posted March 25, 2015 Share Posted March 25, 2015 RooTs Olha quem fala, você já se viu no espelho? Link to comment
n3wage Posted March 26, 2015 Share Posted March 26, 2015 Veja essa parte rapaz, Nela que o comando é 'adicionado': addCommandHandler ( Command, -- Adding The Command Handler function ( player, cmd ) if hasObjectPermissionTo ( player, "function.banPlayer" ) then triggerClientEvent(player,"jailShow",player) else outputChatBox(" Apenas Pm's Podem Usar Esse Comando ",player,255,0,0) end end ) Agora temos de saber se os policiais são um grupo na ACL ou uma gang (voce deve saber disso, né? '-'): --troque esta parte: if hasObjectPermissionTo ( player, "function.banPlayer" ) then --por: --se for um grupo na acl: if isObjectInACLGroup ("user."..getAccountName ( getPlayerAccount ( player ) ), aclGetGroup ( "POLICIAS (TROQUE AQUI PELO NOME DA ACL)" ) ) then --se for uma gang... if getPlayerTeam ( player ) and getTeamName ( getPlayerTeam ( player ) ) == "Policias (troque pelo nome da gang..)" then Enfim recomendo vc ler a "Introdução ao Scripting" para tentar resolver suas futuras duvidas sem o auxilio de ninguem https://wiki.multitheftauto.com/index.ph ... _Scripting Link to comment
Strikers Posted March 26, 2015 Author Share Posted March 26, 2015 Veja essa parte rapaz, Nela que o comando é 'adicionado': addCommandHandler ( Command, -- Adding The Command Handler function ( player, cmd ) if hasObjectPermissionTo ( player, "function.banPlayer" ) then triggerClientEvent(player,"jailShow",player) else outputChatBox(" Apenas Pm's Podem Usar Esse Comando ",player,255,0,0) end end ) Agora temos de saber se os policiais são um grupo na ACL ou uma gang (voce deve saber disso, né? '-'): --troque esta parte: if hasObjectPermissionTo ( player, "function.banPlayer" ) then --por: --se for um grupo na acl: if isObjectInACLGroup ("user."..getAccountName ( getPlayerAccount ( player ) ), aclGetGroup ( "POLICIAS (TROQUE AQUI PELO NOME DA ACL)" ) ) then --se for uma gang... if getPlayerTeam ( player ) and getTeamName ( getPlayerTeam ( player ) ) == "Policias (troque pelo nome da gang..)" then Enfim recomendo vc ler a "Introdução ao Scripting" para tentar resolver suas futuras duvidas sem o auxilio de ninguem https://wiki.multitheftauto.com/index.ph ... _Scripting Sim ACL eu sei oque e vou tentar ver se consigo fazer na copia se eu nao conseguir volto aki pode Ser? Link to comment
Strikers Posted March 26, 2015 Author Share Posted March 26, 2015 Veja essa parte rapaz, Nela que o comando é 'adicionado': addCommandHandler ( Command, -- Adding The Command Handler function ( player, cmd ) if hasObjectPermissionTo ( player, "function.banPlayer" ) then triggerClientEvent(player,"jailShow",player) else outputChatBox(" Apenas Pm's Podem Usar Esse Comando ",player,255,0,0) end end ) Agora temos de saber se os policiais são um grupo na ACL ou uma gang (voce deve saber disso, né? '-'): --troque esta parte: if hasObjectPermissionTo ( player, "function.banPlayer" ) then --por: --se for um grupo na acl: if isObjectInACLGroup ("user."..getAccountName ( getPlayerAccount ( player ) ), aclGetGroup ( "POLICIAS (TROQUE AQUI PELO NOME DA ACL)" ) ) then --se for uma gang... if getPlayerTeam ( player ) and getTeamName ( getPlayerTeam ( player ) ) == "Policias (troque pelo nome da gang..)" then Enfim recomendo vc ler a "Introdução ao Scripting" para tentar resolver suas futuras duvidas sem o auxilio de ninguem https://wiki.multitheftauto.com/index.ph ... _Scripting Oque Voce Me mando fazer nao estava dando certo entao resolvi procurar algumas coisas na net e achei eu modifiquei aquela parte accountname = getAccountName(getPlayerAccount(thePlayer)) if isObjectInACLGroup("user." .. accountname, aclGetGroup("Bope")) then triggerClientEvent(thePlayer,"jailShow",thePlayer) else outputChatBox(" Apenas Pm's Podem Usar Esse Comando ",player,255,0,0) Mais do mesmo geito Obrigado pela ajuda agradeço muito Link to comment
MrBugsFive Posted April 5, 2015 Share Posted April 5, 2015 Ola os Comando e que podem usa fica no meta.xml !! eu uso esse resource e muito bom 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