Leaderboard
Popular Content
Showing content with the highest reputation on 13/01/20 in all areas
-
Você removendo as linha onde destrói o veiculo quando pega outro veiculo, irá poder pegar além de 1 viatura, nos respectivos exemplos : if isElement( veh[hitElement] ) then destroyElement ( veh[hitElement] ) end --------------- OR ------------------- if tableVehicle[source] then -- se existir um valor na tableVehicle destroyElement ( tableVehicle[source] ) -- destroi oq esta na tableVehicle tableVehicle[source] = nil -- coloca tableVehicle como nil (anti-bug) end2 points
-
I got nothing to do with this ban, you're mistaken, for all I know you got banned by a discord moderator (Tut) because of some rules violation on discord, after which you decided to evade discord bans that you have received from moderators there, causing you to be re-banned. I will move this to the Site/Forum/Discord/Mantis/Wiki related section and let the moderator that banned you take a look. It will be locked until then. If Discord moderators want to handle it, they will unlock it and leave a reply.1 point
-
The first one seems quite reasonable. I'm not sure of the second but then again I might not be the best to consult on this matter.1 point
-
1 point
-
@Tommy. @Jonas^ Sobre o problema com indentação zoada: Só configurar pra indentar com espaços em vez de tabulações. function name () -- TAB end function name () -- 4 spaces end1 point
-
سمعت انه يمديك تتحكم من المود داخل سيرفر عن طريق اللوحه اللي صممتها ب سي شارب مأدري اذا هاذي ...1 point
-
function asd() local bb = {"A", "B", "C", "F", "G"} local z = bb[math.random(1,#bb)] outputChatBox(z) end addCommandHandler ( "ss", asd )1 point
-
function asd() local bb = {"A", "B", "C", "F", "G"} local z = "" for _, i in ipairs( bb ) do z = i end outputChatBox(z) end addCommandHandler ( "ss", asd )1 point
-
1 point
-
Observações: o seu código inicial @Rangel funciona! Mesmo tendo coisas sem sentidos como "comando" e "nick" em um addEventHandler e demais coisas, funciona sim! A unica coisa que não ocorre é o player poder destruir depois de ter saído do servidor! já o código do @Angelo Pereira é totalmente funcional e melhorado inclusive ( meus parabéns) Dito isso vamos lá, você tem 2 formas de fazer este Spawn de viaturas: Sistema 1 Para Criar a Vtr: local tableVehicle = {} local ACL = "BOMBEIROS" function spawnvtr ( mkr, dim ) if (dim) then -- verifica a dimensão if mkr == Spawn1 then -- verifica se a marker hitada é a de spawn. Se for então: local accName = getAccountName ( getPlayerAccount ( source ) ) -- pega a account do player if not isObjectInACLGroup ("user."..accName, aclGetGroup ( ACL) ) then -- se ele não for bombeiro ( não estiver na acl) então: outputChatBox("#FFFFFF| #E10000BOMBEIROS #FFFFFF| Somente #E10000BOMBEIROS #FFFFFFPodem Pegar Este Veiculo.", source,255,255,255, true) -- envia essa mensagem return -- termina a função, por precaução eu costumo fazer isto para evitar bug's! Poderia também usar um else no lugar do return! end -- se eu usar else, esse end aqui deveria ficar embaixo do warpPed! if tableVehicle[source] then -- se existir um valor na tableVehicle destroyElement ( tableVehicle[source] ) -- destroi oq esta na tableVehicle tableVehicle[source] = nil -- coloca tableVehicle como nil (anti-bug) end tableVehicle[source] = createVehicle(529, -2410.876, -600.848, 132.619, 0, 0, 270 ) -- cria o veículo e insere ele na tableVehicle setElementHealth (tableVehicle[source] , 200000) -- não entendi o porque de 200.000 de vida mas ok... warpPedIntoVehicle ( source, tableVehicle[source]) -- coloca o player dentro do veículo criado end end end addEventHandler("onPlayerMarkerHit", getRootElement(), spawnvtr) -- Obs: é de boa pratica sempre fazer as verificações negativas antes! Ex: -- Se o player não tiver isto ou não tiver aquilo então a função para de ser executada ou retorna! -- isto muitas das vezes evita bug :) Para destruir a Vtr: function destroyvtr ( mkr, dim ) if (dim) then if mkr == Destroy then local accName = getAccountName ( getPlayerAccount ( source ) ) if not isObjectInACLGroup ("user."..accName, aclGetGroup (ACL) ) then outputChatBox("#FFFFFF| #E10000BOMBEIROS #FFFFFF| Somente #E10000BOMBEIROS #FFFFFFPodem Destruir Este Veiculo.", source,255,255,255, true) return end if tableVehicle[source] then destroyElement (tableVehicle[source]) tableVehicle[source] = nil end end end end addEventHandler("onPlayerMarkerHit", getRootElement(), destroyvtr) Para quando o player sair do servidor: function onQuit() for _, player in ipairs(getElementsByType("player")) do -- faz um loop nos players online if tableVehicle[player] and isElement(tableVehicle[player]) then -- se o player possuia uma viatura antes de sair então: destroyElement (tableVehicle[player]) -- destroi a viatura tableVehicle[player] = nil end end end addEventHandler("onPlayerQuit", getRootElement(), onQuit) ______________________________________________________________________________________________________________________________________________________________________________________ Sistema 2 Para Criar a Vtr (mesmo código do outro sistema!): Obs: caso o player destrua a vtr, dará um erro no debug, mas nada grave! local tableVehicle = {} local ACL = "BOMBEIROS" function spawnvtr ( mkr, dim ) if (dim) then -- verifica a dimensão if mkr == Spawn1 then -- verifica se a marker hitada é a de spawn. Se for então: local accName = getAccountName ( getPlayerAccount ( source ) ) -- pega a account do player if not isObjectInACLGroup ("user."..accName, aclGetGroup (ACL) ) then -- se ele não for bombeiro ( não estivar na acl) então: outputChatBox("#FFFFFF| #E10000BOMBEIROS #FFFFFF| Somente #E10000BOMBEIROS #FFFFFFPodem Pegar Este Veiculo.", source,255,255,255, true) -- envia essa mensagem return -- termina a função, por precaução eu costumo fazer isto para evitar bug's! Poderia também usar um else no lugar do return! end -- se eu usar else, esse end aqui deveria ficar embaixo do warpPed! if tableVehicle[source] then -- se existir um valor na tableVehicle destroyElement ( tableVehicle[source] ) -- destroi oq esta na tableVehicle tableVehicle[source] = nil -- coloca tableVehicle como nil (anti-bug) end tableVehicle[source] = createVehicle(529, -2410.876, -600.848, 132.619, 0, 0, 270 ) -- cria o veículo e insere ele na tableVehicle setElementHealth (tableVehicle[source] , 200000) -- não entendi o porque de 200.000 de vida mas ok... warpPedIntoVehicle ( source, tableVehicle[source]) -- coloca o player dentro do veículo criado end end end addEventHandler("onPlayerMarkerHit", getRootElement(), spawnvtr) Para destruir a Vtr: function destruir(mkr, dim ) if (dim) then if mkr == Destroy then local accName = getAccountName ( getPlayerAccount ( source ) ) if not isObjectInACLGroup ("user."..accName, aclGetGroup (ACL) ) then outputChatBox("#FFFFFF| #E10000BOMBEIROS #FFFFFF| Somente #E10000BOMBEIROS #FFFFFFPodem Destruir Este Veiculo.", source,255,255,255, true) return end local vehicle = getPedOccupiedVehicle(source) -- retorna o veiculo que o player tá local modelo = getElementModel(vehicle) -- pega o modelo do veículo (id) local idViatura = {529, 429} -- tabela onde tem os id's que podem ser destruidos! for _, veiculo in ipairs(idViatura) do -- loop if (isElement(vehicle)) and (getElementType(vehicle)=="vehicle") and (modelo == veiculo) then -- se o que hitou a marker for um veículo e, o modelo(id) dele esta na tabela então: destroyElement (vehicle) -- destroi o veículo! end end end end end addEventHandler("onPlayerMarkerHit", getRootElement(), destruir) No sistema 2 não será necessário a parte do player sair do servidor pois qualquer pessoa que POSSUA a TAG, poderá destruir a viatura. Só para meio de conhecimento ainda há outras formas, uma delas é com o executeSQLQuery (database interna)! Caso tenha alguma duvida só pergunta! Obs: tenha certeza q a ACL "BOMBEIROS" esta criada, e que você esta nela!!1 point
-
Mostra algum erro no debugscript3? eu testei aqui é funcionou, verifique a ACL se está criada no seu GRUPO de ACLs1 point
-
Spawn1 = createMarker(-65.258903503418, -343.11831665039, 5.4296875 -1,"cylinder", 1.9, 0, 0, 200, 40) Destroy = createMarker(-65.258903503418, -371.39807128906, 5.4296875 -2,"cylinder", 5.0, 128, 0, 0, 99) veh = {} function spawnvtr ( hitElement ) if getElementType(hitElement) == "player" and not isPedInVehicle(hitElement) then -- Adicionado if isElement( veh[hitElement] ) then destroyElement ( veh[hitElement] ) end local accName = getAccountName ( getPlayerAccount ( hitElement ) ) if isObjectInACLGroup ("user."..accName, aclGetGroup ( "BOMBEIROS") ) then veh[hitElement] = createVehicle(529, -61.04016494751, -303.79797363281, 5.3578243255615, 0, 0, 270 ) warpPedIntoVehicle ( hitElement, veh[hitElement] ) --exports._infobox:addNotification(hitElement, "", "success") else outputChatBox("#FFFFFF| #E10000BOMBEIROS #FFFFFF| Somente #E10000BOMBEIROS #FFFFFFPodem Pegar Este Veiculo.",hitElement,255,255,255, true) end end end addEventHandler("onMarkerHit", Spawn1, spawnvtr) function destroyvtr ( hitElement ) if isElement(veh[hitElement]) then destroyElement (veh[hitElement]) --exports._infobox:addNotification(thePlayer, "", "success") end end addEventHandler("onMarkerHit", Destroy, destroyvtr) Tente isso1 point
-
Rangel, posso te dar uma opinião. Se caso alguém consiga entrar na base que não seja da corporação ou gang etc, ela pode bugar todo seu servidor com o spawn. Ela pode spawnar vários veículos na base.1 point
-
Tem uns elementData que eu não entendi o motivo de sua existência, então deixei eles ai, kk. As linhas que acrescentei/ editei eu comentei com --/// explicando ela napvp = createColRectangle ( 5441.9, -1926.4, 119.5, 133 ) event_iniciado = 1 verificarOne = 0 local spawns = { { 5460.70264, -1825.30945, 10.97057 }, { 5454.74805, -1884.13953, 10.29621 }, { 5537.57373, -1887.13306, 11.04092 }, { 5545.14746, -1829.44873, 10.29401 }, { 5501.95557, -1861.66174, 10.29621 } } oldTeam = {} -- Tabela para salvar o Team antigo. function start_admin_event (player) if event_iniciado == 1 then local accName = getAccountName ( getPlayerAccount ( player ) ) if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Owner" ) ) then outputDebugString ("Evento Iniciado") event_iniciado = event_iniciado +1 i = 0 pvp_1 = createTeam("PVP-Red [use /pvp]", 255, 0, 0) pvp_2 = createTeam("PVP-Green [use /pvp]", 0, 255, 0) pvp_3 = createTeam("PVP-Blue [use /pvp]", 0, 0, 255) pvp_4 = createTeam("PVP-Yellow [use /pvp]", 255, 255, 0) addCommandHandler ( "pvp", tele ) end else outputChatBox("The event is already activated", player, 255, 0, 0) end end addCommandHandler ( "eventStart", start_admin_event ) function entrar_na_zona( thePlayer, matchingDimension ) if getElementType ( thePlayer ) == "player" then --outputChatBox( "Working One" ) redirecionar_team (thePlayer ) end end addEventHandler("onColShapeHit", zonapvp, entrar_na_zona) function sair_da_zona( thePlayer, matchingDimension ) if getElementType ( thePlayer ) == "player" then --outputChatBox( "Working Two" ) retirar_team (thePlayer ) end end addEventHandler("onColShapeLeave", zonapvp, sair_da_zona) function tele(player) local teles = math.random ( #spawns ) if ( teles ) then local isTeamPlayer = getPlayerTeam ( player ) if getElementData(player,"SavedTeam") then setElementData(player,"inPVP",true) else --outputDebugString ("Esse playe foi pro pvp mas não tem team") verificarOne = verificarOne +1 end setElementPosition(player, unpack ( spawns [ teles ] )) end end function redirecionar_team (thePlayer) playerTeam = getPlayerTeam(thePlayer) i = i + 1 if i > 4 then i = 1 end if pvp_1 and pvp_2 and pvp_3 and pvp_4 then if playerTeam then --/// Verifica se o player já estava em um Team oldTeam[thePlayer] = getTeamName(playerTeam) --/// Salva o Team na tabela oldTeam end if i == 1 then setPlayerTeam ( thePlayer, pvp_1 ) end if i == 2 then setPlayerTeam ( thePlayer, pvp_2 ) end if i == 3 then setPlayerTeam ( thePlayer, pvp_3 ) end if i == 4 then setPlayerTeam ( thePlayer, pvp_4 ) end end end function retirar_team (player) if getElementData(player,"SavedTeam") then if getTeamFromName(oldTeam[playerTeam]) then --/// Verifica se o Team antigo ainda existe setPlayerTeam(player, getTeamFromName(oldTeam[playerTeam])) --/// Seta o player no Team que está na tabela oldTeam end local t = getElementData ( player, "SavedTeam" ) setElementData(player,"SavedTeam",false) end end addCommandHandler("stop123", function (player) local accName = getAccountName ( getPlayerAccount ( player ) ) if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Owner" ) ) then if event_iniciado >= 2 then for k , v in ipairs(getElementsByType("player")) do if getElementData(v,"inPVP") then retirar_team (v) end end for i, team in ipairs(getElementsByType("team")) do destroyElement(team) end removeCommandHandler ( "pvp" ) event_iniciado = 1 else outputChatBox("Unable to stop because it was not started", player, 255, 0, 0) end end end) EDIT: Não testei.1 point
