Jump to content

Dosen't Work


xeon17

Recommended Posts

Work only for ORGANIZADOR Group , for other no ? why ?

local account = getPlayerAccount(thePlayer) 
if (not account or isGuestAccount(account)) then return end 
local accountName = getAccountName(account) 
if ( isObjectInACLGroup ( "user.".. accountName, aclGetGroup ( "ORGANIZADOR" or "MODERADOR" or "ADMINISTADOR" ) ) ) then 

Link to comment

Try this:

local account = getPlayerAccount(thePlayer) 
if (not account or isGuestAccount(account)) then return end 
local accountName = getAccountName(account) 
for _, group in ipairs ( { "ORGANIZADOR", "MODERADOR", "ADMINISTADOR"" } ) do   
        if isObjectInACLGroup ( "user.".. getAccountName ( account ), aclGetGroup ( group ) )   then 
            inGroup = true 
 

or:

local account = getPlayerAccount(thePlayer) 
if (not account or isGuestAccount(account)) then return end 
local accountName = getAccountName(account) 
for _, group in ipairs ( { "Organizer", "Moderator", "Administrator"" } ) do   
        if isObjectInACLGroup ( "user.".. getAccountName ( account ), aclGetGroup ( group ) )   then 
            inGroup = true 
 

Link to comment

Try this:

  
local account = getPlayerAccount(thePlayer) 
if (not account or isGuestAccount(account)) then return end 
local accountName = getAccountName(account) 
if ( isObjectInACLGroup ( "user.".. accountName, aclGetGroup ( "ORGANIZADOR)" or ( isObjectInACLGroup ( "user.".. accountName, aclGetGroup ("MODERADOR") or ( isObjectInACLGroup ( "user.".. accountName, aclGetGroup ("ADMINISTADOR" ) ) ) then 
  
  

Link to comment
groups = { "ORGANIZADOR", "MODERADOR", "ADMINISTADOR" } 
  
function () 
local account = getPlayerAccount(thePlayer) 
if (not account or isGuestAccount(account)) then return end 
local accountName = getAccountName(account) 
        for i, v in pairs ( groups ) do 
            if ( isObjectInACLGroup ( "user.".. accountName, aclGetGroup (v) ) ) then 

Link to comment

Here full script ( server side )

function toggleGodMode(thePlayer) 
  
local account = getPlayerAccount(thePlayer) 
if (not account or isGuestAccount(account)) then return end 
local accountName = getAccountName(account) 
if ( isObjectInACLGroup ( "user.".. accountName, aclGetGroup ( "ORGANIZADOR" or "MODERADOR" or "ADMINISTADOR" ) ) ) then 
        if getElementData(thePlayer,"invincible") then 
            setElementData(thePlayer,"invincible",false) 
            outputChatBox("[ADMIN] GODMODE DEACTIVATED.",thePlayer,0,255,0) 
        else 
            setElementData(thePlayer,"invincible",true) 
            outputChatBox("[ADMIN] GODMODE ACTIVATED.",thePlayer,0,255,0) 
            end 
        end 
    end 
    addCommandHandler("god",toggleGodMode) 

Link to comment

Simply add the right command.god to ACL to whatever group you want it to use and use the third argument of addCommandHandler so it will be:

addCommandHandler("god", toggleGodMode, true) 

Then add this:

<right name="command.god" access="true" /> 

To desired ACL groups.

Then delete all that right checking nonsense of yours and it will work.

Edited by Guest
Link to comment

You can't use or like that.

local acls = { "ORGANIZADOR", "MODERADOR", "ADMINISTADOR" ) 
  
function toggleGodMode(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 getElementData(thePlayer,"invincible") then 
                setElementData(thePlayer,"invincible",false) 
                outputChatBox("[ADMIN] GODMODE DEACTIVATED.",thePlayer,0,255,0) 
            else 
                setElementData(thePlayer,"invincible",true) 
                outputChatBox("[ADMIN] GODMODE ACTIVATED.",thePlayer,0,255,0) 
            end 
            break 
        end 
    end 
end 
  
addCommandHandler("god",toggleGodMode) 

Link to comment
[2014-06-11 16:35:05] Resource '[sT]godmode' changed, reloading and starting 
[2014-06-11 16:35:05] Starting [ST]godmode 
[2014-06-11 16:35:05] SCRIPT ERROR: [ST]godmode\s_godmode.lua:1: '}' expected near ')' 
[2014-06-11 16:35:05] ERROR: Loading script failed: [ST]godmode\s_godmode.lua:1: '}' expected near ')' 

Link to comment

had an error on line 1

local acls = { "ORGANIZADOR", "MODERADOR", "ADMINISTADOR"`}  
  
function toggleGodMode(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 getElementData(thePlayer,"invincible") then 
                setElementData(thePlayer,"invincible",false) 
                outputChatBox("[ADMIN] GODMODE DEACTIVATED.",thePlayer,0,255,0) 
            else 
                setElementData(thePlayer,"invincible",true) 
                outputChatBox("[ADMIN] GODMODE ACTIVATED.",thePlayer,0,255,0) 
            end 
            break 
        end 
    end 
end 
  
addCommandHandler("god",toggleGodMode) 

Link to comment

Should i do the same for my other script ?

help guys

local on = "nao" 
local coisa = nil
 
function event (thePlayer)
    local accountname = getAccountName (getPlayerAccount(thePlayer))
    if (isObjectInACLGroup ( "user."..accountname, aclGetGroup ( "ORGANIZADOR" or "MODERADOR" ) )) then    
        if(on == "sim")then
            outputChatBox("#FFF000[sERVER#FFFFFF Evento created, use #FF0000/devent#FFFFFF to close the Event!",thePlayer,255,255,255,true)
        else
            local x,y,z = getElementPosition(thePlayer)
            coisa = createMarker(x,y,z-1,"cylinder",2,0,255,0)
            dimen = getElementDimension(thePlayer)
            inte = getElementInterior(thePlayer)
 
            if(inte)then
                setElementInterior(coisa, inte)
            end
 
            if(dimen)then
                setElementDimension(coisa, dimen)
            end
 
            on = "sim"         
            outputChatBox("#FFF000[sERVER]#FFFFFF Administator #FF0000"..getPlayerName(thePlayer).."#FFFFFF created a event, write #FF0000/irevento#FFFFFF to participate!",root,255,255,255,true)
        end
    else
    outputChatBox("#FFF000[sERVER]#FFFFFF You aren't a admin to create a event!",thePlayer,255,255,255,true)
    end
end
addCommandHandler("cevent", event)
 
function destruir (thePlayer)
    local accountname = getAccountName (getPlayerAccount(thePlayer))
    if (isObjectInACLGroup ( "user."..accountname, aclGetGroup ( "ORGANIZADOR" or "MODERADOR" ) )) then
        if(on == "nao")then
            outputChatBox("#FFF000[sERVER]#FFFFFF There isn't a event, use #FF0000/cevent #FFFFFF to create a event!",thePlayer,255,255,255,true)
        else
            if (isElement(coisa)) then
                destroyElement(coisa)
            end
 
            for _, p in ipairs(getElementsByType("player")) do
                local isPlayerInEvento = getElementData(p, "Evento")
                if (isPlayerInEvento) then
                    setElementData(p, "Evento", false)
                    outputChatBox("#FFF000[sERVER]#FFFFFF Administator #FF0000"..getPlayerName(thePlayer).." #FFFFFF Closed the event!", root, 255,255,255, true)
                    on = "nao"
                end
            end
        end
    else
        outputChatBox("#FFF000[sERVER]#FFFFFF You aren't an admin to destroy a event!",thePlayer,255,255,255,true)
    end
end
addCommandHandler("devent",destruir)
 
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 ( "ORGANIZADOR" or "MODERADOR" ) )) then  
        outputChatBox("#FFF000[sERVER]#FFFFFF  - Commands for Event ",thePlayer, 255, 255, 255, true)
        outputChatBox("#FFF000[sERVER]#FFFFFF  #FF0000/cevent#FFFFFF - To create a event [Administators]!",thePlayer, 255, 255, 255, true)
        outputChatBox("#FFF000[sERVER]#FFFFFF  #FF0000/devent #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 ( "ORGANIZADOR" or "MODERADOR" ) )) 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).." removed the weapons",events, 255, 255, 255, true)
end
end
end
end
addCommandHandler ("takeweapons",getWeapons)
function GiveHealthAndArmour ( thePlayer )
local accountname = getAccountName (getPlayerAccount(thePlayer))
if (isObjectInACLGroup ( "user."..accountname, aclGetGroup ( "ORGANIZADOR" or "MODERADOR" ) )) 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).." Given health & armour",events, 255, 255, 255, true)
end
end
end
end
addCommandHandler ("givehealth",GiveHealthAndArmour)
function Frooze ( thePlayer )
local accountname = getAccountName (getPlayerAccount(thePlayer))
if (isObjectInACLGroup ( "user."..accountname, aclGetGroup ( "ORGANIZADOR" or "MODERADOR" ) )) 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).." Frooze you",events, 255, 255, 255, true)
end
end
end
end
addCommandHandler ("frooze",Frooze)
function UnFrooze ( thePlayer )
local accountname = getAccountName (getPlayerAccount(thePlayer))
if (isObjectInACLGroup ( "user."..accountname, aclGetGroup ( "ORGANIZADOR" or "MODERADOR" ) )) 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).." UnFroozen you",events, 255, 255, 255, true)
end
end
end
end
addCommandHandler ("unfrooze",UnFrooze)
function Deagle ( thePlayer )
local accountname = getAccountName (getPlayerAccount(thePlayer))
if (isObjectInACLGroup ( "user."..accountname, aclGetGroup ( "ORGANIZADOR" or "MODERADOR" ) )) 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 ( "ORGANIZADOR" or "MODERADOR" ) )) 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 ( "ORGANIZADOR" or "MODERADOR" ) )) 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 ( "ORGANIZADOR" or "MODERADOR" ) )) 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 ( "ORGANIZADOR" or "MODERADOR" ) )) then  
for _, events in ipairs(getElementsByType("player")) do
local isPlayerInEvento = getElementData( events, "Evento" , nil )
if ( isPlayerInEvento) then
giveWeapon ( events, 38, 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 Mini Gun  !",events, 255, 255, 255, true)
end
end
end
end
addCommandHandler ("minigun",Minigun)
 
 
Link to comment

Should i do the same for my other script ?

help guys

I got a bug , no have idea how to fix it :/

local acls = { "ORGANIZADOR", "MODERADOR", "ADMINISTADOR" } 
  
  
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/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 Administator #FF0000"..getPlayerName(thePlayer).."#FFFFFF created a event, write #FF0000/irevento#FFFFFF to participate!",root,255,255,255,true) 
  
            if(inte)then 
                setElementInterior(coisa, inte) 
            end 
  
            if(dimen)then 
                setElementDimension(coisa, dimen) 
            end 
             
        end 
        end 
   end 
end 
  
  
    else 
    outputChatBox("#FFF000[sERVER]#FFFFFF You aren't a admin to create a event!",thePlayer,255,255,255,true) 
    end 
  end 
  end 
addCommandHandler("cevent", event) 
  
  
  
  
[lua][2014-06-12 05:46:25] SCRIPT ERROR: event\irevento.lua:37: '' expected near 'else' 
[2014-06-12 05:46:25] ERROR: Loading script failed: event\irevento.lua:37: '' expected near 'else' 
[2014-06-12 05:46:25] event restarted successfully 

Edited by Guest
Link to comment

try this

function todo() 
-- To do 
end 
  
local account = getPlayerAccount(thePlayer) 
if (not account or isGuestAccount(account)) then return end 
local accountName = getAccountName(account) 
if ( isObjectInACLGroup ( "user.".. accountName, aclGetGroup ( "ORGANIZADOR" ) ) ) then 
todo() 
elseif ( isObjectInACLGroup ( "user.".. accountName, aclGetGroup ( "MODERADOR" ) ) ) then 
todo() 
elseif ( isObjectInACLGroup ( "user.".. accountName, aclGetGroup ( "ADMINISTADOR" ) ) ) then 
todo() 
end 
  

Link to comment

Try This ,

local acls = { "ORGANIZADOR", "MODERADOR", "ADMINISTADOR" } 
  
  
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/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 Administator #FF0000"..getPlayerName(thePlayer).."#FFFFFF created a event, write #FF0000/irevento#FFFFFF to participate!",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 You aren't a admin to create a event!",thePlayer,255,255,255,true) 
    end 
  end 
  end 
addCommandHandler("cevent", event)local acls = { "ORGANIZADOR", "MODERADOR", "ADMINISTADOR" } 
  
  
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/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 Administator #FF0000"..getPlayerName(thePlayer).."#FFFFFF created a event, write #FF0000/irevento#FFFFFF to participate!",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 You aren't a admin to create a event!",thePlayer,255,255,255,true) 
    end 
addCommandHandler("cevent", event) 

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...