Jump to content

I need help with my first script


#Paker

Recommended Posts

Hello guys this is my first edited script :P i want you guys to fix it please and show me how did you do that i want to learn

this is the script 

Quote

    function aduty ( player )
    local accName = getAccountName(getPlayerAccount(player))
    if isObjectInACLGroup ( "user." ..accName, aclGetGroup ( "Admin") ) then
    outputChatBox(" Administrator "..getPlayerName(player).." Is Now OnDuty!",getRootElement(),255,0,0)
    outputChatBox("",getRootElement(),255,0,0)
    outputServerLog(" Administrator "..getPlayerName(player).." Is Now OnDuty")
    setElementData( player, "blood", 99999999999999999999999999 )
    heal = "9999999999999999999999999999999"
    end
    end
    addCommandHandler("duty",aduty)
     
    function offaduty ( player )
    local accName = getAccountName(getPlayerAccount(player))
    if isObjectInACLGroup ( "user." ..accName, aclGetGroup ( "Admin") ) then
    outputChatBox(" Administrator "..getPlayerName(player).." Is No Longer OnDuty",getRootElement(),255,0,0)
    outputChatBox("",getRootElement(),255,0,0)
    outputServerLog(" Administrator "..getPlayerName(player).." Is No Longer OnDuty")
    setElementData( player, "blood", 12000 )
    end
    end
    addCommandHandler("offaduty",offduty)
     
    function heal_func ( player )
    local accName = getAccountName(getPlayerAccount(player))
    if isObjectInACLGroup ( "user." ..accName, aclGetGroup ( "Admin") ) then
    if heal == "an" then
    setElementData( player, "food", 250 )
    setElementData( player, "thirst", 250 )
    end
    end
    end
    setTimer(heal_func, 60000, 0)

    function Skin ( player )
    setSkinData( player, 217)
    end
    end
    addCommandHandler("duty",skin)

 

Thank you guys please answer me faster

 

 

NOTE : Green is the real script // Red i edited it

Link to comment


    function aduty ( player )
    local accName = getAccountName(getPlayerAccount(player))
    if isObjectInACLGroup ( "user." ..accName, aclGetGroup ( "Admin") ) then
    outputChatBox(" Administrator "..getPlayerName(player).." Is Now OnDuty!",getRootElement(),255,0,0)
    setSkinData( player, 217)
    outputChatBox("",getRootElement(),255,0,0)
    outputServerLog(" Administrator "..getPlayerName(player).." Is Now OnDuty")
    setElementData( player, "blood", 99999999999999999999999999 )
    heal = "9999999999999999999999999999999"
    end
    end
    addCommandHandler("duty",aduty)
     
    function offaduty ( player )
    local accName = getAccountName(getPlayerAccount(player))
    if isObjectInACLGroup ( "user." ..accName, aclGetGroup ( "Admin") ) then
    outputChatBox(" Administrator "..getPlayerName(player).." Is No Longer OnDuty",getRootElement(),255,0,0)
    outputChatBox("",getRootElement(),255,0,0)
    outputServerLog(" Administrator "..getPlayerName(player).." Is No Longer OnDuty")
    setElementData( player, "blood", 12000 )
    end
    end
    addCommandHandler("offaduty",offduty)
     
    function heal_func ( player )
    local accName = getAccountName(getPlayerAccount(player))
    if isObjectInACLGroup ( "user." ..accName, aclGetGroup ( "Admin") ) then
    if heal == "an" then
    setElementData( player, "food", 250 )
    setElementData( player, "thirst", 250 )
    end
    end
    end
    setTimer(heal_func, 60000, 0)

 

-- Combined the two functions. Not sure exactly what skin data is, but I'm asuming it's for dayZ.

Link to comment
7 hours ago, CodyJ(L) said:

    function aduty ( player )
    local accName = getAccountName(getPlayerAccount(player))
    if isObjectInACLGroup ( "user." ..accName, aclGetGroup ( "Admin") ) then
    outputChatBox(" Administrator "..getPlayerName(player).." Is Now OnDuty!",getRootElement(),255,0,0)
    setSkinData( player, 217)
    outputChatBox("",getRootElement(),255,0,0)
    outputServerLog(" Administrator "..getPlayerName(player).." Is Now OnDuty")
    setElementData( player, "blood", 99999999999999999999999999 )
    heal = "9999999999999999999999999999999"
    end
    end
    addCommandHandler("duty",aduty)
     
    function offaduty ( player )
    local accName = getAccountName(getPlayerAccount(player))
    if isObjectInACLGroup ( "user." ..accName, aclGetGroup ( "Admin") ) then
    outputChatBox(" Administrator "..getPlayerName(player).." Is No Longer OnDuty",getRootElement(),255,0,0)
    outputChatBox("",getRootElement(),255,0,0)
    outputServerLog(" Administrator "..getPlayerName(player).." Is No Longer OnDuty")
    setElementData( player, "blood", 12000 )
    end
    end
    addCommandHandler("offaduty",offduty)
     
    function heal_func ( player )
    local accName = getAccountName(getPlayerAccount(player))
    if isObjectInACLGroup ( "user." ..accName, aclGetGroup ( "Admin") ) then
    if heal == "an" then
    setElementData( player, "food", 250 )
    setElementData( player, "thirst", 250 )
    end
    end
    end
    setTimer(heal_func, 60000, 0)

 

-- Combined the two functions. Not sure exactly what skin data is, but I'm asuming it's for dayZ.

so it can't be added?

Link to comment
5 hours ago, #Paker said:

so it can't be added?

Not sure where u base that on, but here's my version. I made it so it saves ur current skin when you /duty, and when you /offaduty you get your old skin back. It works for me, I hope it works for u too :)

function aduty ( player )
local accName = getAccountName(getPlayerAccount(player))
	if isObjectInACLGroup ( "user." ..accName, aclGetGroup ( "Admin") ) then
   		local saveskin = getPlayerSkin ( player )
     		setElementData(player, "saveskin", saveskin)
     		outputChatBox(" Administrator "..getPlayerName(player).." Is Now OnDuty!",getRootElement(),255,0,0)
		outputChatBox("",getRootElement(),255,0,0)
     		outputServerLog(" Administrator "..getPlayerName(player).." Is Now OnDuty")
     		setElementData( player, "blood", 99999999999999999999999999 )
        	heal = "9999999999999999999999999999999"
        	setPlayerSkin(player, 217)
    end
end
addCommandHandler("duty",aduty)
     
function offaduty ( player )
local accName = getAccountName(getPlayerAccount(player))
	if isObjectInACLGroup ( "user." ..accName, aclGetGroup ( "Admin") ) then
    	outputChatBox(" Administrator "..getPlayerName(player).." Is No Longer OnDuty",getRootElement(),255,0,0)
        outputChatBox("",getRootElement(),255,0,0)
        outputServerLog(" Administrator "..getPlayerName(player).." Is No Longer OnDuty")
        setElementData( player, "blood", 12000 )
        if getElementData(player, "saveskin", saveskin) then
	    local skin = getElementData(player, "saveskin", saveskin)
            setPlayerSkin(player, skin)
            setElementData(player, "saveskin", false)
        end
    end
end
addCommandHandler("offaduty",offaduty)
     
function heal_func ( player )
local accName = getAccountName(getPlayerAccount(player))
	if isObjectInACLGroup ( "user." ..accName, aclGetGroup ( "Admin") ) then
    		if heal == "an" then
            		setElementData( player, "food", 250 )
            		setElementData( player, "thirst", 250 )
        	end
    	end
end
setTimer(heal_func, 60000, 0)

 

 

Edited by marty000123
Link to comment
1 hour ago, marty000123 said:

Not sure where u base that on, but here's my version. I made it so it saves ur current skin when you /duty, and when you /offaduty you get your old skin back. It works for me, I hope it works for u too :)

function aduty ( player )
local accName = getAccountName(getPlayerAccount(player))
	if isObjectInACLGroup ( "user." ..accName, aclGetGroup ( "Admin") ) then
   		local saveskin = getPlayerSkin ( player )
     		setElementData(player, "saveskin", saveskin)
     		outputChatBox(" Administrator "..getPlayerName(player).." Is Now OnDuty!",getRootElement(),255,0,0)
		outputChatBox("",getRootElement(),255,0,0)
     		outputServerLog(" Administrator "..getPlayerName(player).." Is Now OnDuty")
     		setElementData( player, "blood", 99999999999999999999999999 )
        	heal = "9999999999999999999999999999999"
        	setPlayerSkin(player, 217)
    end
end
addCommandHandler("duty",aduty)
     
function offaduty ( player )
local accName = getAccountName(getPlayerAccount(player))
	if isObjectInACLGroup ( "user." ..accName, aclGetGroup ( "Admin") ) then
    	outputChatBox(" Administrator "..getPlayerName(player).." Is No Longer OnDuty",getRootElement(),255,0,0)
        outputChatBox("",getRootElement(),255,0,0)
        outputServerLog(" Administrator "..getPlayerName(player).." Is No Longer OnDuty")
        setElementData( player, "blood", 12000 )
        if getElementData(player, "saveskin", saveskin) then
	    local skin = getElementData(player, "saveskin", saveskin)
            setPlayerSkin(player, skin)
            setElementData(player, "saveskin", false)
        end
    end
end
addCommandHandler("offaduty",offaduty)
     
function heal_func ( player )
local accName = getAccountName(getPlayerAccount(player))
	if isObjectInACLGroup ( "user." ..accName, aclGetGroup ( "Admin") ) then
    		if heal == "an" then
            		setElementData( player, "food", 250 )
            		setElementData( player, "thirst", 250 )
        	end
    	end
end
setTimer(heal_func, 60000, 0)

 

 

thank you very much but can you help in 1more think please

 

when i do /duty it must no one can heat me . fix it for e please and ty again

 

Link to comment
5 minutes ago, #Paker said:

thank you very much but can you help in 1more think please

 

when i do /duty it must no one can heat me . fix it for e please and ty again

 

Let me check.

Edit: I'm not sure what you mean. I see this is a DayZ (looking at the ''blood) script, and I'm not so familiar with that. I may be able to fix it but you'll have to tell me what you exactly want. (Because the blood is already on 9999999999999999 so I don't see an issue...)

Edited by marty000123
Link to comment
23 minutes ago, marty000123 said:

Let me check.

Edit: I'm not sure what you mean. I see this is a DayZ (looking at the ''blood) script, and I'm not so familiar with that. I may be able to fix it but you'll have to tell me what you exactly want. (Because the blood is already on 9999999999999999 so I don't see an issue...)

ok can you script only one think ok this is it i want GUI when you click the botton you teleport to an island and when you click the another bottan you back to ur old place is that possible ? and it's binded as "Q" to open the gui please see what to do and im very thanking you for ur help

Link to comment
1 minute ago, #Paker said:

ok can you script only one think ok this is it i want GUI when you click the botton you teleport to an island and when you click the another bottan you back to ur old place is that possible ? and it's binded as "Q" to open the gui please see what to do and im very thanking you for ur help

I can do that but I think that's quite time consuming... Earliest would be tomorrow or the day after considering that you're probably not paying for it.

Link to comment
54 minutes ago, marty000123 said:

I can do that but I think that's quite time consuming... Earliest would be tomorrow or the day after considering that you're probably not paying for it.

bro i need you at the moment if you are free can you add it 

i want when i do /duty i be moved to staff team

and /offaduty i back to my old one and ty

Link to comment

This is a forum for help with scripting, what you're doing is asking us to make it all for you without doing anything yourself.

You won't learn anything if you rely on others making it for you. You can't expect to have everything served on a silver platter.

What you're asking for is simple stuff, look up some tutorials and use the MTA Wiki as marty also suggested.

There you can find Team related functions.

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