kevincouto6
-
Posts
235 -
Joined
-
Last visited
Posts posted by kevincouto6
-
-
Andei lendo porem pelo que entendi não e possível aplicar essa função para apenas um jogador tipo, aplicar apenas para um ADMIN ou algo do tipo.
Alguém sabe me dizer se é possível faze-lo, aqui esta o link da função, não comecei nada ainda, por ter essa duvida XD
https://wiki.multitheftauto.com/wiki/SetWeaponProperty
-
Quero agradecer a todos pela ajuda, com ajuda de todos consegue finalizar o script e sobre o Thanks termino o resto amanha, ja deu meu limite hoje, obrigado mais uma vez ....
-
11 minutes ago, Angelo Pereira said:
zonapvp = createColRectangle ( 5441.9, -1926.4, 119.5, 133 )event_iniciado = 1verificarOne = 0oldTeam = {} -- Tabela para salvar o Team antigo.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}}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 end endaddCommandHandler ( "eventStart", start_admin_event )function entrar_na_zona( thePlayer, matchingDimension ) if getElementType ( thePlayer ) == "player" then redirecionar_team (thePlayer ) endendaddEventHandler("onColShapeHit", zonapvp, entrar_na_zona)function sair_da_zona( thePlayer, matchingDimension ) if getElementType ( thePlayer ) == "player" then retirar_team (thePlayer ) endendaddEventHandler("onColShapeLeave", zonapvp, sair_da_zona)function tele(player) local teles = math.random ( #spawns ) if ( teles ) then local isTeamPlayer = getPlayerTeam ( player ) verificarOne = verificarOne +1 setElementData(player,"inPVP",true) redirecionar_team(player) setElementPosition(player, unpack ( spawns [ teles ] )) end endfunction 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 if not oldTeam[thePlayer] then -- Adicionado oldTeam[thePlayer] = getTeamName(playerTeam) end -- Adicionado --else -- Adicionado -- oldTeam[thePlayer] = true -- Adicionado 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 endendfunction retirar_team (player) if oldTeam[player] then local team = getTeamFromName(oldTeam[player]) or false -- Adicionado if team then -- Adicionado setPlayerTeam(player, getTeamFromName(oldTeam[player])) oldTeam[player] = nil -- Adicionado end else setPlayerTeam(player, nil) -- Adicionado endendaddCommandHandler("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 destroyElement(pvp_1) destroyElement(pvp_2) destroyElement(pvp_3) destroyElement(pvp_4) removeCommandHandler("pvp") event_iniciado = 1 end endend)
Você fez alterações no código, em vez, de remover a linha que eu tinha mencionado, teste isso
Agora esta porem esta enviando todos para o time PVP - RED, os players que não tem team estão indo para PVP RED, quando morrem
-
Just now, Angelo Pereira said:
Mostra como você fez, e suas alterações...
zonapvp = createColRectangle ( 5441.9, -1926.4, 119.5, 133 ) event_iniciado = 1 verificarOne = 0 oldTeam = {} -- Tabela para salvar o Team antigo. 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} } 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 end end addCommandHandler ( "eventStart", start_admin_event ) function entrar_na_zona( thePlayer, matchingDimension ) if getElementType ( thePlayer ) == "player" then redirecionar_team (thePlayer ) end end addEventHandler("onColShapeHit", zonapvp, entrar_na_zona) function sair_da_zona( thePlayer, matchingDimension ) if getElementType ( thePlayer ) == "player" then 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 ) verificarOne = verificarOne +1 setElementData(player,"inPVP",true) redirecionar_team(player) 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 if not oldTeam[thePlayer] then -- Adicionado oldTeam[thePlayer] = getTeamName(playerTeam) end -- Adicionado else -- Adicionado oldTeam[thePlayer] = true -- Adicionado 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 oldTeam[player] == true then local team = getTeamFromName(oldTeam[player]) or false -- Adicionado if team then -- Adicionado setPlayerTeam(player, getTeamFromName(oldTeam[player])) oldTeam[player] = nil -- Adicionado end else setPlayerTeam(player, nil) -- Adicionado 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 destroyElement(pvp_1) destroyElement(pvp_2) destroyElement(pvp_3) destroyElement(pvp_4) removeCommandHandler("pvp") event_iniciado = 1 end end end)
Não esta mais funcionando para nenhum team ele não os retorna da esse erro
para players que n tem time "" 88:Bad argument @'getTeamFromName' "Expected string at argument 1, got boolean"
para players que tem time : não aparece erro mas tmb não o retorna para o time antigo
-
1 hour ago, Angelo Pereira said:
Na observação[1] eu falei, ou você remove, ou você comenta (--) a linha 73 : caso usar a 2º opção.
- 72. --else -- Adicionado
- 73. --oldTeam[thePlayer] = true -- Adicionado
Sacou?
desculpe não consegui compreender oque devo complementar ?
OBS: sou meio lerdo
-
2 hours ago, Angelo Pereira said:
-- Adicionado (O que eu acrescentei nas linhas).
Aqui, eu fiz algumas alterações : (Particularmente, o kevin deverá coloca um tempo para cada player da teleporte a este local), enfim, as alterações foram :
Linha 69.
if playerTeam then if not oldTeam[thePlayer] then -- Adicionado oldTeam[thePlayer] = getTeamName(playerTeam) end -- Adicionadoelse -- AdicionadooldTeam[thePlayer] = true -- Adicionado end
- Verificar se o player está na team(É o que você colocou), então vai verificar se o player já está na tabela, caso não, ira cria-lá, e caso o player não tenha team, vai seta-lo uma tabela como true.
Linha 91.
function retirar_team (player) if oldTeam[player] then if oldTeam[player] == true then setPlayerTeam(player, nil) oldTeam[player] = nil return end -- Adicionado local team = getTeamFromName(oldTeam[player]) or false -- Adicionado if team then -- Adicionado setPlayerTeam(player, getTeamFromName(oldTeam[player])) oldTeam[player] = nil -- Adicionado end endend
- Verificar se o player está na tabela, verifica se o player está como true (onde o jogador não tem team), caso for true, então remove da team e da tabela, caso o player tiver com team, verificará se essa team ainda existe, caso existir, então setara-lo a team e removerá da tabela.
- Observação[1]: Daria de fazer de uma forma diferente onde a questão relacionada na linha 73 (Remove-lá), e fazer o seguinte :
?">function retirar_team (player) if oldTeam[player] then local team = getTeamFromName(oldTeam[player]) or false -- Adicionado if team then -- Adicionado setPlayerTeam(player, getTeamFromName(oldTeam[player])) oldTeam[player] = nil -- Adicionado end else setPlayerTeam(player, nil) -- Adicionado endend
Eai esta funcionando normalmente só da esse erro quando o player não tem nenhum time , 88:Bad argument @'getTeamFromName' "Expected string at argument 1, got boolean"
Acho que tem que criar uma verificação para que se o player não tiver um time remova o do time pvp, Pelo que entedi você fez o aki porem até os player sem time estão sendo add na tabela, assim ele é verificado da msm forma.
function retirar_team (player) if oldTeam[player] then local team = getTeamFromName(oldTeam[player]) or false -- Adicionado if team then -- Adicionado setPlayerTeam(player, getTeamFromName(oldTeam[player])) oldTeam[player] = nil -- Adicionado end else setPlayerTeam(player, nil) -- Adicionado end end
-
On 11/01/2020 at 22:45, Tommy. said:
@kevincouto6 Eu testei aqui e está funcionando só achei dois probleminha, vou enviar a correção logo a baixo, eu tirei algumas linhas desnecessárias.
@Jonas^ Eu não sei muito o motivo de quando eu colo o script do vscode aqui no forum a indentação fica toda zoada, ksks
- CORREÇÃO
zonapvp = createColRectangle ( 5441.9, -1926.4, 119.5, 133 )event_iniciado = 1verificarOne = 0local 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 end endaddCommandHandler ( "eventStart", start_admin_event )function entrar_na_zona( thePlayer, matchingDimension ) if getElementType ( thePlayer ) == "player" then redirecionar_team (thePlayer ) endendaddEventHandler("onColShapeHit", zonapvp, entrar_na_zona)function sair_da_zona( thePlayer, matchingDimension ) if getElementType ( thePlayer ) == "player" then retirar_team (thePlayer ) endendaddEventHandler("onColShapeLeave", zonapvp, sair_da_zona)function tele(player) local teles = math.random ( #spawns ) if ( teles ) then local isTeamPlayer = getPlayerTeam ( player ) verificarOne = verificarOne +1 setElementData(player,"inPVP",true) redirecionar_team(player) setElementPosition(player, unpack ( spawns [ teles ] )) end endfunction 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 endend function retirar_team (player) if getTeamFromName(oldTeam[player]) then --/// Verifica se o Team antigo ainda existe setPlayerTeam(player, getTeamFromName(oldTeam[player])) --/// Seta o player no Team que está na tabela oldTeam endendaddCommandHandler("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 destroyElement(pvp_1) destroyElement(pvp_2) destroyElement(pvp_3) destroyElement(pvp_4) removeCommandHandler("pvp") event_iniciado = 1 end endend)
EDIT: Testado.
Eai parece estar funcionando tds funções mas não retorna o player ao team antigo, exemplo
Kevin " team = Dragons"
usei o commando /pvp
agora estou no team "pvp_1"
porem quando morro não retorno ao team Dragons
-
On 10/01/2020 at 10:51, Tommy. said:
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.
Line : 91 ( Bad Argument @ 'getTeamFromName' [expected string at argument 1, got nil] )
Quando fui testar apareceu esse erro tentei resolver mas não consegui "playerTeam = getPlayerTeam( thePlayer )" acho que o erro esta nesta parte onde salva o team do player
-
Primeiro esse é um script de PVP porem um PVP com times, quero mover o jogador por um momento apenas até ele morrer, quando ele morrer deve voltar ao team antigo, só que não esta funcionando e quando funciona, salva-se um team por cima do outro, isso faz com que os players não voltem a seu team antigo e sim para o time do ultimo player que usou o comando.
OBS: não tem nada no lado "Client"
OBS: Não demonstra nenhum erro no debugscript 3
Esse é o lado "Server"
zonapvp = 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 } } 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) --outputDebugString (" inPVP ativado ") 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 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 local t = getElementData ( player, "SavedTeam" ) outputDebugString ("tem timer") setPlayerTeam ( player, getTeamFromName ( t ) ) setElementData(player,"SavedTeam",false) --outputDebugString ("tem time") 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)
-
I tried to find a solution but I couldn't, like it works correctly but for players who do not have a team, and this error
bad argument @'getteamfromName (expected string at argument 1, got bolean)
with what I did until check individually, but when removing remove try to do with all
zonapvp = 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 } } 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 ( isTeamPlayer ) then setElementData(player,"inPVP",true) setElementData ( player, "SavedTeam", getTeamName ( getPlayerTeam ( player ) ) ) --outputDebugString (" inPVP ativado ") 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 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 verificarOne == 1 then setPlayerTeam ( player, nil ) --outputDebugString ("nao tem time") verificarOne = 0 else local t = getElementData ( player, "SavedTeam" ) outputDebugString ("tem timer") setPlayerTeam ( player, getTeamFromName ( t ) ) setElementData(player,"SavedTeam",false) --outputDebugString ("tem time") 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)
-
Basically it is a script where the player uses the command and is moved to a team, when the player dies in the event wanted him to return to his old team, but is saving one on top of the other when more than 1 players use the commando.
Like each time the player uses the command of the event, and removed the information playerTeam = getPlayerTeam (player), however if several players use will not save each one individually then, type accurate that each player returns to the team that was, not to the team of the last player who used the commando. Can you tell me how to do it?
currently no debug errors ... Sincerely Kevin
zonapvp = createColRectangle ( 5441.9, -1926.4, 119.5, 133 ) event_iniciado = 1 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 } } 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("O evento ja esta ativado", 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 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 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) setPlayerTeam ( player, playerTeam ) end addCommandHandler("stop123", function (player) local accName = getAccountName ( getPlayerAccount ( player ) ) if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Owner" ) ) then if event_iniciado >= 2 then destroyElement ( pvp_1 ) destroyElement ( pvp_2 ) destroyElement ( pvp_3 ) destroyElement ( pvp_4 ) removeCommandHandler ( "pvp" ) event_iniciado = 1 retirar_team () else outputChatBox("Não possivel parar, porque não foi iniciado", player, 255, 0, 0) end end end)
-
function onWasted(totalAmmo, killer, killerWeapon, bodypart, stealth) local ContaDoPlayer = getPlayerAccount ( source ) if (isGuestAccount ( ContaDoPlayer ) then --deixe em branco else local theWeapon = getPedWeapon (source) local weaponAmmo = getPedTotalAmmo (source) takeAllWeapons(source) setPlayerWantedLevel(source, 0) setTimer (spawnPlayer, 1000, 1, source, 1158.344, -1293.679, 16.445, 0, getElementModel (source), 0, 0, getPlayerTeam(source)) fadeCamera ( source, false, 0, 0, 0, 0 ) setTimer ( fadeCamera, 2000, 1, source , true, 0.5 ) setTimer ( setCameraTarget, 1250, 1, source ) end end addEventHandler ("onPlayerWasted", getRootElement(), onWasted)
Olá, costumo sempre pedir ajuda aqui, e em um dos meus posts, me recomendaram evitar o uso de if not, então use else assim quando não estiver, vai funcionar. Ouvi isso faz algum tempo espero que tenha ajudado. Alguem com mais experiência pode confirmar oq eu falei para ter certeza....
- 1
-
16 hours ago, DNL291 said:
Entendi o que você quis dizer, porem acho que agr não e mais necessario eu puxei as funções para fora assim elas funcionam para todos, porem agora tenho outra dificuldade ..
Tipo cada vez que o jogador usa o commando o evento, e retirado a informação playerTeam = getPlayerTeam(player), porem se varios player usarem não vai salvar individualmente a de cada um então, tipo preciso que cada player retorne ao time que estava, não ao team do ultimo player que usou o commando. sabe me dizer como faze-lo ?
zonapvp = createColRectangle ( 5441.9, -1926.4, 119.5, 133 ) event_iniciado = 1 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 } } 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("O evento ja esta ativado", 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 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 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) setPlayerTeam ( player, playerTeam ) end addCommandHandler("stop123", function (player) local accName = getAccountName ( getPlayerAccount ( player ) ) if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Owner" ) ) then if event_iniciado >= 2 then destroyElement ( pvp_1 ) destroyElement ( pvp_2 ) destroyElement ( pvp_3 ) destroyElement ( pvp_4 ) removeCommandHandler ( "pvp" ) event_iniciado = 1 retirar_team () else outputChatBox("Não possivel parar, porque não foi iniciado", player, 255, 0, 0) end end end)
-
Eai, preciso de ajuda aqui, estou tentando desenvolver um evento, para todos jogadores, mas que só o admin pode inicia-lo com o comando.
Basicamente só esta funcionando com o jogador que cria o evento, tipo só o Admin.
Para Finalizar o evento a mesma coisa, só finaliza para o Admin que iniciou.
Server-side
event_iniciado = 1 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 } } function start_admin_event (player) if event_iniciado == 1 then event_iniciado = event_iniciado +1 local accName = getAccountName ( getPlayerAccount ( player ) ) if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Owner" ) ) then zonapvp = createColRectangle ( 5441.9, -1926.4, 119.5, 133 ) function entrar_na_zona( theElement, matchingDimension ) if ( theElement == player ) then outputChatBox( "Working One" ) redirecionar_team (player) end end addEventHandler("onColShapeHit", zonapvp, entrar_na_zona) function sair_da_zona( theElement, matchingDimension ) if ( theElement == player ) then outputChatBox( "Working Two" ) retirar_team (player) end end addEventHandler("onColShapeLeave", zonapvp, sair_da_zona) outputDebugString ("Evento Iniciado") 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("O evento ja esta ativado", player, 255, 0, 0) end end addCommandHandler ( "startEvent", start_admin_event ) function tele(player) local teles = math.random ( #spawns ) if ( teles ) then 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 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) setPlayerTeam ( player, playerTeam ) end addCommandHandler("stopEvent", function (player) local accName = getAccountName ( getPlayerAccount ( player ) ) if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Owner" ) ) then if event_iniciado >= 2 then destroyElement ( zonapvp ) destroyElement ( pvp_1 ) destroyElement ( pvp_2 ) destroyElement ( pvp_3 ) destroyElement ( pvp_4 ) removeCommandHandler ( "pvp" ) event_iniciado = 1 retirar_team () else outputChatBox("Não possivel parar, porque não foi iniciado", player, 255, 0, 0) end end end)
-
I need help to verify, if the name is listed in the table but it is not working, thx since now !
tableNamePlayersTFO = { {theBlack}, {Alpicture}, {Delmon} }, MarkerTFO = createMarker ( 2772.85, -2514.28, 13.63 - 1, 'cylinder', 5.0, 255, 0, 0, 0 ) MarkerTwoTFO = createMarker ( 2767.72, -2518.99, 13.64 - 1, 'cylinder', 5.0, 255, 0, 0, 0 ) function SetSkinTFO(player) if getElementData(player,'vipskin') == true then else if getElementType ( player ) == "vehicle" then else if getPlayerName ( player ) == ( tableNamePlayersTFO ) then if (getPlayerSkin(player) == 290) then else setPlayerSkin(player, 290) end else local PlayerTeamTFO = getPlayerTeam ( player ) local TeamNTFO = getTeamFromName ( "The First Order" ) if isElementWithinMarker ( player, MarkerTFO ) or isElementWithinMarker ( player, MarkerTwoTFO ) then if PlayerTeamTFO == TeamNTFO then if (getPlayerSkin(player) == 288) then else setPlayerSkin(player, 288) end end end end end end end addEventHandler("onMarkerHit", MarkerTFO, SetSkinTFO) addEventHandler("onMarkerHit", MarkerTwoTFO, SetSkinTFO)
-
@asrzk Olá, hoje quando fui testar o script, não funcionou, continua com o dano normal
-
15 minutes ago, Lord Henry said:
Tente fazer ela client-side. Pela lógica só vai afetar no cliente específico. Mas não tenho certeza.
Pesei assim tmb, mas não funciona, pede para criar um createWeapon se eu usar esta função, vai criar weapon, mas não vou poder usar arma em si.
19 minutes ago, asrzk said:Usando essa função creio eu que não, não seja possível. Porém há outra forma de fazer isso. Usando o evento onClientPlayerDamage.
Poderia tentar eu verificario o player, o grupo, e se é a desert deagle, mas como eu modificaria o dano para funcionar em PED e em Players ?
-
Este pode te ajudar aqui tem bastante coisas em português, acho que quase toda wiki ( Server Scripting Events / Client Scripting Events e mais outras coisas) < Referência )
acho que pode te ajudar link >>>>> https://wiki.multitheftauto.com/wiki/Página_Inicial
-
Estava, fazendo um teste com setWeaponProperty, e dei de cara com desafio, será que e possível ativar apenas para um jogador, tipo um arma especifica para cada jogador.
tentativas
Tentei expecificar o player e do grupo ADMIN.
verifiquei pelo NOME player.
porem acho que o problema e em si no setWeaponProperty, tipo "weaponSkill: Either: "pro", "std" or "poor". The player must have this skill level set to have the effect.", ele ativa para um class de jogador tipo,
pensei em fazer no lado client pois não entendi como funciona, ao meu ver vou ter que criar um "weapon", ou algo do tipo.
estava pensando em criar um "função" para botar no lugar de "PRO" "STD" "POOR", que funcione apenas par um, mas não sei como fazer. (posso estar viajando, (falando besteira) )
se existir outro modo podem me ensinar ?
Obrigado desde já !
createPed ( 120, -2422, -610, 132 ) function desertWeaponEdited ( playerSource ) if ( playerSource ) then local theAccount = getPlayerAccount( playerSource ) if theAccount then local accountName = getAccountName( theAccount ) if isObjectInACLGroup("user." .. accountName, aclGetGroup ( "Owner", "Moderator" ) ) then if getPlayerName ( playerSource ) == ( "mane321" ) then setWeaponProperty(24,"pro", "damage", 500) outputChatBox("Funcionou, Arma Admin Adicionada") end end end end end addCommandHandler ( "desertWeapon", desertWeaponEdited )
para apenas um player
-
@#DaNiLiN Já tentou fazer uma verificação para cada tela, e definir um valo a size tipo assim
if guiGetScreenSize() = ( 1366 , 768 ) then size = 5 else if guiGetScreenSize() = ( 1280 , 768 ) then size = 4.7 else if guiGetScreenSize() = ( 1280 , 720 ) then size = 4.4 else if guiGetScreenSize() = ( 1280 , 600 ) then size = 4.1 else if guiGetScreenSize() = ( 1024 , 768 ) then size = 3.8 else if guiGetScreenSize() = ( 800 , 600 ) then size = 3.5 else if guiGetScreenSize() = ( 656 , 496 ) then size = 3.2 else if guiGetScreenSize() = ( 640 , 480 ) then size = 2.9 else size = 5 end end end end end end end end
Assim depois basta usar, o valor de size, obs: não sei se é o jeito correto, mas acho que vale apena tentar
clear = dxCreateFont( "segoeui.ttf", size ) dxDrawText("Test Text", x*0.4,y*0.65,x,y,tocolor(255,255,255,255), size, clear,"left","top",false,false,true,true,true)
-
Porém voçê usa no size, tipo assim
clear = dxCreateFont( "segoeui.ttf", (x)*20 ) dxDrawText("Test Text", x*0.4,y*0.65,x,y,tocolor(255,255,255,255),1,clear,"left","top",false,false,true,true,true)
-
Olá obgd pela ajuda, funcionou porem use apenas (x)* 5, quando eu usava ( x / y )*5, ficava muito grande na resolução 640/480, então use assim
local screenW,screenH = guiGetScreenSize() local resW,resH = 1366,768 local x,y = (screenW/resW), (screenH/resH) function Dx () dxDrawRectangle(x*0, y*315, x*1366, y*150, tocolor(0, 0, 0, 239), false) dxDrawText(" ## Mission Complete ! ##", x*0, y*320, x*1366, y*150, tocolor(254, 5, 5, 254), (x)*5, "beckett", "left", "top", false, false, false, false, false) end function Fim_Mission () addEventHandler("onClientRender", root, Dx) setTimer(function() removeEventHandler("onClientRender", root, Dx) end, 10000, 1) end addCommandHandler("teste", Fim_Mission)
1366 / 768 640 / 480
Queria apenas uma ultima opnião se esta tudo correto
-
Show de Bola esse Vídeo, Pude ver vários erros que cometi, ehhehe ( vlw pelo video )
-
8 hours ago, #DaNiLiN said:
então estava testando e funcionou no (dxDrawRetangle), pelo que entendi não é possivel redimensionar o texto, então existe outra forma de fazer ? nos testes com o quadro funcionou mas não com o texto,
local screenW,screenH = guiGetScreenSize() local resW,resH = 1366,768 local x,y = (screenW/resW), (screenH/resH) function Dx () dxDrawRectangle(x*0, y*315, x*1366, y*192, tocolor(0, 0, 0, 239), false) dxDrawText(" Mission Complete !", x*209, y*320, x*1151, y*188, tocolor(254, 5, 5, 254), 5.00, "beckett", "left", "top", false, false, false, false, false) end function Fim_Mission () addEventHandler("onClientRender", root, Dx) setTimer(function() removeEventHandler("onClientRender", root, Dx) end, 10000, 1) end addCommandHandler("teste", Fim_Mission)
Imagem de como ficou
O erro do debug ja foi resolvido "so pra avisar"
Olá eu novamente, setWeaponProperty
in Programação em Lua
Posted
Existe outra forma de eu alterar o dano de uma arma, ou eu criar uma arma substituindo alguma existente, tipo um mp5 ou outra armas, porem seria possivel alterar uma mp5 e transformar em uma Desert deagle, algo nesse estilo ?