Jump to content

Some Questions


Mefisto_PL

Recommended Posts

1) Can anybody write code to replace paintjobs?

2) I want to make a script to refill health with command and setTimer...

local dataname = "health.cooldown" 
local commandname = "ulecz" 
local note_restored = "Health refull." 
  
function giveFullHealth(player, cmd) 
    local timer = getElementData(player)   
    if not timer then 
        outputChatBox(note_restored, player, 0, 255, 0, false) 
        setElementData(player, true) 
        setTimer(setElementHealth(player, 100), 1000, 1 ) 
    end 
end 
addCommandHandler(commandname, giveFullHealth) 

3) I want to make script to set Nametag Colors for acl rights.

function nametagColorChange ( thePlayer ) 
    if isObjectInACLGroup ( "user." .. accountname, aclGetGroup ( "HeadAdmin" ) ) then 
    setPlayerNametagColor ( thePlayer, 250, 0, 0 ) 
    end 
end 
addEventHandler ( "onPlayerJoin", getRootElement(), nametagColorChange ) 

Link to comment

1) Nobody is going to give you a code for that, unless it's in the community.

2) Why did you delete stuff from my script? They're needed to make the script work.

local cooldown = 300 
local dataname = "health.cooldown" 
local commandname = "ulecz" 
local note_restored = "Health restored successfully." 
local note_info = "You need to wait 5 minutes before you can do this again." 
local note_active = "Cooldown is still active, please wait." 
  
function giveFullHealth(player, cmd) 
    local timer = getElementData(player, dataname) 
    
    if not timer then 
        outputChatBox(note_restored, player, 0, 255, 0, false) 
        outputChatBox(note_info, player, 220, 220, 0, false) 
        setElementData(player, dataname, true) 
        setElementHealth(player, 100) 
        setTimer(removeElementData, cooldown * 1000, 1, player, dataname) 
    else 
        outputChatBox(note_active, player, 255, 0, 0, false) 
    end 
end 
addCommandHandler(commandname, giveFullHealth) 

3) thePlayer is not a source element for onPlayerJoin event.

function nametagColorChange() 
    local account = getAccountName(getPlayerAccount(source)) 
    if isObjectInACLGroup("user." .. account, aclGetGroup("HeadAdmin")) then 
         setPlayerNametagColor(source, 250, 0, 0) 
    end 
end 
addEventHandler("onPlayerLogin", getRootElement(), nametagColorChange) 

Link to comment

Like Xeno said...

local cooldown = 300 
local dataname = "health.cooldown" 
local commandname = "ulecz" 
local note_restored = "Health restored successfully." 
local note_info = "You need to wait 5 minutes before you can do this again." 
local note_active = "Cooldown is still active, please wait." 
  
function giveFullHealth(player, cmd) 
    local timer = getElementData(player, dataname) 
    
    if not timer then 
        outputChatBox(note_restored, player, 0, 255, 0, false) 
        outputChatBox(note_info, player, 220, 220, 0, false) 
        setElementData(player, dataname, true) 
        setTimer(setElementHealth, 10000, 1, player, 100) 
        setTimer(removeElementData, cooldown * 1000, 1, player, dataname) 
    else 
        outputChatBox(note_active, player, 255, 0, 0, false) 
    end 
end 
addCommandHandler(commandname, giveFullHealth) 

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