Jump to content

[Ajuda] Meta para essa Script


Recommended Posts

oi, tranquilos?

eu gostaria de saber como eu colocaria os argumentos que eu colocaria na meta.xml para essa script? Sei que é uma pergunta meio boba, mas eu acho que o erro está na meta que eu fiz

A Script:

local acls = { "SuperModerator", "Admin", "Console" } 
     
     
    local on = "nao"
    local coisa = nil
     
    function event (thePlayer)
         local account = getPlayerAccount(thePlayer)
             if (not account or isGuestAccount(account)) then return end
             local accountName = getAccountName(account)
             for i, v in pairs ( acls ) do
             if ( isObjectInACLGroup ( "user.".. accountName, aclGetGroup ( v ) ) ) then
            if(on == "sim")then
                outputChatBox("#FFF000[sERVER#FFFFFF Evento criado, use #FF0000/devent#FFFFFF to close the Event!",thePlayer,255,255,255,true)
            else
                local x,y,z = getElementPosition(thePlayer)
                            on = "sim"
                coisa = createMarker(x,y,z-1,"cylinder",2,0,255,0)
                dimen = getElementDimension(thePlayer)
                inte = getElementInterior(thePlayer)
                            outputChatBox("#FFF000[sERVER]#FFFFFF Administrador #FF0000"..getPlayerName(thePlayer).."#FFFFFF criou um evento, digite #FF0000/irevento#FFFFFF para participar!",root,255,255,255,true)
     
                if(inte)then
                    setElementInterior(coisa, inte)
                 end
                if(dimen)then
                    setElementDimension(coisa, dimen)
                end
                end
     
     
        else
        outputChatBox("#FFF000[sERVER]#FFFFFF Você não é um admin para criar um evento!",thePlayer,255,255,255,true)
        end
      end
      end
    addCommandHandler("cevento", event)local acls = { "SuperModerator", "Admin", "Console" }
     
     
    local on = "nao"
    local coisa = nil
     
    function event (thePlayer)
         local account = getPlayerAccount(thePlayer)
             if (not account or isGuestAccount(account)) then return end
             local accountName = getAccountName(account)
             for i, v in pairs ( acls ) do
             if ( isObjectInACLGroup ( "user.".. accountName, aclGetGroup ( v ) ) ) then
            if(on == "sim")then
                outputChatBox("#FFF000[sERVER#FFFFFF Evento created, use #FF0000/cancelarevento#FFFFFF to close the Event!",thePlayer,255,255,255,true)
            else
                local x,y,z = getElementPosition(thePlayer)
                            on = "sim"
                coisa = createMarker(x,y,z-1,"cylinder",2,0,255,0)
                dimen = getElementDimension(thePlayer)
                            inte = getElementInterior(thePlayer)
                outputChatBox("#FFF000[sERVER]#FFFFFF Administrador #FF0000"..getPlayerName(thePlayer).."#FFFFFF criou um evento, digite #FF0000/irevento#FFFFFF para participar!",root,255,255,255,true)
                    setElementInterior(coisa, inte)
                    if (dimen)then
                    setElementDimension(coisa, dimen)
                    end
                 end  
                 end
                 end
                 end
        if not (isObjectInACLGroup ( "user.".. accountName, aclGetGroup ( v ) ) ) then
        outputChatBox("#FFF000[sERVER]#FFFFFF Você não é um Admin para criar um evento!",thePlayer,255,255,255,true)
        end
    addCommandHandler("devento", event)
     
    function irevento(thePlayer,cmd)
        local x,y,z = getElementPosition(coisa)
        local inEvent = getElementData(thePlayer, "Evento")
     
        if(on == "sim")then -- "on == sim", on is a string var? setted in outside of this code?
            if(getPedOccupiedVehicle (thePlayer))then
                outputChatBox("#FFF000[sERVER]#FFFFFF Leave your vehicle to enter the event",thePlayer,255,255,255,true)
            else
                if (inEvent) then -- if the var "Evento" is true then say to player:
                    outputChatBox("#FFF000[sERVER]#FFFFFF You're already at the event.",thePlayer,255,255,255,true)
                else
                    -- only take weapons and give armor and helth if the player joined in event.
                    takeAllWeapons ( thePlayer )          
                    setElementHealth ( thePlayer, 100 )
                    setPedArmor ( thePlayer, 100 )
     
                    setElementData(thePlayer, "Evento", true) -- set var "Evento" to true
                    setElementPosition(thePlayer,x,y,z+1) -- set player position
                    setElementDimension(thePlayer, getElementDimension(coisa))
                    setElementInterior(thePlayer,inte)
                    outputChatBox("#FFF000[sERVER]#FFFFFF Welcome in the Event!",thePlayer,255,255,255,true)
                end
            end
        else
            outputChatBox("#FFF000[sERVER]#FFFFFF There isn't a event created!",thePlayer,255,255,255,true)
        end
    end
    addCommandHandler("irevento",irevento)
     
    function Infor(thePlayer)
        local accountname = getAccountName (getPlayerAccount(thePlayer))
        if (isObjectInACLGroup ( "user."..accountname, aclGetGroup ( "SuperModerator" or "Admin" ) )) then  
            outputChatBox("#FFF000[sERVER]#FFFFFF  - Commands for Event ",thePlayer, 255, 255, 255, true)
            outputChatBox("#FFF000[sERVER]#FFFFFF  #FF0000/cevento#FFFFFF - To create a event [Administators]!",thePlayer, 255, 255, 255, true)
            outputChatBox("#FFF000[sERVER]#FFFFFF  #FF0000/devento #FFFFFF- To close the event [Administators]!",thePlayer, 255, 255, 255, true)
            outputChatBox("#FFF000[sERVER]#FFFFFF #FF0000/irevento #FFFFFF- To enter the event [Players]!",thePlayer, 255, 255, 255, true)
            outputChatBox("#FFF000[sERVER]#FFFFFF #FF0000/sawnoff ,/m4,/tec9,/deagle #FFFFFF- To give players weapons [Administators]!",thePlayer, 255, 255, 255, true)
            outputChatBox("#FFF000[sERVER]#FFFFFF #FF0000/nrg500 , /dnrg500 #FFFFFF- To give and destroy a NRG-500 [Administators]!",thePlayer, 255, 255, 255, true)
            outputChatBox("#FFF000[sERVER]#FFFFFF #FF0000/givehealth , /takeweapons #FFFFFF- To give player health&armour and take weapons [Administators]!",thePlayer, 255, 255, 255, true)
        else
            outputChatBox("#FFF000[sERVER]#FFFFFF You aren't an admin to use this command",thePlayer,255,255,255,true)
        end
    end
    addCommandHandler ("event",Infor)
     
     
    function getWeapons ( thePlayer )
    local accountname = getAccountName (getPlayerAccount(thePlayer))
    if (isObjectInACLGroup ( "user."..accountname, aclGetGroup ( "SuperModerator" or "Admin" ) )) then  
    for _, events in ipairs(getElementsByType("player")) do
    local isPlayerInEvento = getElementData( events, "Evento" , nil )
    if ( isPlayerInEvento) then
    takeAllWeapons (events)
    outputChatBox("#FFF000[EVENTO]#FFFFFF "..getPlayerName(thePlayer).." Removeu suas Armas",events, 255, 255, 255, true)
    end
    end
    end
    end
    addCommandHandler ("tirararmas",getWeapons)
    function GiveHealthAndArmour ( thePlayer )
    local accountname = getAccountName (getPlayerAccount(thePlayer))
    if (isObjectInACLGroup ( "user."..accountname, aclGetGroup ( "SuperModerator" or "Admin" ) )) then  
    for _, events in ipairs(getElementsByType("player")) do
    local isPlayerInEvento = getElementData( events, "Evento" , nil )
    if ( isPlayerInEvento) then
    setElementHealth ( events, 100 )
    setPedArmor ( events, 100 )
    outputChatBox("#FFF000[EVENTO]#FFFFFF "..getPlayerName(thePlayer).." Deu Colete e Vida",events, 255, 255, 255, true)
    end
    end
    end
    end
    addCommandHandler ("darvida",GiveHealthAndArmour)
    function Frooze ( thePlayer )
    local accountname = getAccountName (getPlayerAccount(thePlayer))
    if (isObjectInACLGroup ( "user."..accountname, aclGetGroup ( "SuperModerator" or "Admin" ) )) then  
    for _, events in ipairs(getElementsByType("player")) do
    local isPlayerInEvento = getElementData( events, "Evento" , nil )
    if ( isPlayerInEvento) then
    setElementFrozen ( events, true )
    outputChatBox("#FFF000[EVENTO]#FFFFFF "..getPlayerName(thePlayer).." te Congelou",events, 255, 255, 255, true)
    end
    end
    end
    end
    addCommandHandler ("congelar",Frooze)
    function UnFrooze ( thePlayer )
    local accountname = getAccountName (getPlayerAccount(thePlayer))
    if (isObjectInACLGroup ( "user."..accountname, aclGetGroup ( "SuperModerator" or "Admin" ) )) then  
    for _, events in ipairs(getElementsByType("player")) do
    local isPlayerInEvento = getElementData( events, "Evento" , nil )
    if ( isPlayerInEvento) then
    setElementFrozen ( events, false )
    outputChatBox("#FFF000[EVENTO]#FFFFFF "..getPlayerName(thePlayer).." Te descongelou",events, 255, 255, 255, true)
    end
    end
    end
    end
    addCommandHandler ("descongelar",UnFrooze)
    function Deagle ( thePlayer )
    local accountname = getAccountName (getPlayerAccount(thePlayer))
    if (isObjectInACLGroup ( "user."..accountname, aclGetGroup ( "SuperModerator" or "Admin" ) )) then  
    for _, events in ipairs(getElementsByType("player")) do
    local isPlayerInEvento = getElementData( events, "Evento" , nil )
    if ( isPlayerInEvento) then
    giveWeapon ( events, 24, 9999 )
    setPedStat ( events, 73, 1000 )
    setPedStat ( events, 75, 1000 )
    setPedStat ( events, 71, 1000 )
    setPedStat ( events, 75, 1000 )
    setPedStat ( events, 77, 1000 )
    setPedStat ( events, 78, 1000 )
    outputChatBox("#FFF000[EVENTO]#FFFFFF "..getPlayerName(thePlayer).." Given you a Deagle !",events, 255, 255, 255, true)
    end
    end
    end
    end
    addCommandHandler ("deagle",Deagle)
    function SawnOff ( thePlayer )
    local accountname = getAccountName (getPlayerAccount(thePlayer))
    if (isObjectInACLGroup ( "user."..accountname, aclGetGroup ( "SuperModerator" or "Admin" ) )) then  
    for _, events in ipairs(getElementsByType("player")) do
    local isPlayerInEvento = getElementData( events, "Evento" , nil )
    if ( isPlayerInEvento) then
    giveWeapon ( events, 26, 9999 )
    setPedStat ( events, 73, 1000 )
    setPedStat ( events, 75, 1000 )
    setPedStat ( events, 71, 1000 )
    setPedStat ( events, 75, 1000 )
    setPedStat ( events, 77, 1000 )
    setPedStat ( events, 78, 1000 )
    outputChatBox("#FFF000[EVENTO]#FFFFFF "..getPlayerName(thePlayer).." Given you a Sawn off  !",events, 255, 255, 255, true)
    end
    end
    end
    end
    addCommandHandler ("sawnoff",SawnOff)
    function M4 ( thePlayer )
    local accountname = getAccountName (getPlayerAccount(thePlayer))
    if (isObjectInACLGroup ( "user."..accountname, aclGetGroup ( "SuperModerator" or "Admin" ) )) then  
    for _, events in ipairs(getElementsByType("player")) do
    local isPlayerInEvento = getElementData( events, "Evento" , nil )
    if ( isPlayerInEvento) then
    giveWeapon ( events, 31, 9999 )
    setPedStat ( events, 73, 1000 )
    setPedStat ( events, 75, 1000 )
    setPedStat ( events, 71, 1000 )
    setPedStat ( events, 75, 1000 )
    setPedStat ( events, 77, 1000 )
    setPedStat ( events, 78, 1000 )
    outputChatBox("#FFF000[EVENTO]#FFFFFF "..getPlayerName(thePlayer).." Given you a M4  !",events, 255, 255, 255, true)
    end
    end
    end
    end
    addCommandHandler ("m4",M4)
    function Tec9 ( thePlayer )
    local accountname = getAccountName (getPlayerAccount(thePlayer))
    if (isObjectInACLGroup ( "user."..accountname, aclGetGroup ( "SuperModerator" or "Admin" ) )) then  
    for _, events in ipairs(getElementsByType("player")) do
    local isPlayerInEvento = getElementData( events, "Evento" , nil )
    if ( isPlayerInEvento) then
    giveWeapon ( events, 32, 9999 )
    setPedStat ( events, 73, 1000 )
    setPedStat ( events, 75, 1000 )
    setPedStat ( events, 71, 1000 )
    setPedStat ( events, 75, 1000 )
    setPedStat ( events, 77, 1000 )
    setPedStat ( events, 78, 1000 )
    outputChatBox("#FFF000[EVENTO]#FFFFFF "..getPlayerName(thePlayer).." Given you a Tec 9  !",events, 255, 255, 255, true)
    end
    end
    end
    end
    addCommandHandler ("tec9",Tec9)
    function Minigun ( thePlayer )
    local accountname = getAccountName (getPlayerAccount(thePlayer))
    if (isObjectInACLGroup ( "user."..accountname, aclGetGroup ( "SuperModerator" or "Admin" ) )) then  
    for _, events in ipairs(getElementsByType("player")) do
    local isPlayerInEvento = getElementData( events, "Evento" , nil )
    if ( isPlayerInEvento) then
   
Link to comment

O código é do lado server, só colocar server na tag type no meta.xml (estando sem também será interpretado como do lado server).

<meta> 
    <script src="script.lua" type="server" /> 
</meta> 

Leia:

https://wiki.multitheftauto.com/wiki/O_arquivo_Meta

Para poder distinguir sobre o lado de um arquivo de script é preciso ter, ao menos, um pequeno conhecimento em Lua no MTA.

Mas, não necessariamente você vai precisar de tal conhecimento. Você ainda pode ver a qual lado as funções de um script corresponde, olhando a lista de funções do server e do client.

Em outros casos, pode ser necessário comparar os eventos de cada lado. Eventos do lado client sempre começam com onClient.

Nesse caso, acho que seria de grande utilidade ter um recurso de destacamento de funções em seu editor.

Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...