Jump to content

[HELP] VIP System


-Stalker

Recommended Posts

Hello Guys Please help me about my DayZ VIP panel that if you put /vip cmd then you will get stuff from it.
 

function giveAcl(thePlayer, cmd, target)
    if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(thePlayer)), aclGetGroup("Admin")) then
        local theTargetElement = getPlayerFromNamePart(target)
        if(getElementType(theTargetElement) == "player") then
            setElementData(theTargetElement, "IsPlayerVip", true)
            local acc = getPlayerAccount(theTargetElement)
            if acc then
                setAccountData(acc, "IsPlayerVip", true)
            end
        end
    end
end
addCommandHandler("setvip", giveAcl)

function giveVipItems(thePlayer)
    local acc = getPlayerAccount(thePlayer)
    if getAccountData(acc, "IsPlayerVip") then
        local VIP = getElementData(thePlayer, "vip.items") or 0
        if VIP == 0 then
            setElementData(thePlayer, "Map", 1)
            setElementData(thePlayer, "GPS", 1)
            setElementData(thePlayer, "Box of Matches", 1)
            setElementData(thePlayer, "Toolbox", 1)
            setElementData(thePlayer, "Watch", 1)
            setElementData(thePlayer, "Assault ammo", 300)
            setElementData(thePlayer, "M4", 1)
            setElementData(thePlayer, "Bandage", 3)
            setElementData(thePlayer, "Medic Kit", 3)
            setElementData(thePlayer, "Morphine", 3)
            setElementData(thePlayer, "Painkiller", 3)
            setElementData(thePlayer, "Sniper Rifle", 1)
            setElementData(thePlayer, "Sniper ammo", 30)
            setElementData(thePlayer, "Water Bottle", 5)
            setElementData(thePlayer, "Camouflage Clothing", 1)
            setElementData(thePlayer, "Pizza", 5)
            setElementData(thePlayer, "Infrared Goggles", 1)
            setElementData(thePlayer, "Night Vision Goggles", 1)
            setElementData(thePlayer, "MAX_Slots", 100)
            setElementData(thePlayer, "vipi", 1)
            outputChatBox("VIP: VIP Items loaded press 'J'!", thePlayer, 0, 255, 0, false)
        else
            outputChatBox("VIP: You can only use this command one time per spawn!", thePlayer, 255, 0, 0, false)
        end
    end
end
addCommandHandler("vip", giveVipItems)
--#@#
function rmvVipD()
    setElementData(source, "vip.items", 0)
end
addEventHandler("onPlayerWasted", getRootElement(), rmvVipD)
function loadVip()
    local VIP = getAccountData(getPlayerAccount(source), "vip.items")
    setElementData(source, "vip.items", VIP)
end
addEventHandler("onPlayerLogin", getRootElement(), loadVip)
function saveVip()
    local player = getPlayerAccount(source)
    setAccountData(player, "vip.items", getElementData(source, "vip.items"))
end
addEventHandler("onPlayerQuit", getRootElement(), saveVip)

Please tell me what is wrong with it.

Edited by -Stalker
Link to comment

Add end on last line so that script will be ended and enclosed in client and  it may works ,show me the errors you got by running this resource as I think you just need to add end below  61 and line 61 what you mean by quit? You mean when player quit is stats,weapons etc.. Would saved ? Show me errors and I will fix it !code have many errors ,show me client and server side luafiles too! You must add showgui not give GUI,I will fix this later now I am in CLG 

Edited by Khadeer143
Link to comment
14 hours ago, Khadeer143 said:

Add end on last line so that script will be ended and enclosed in client and  it may works ,show me the errors you got by running this resource as I think you just need to add end below  61 and line 61 what you mean by quit? You mean when player quit is stats,weapons etc.. Would saved ? Show me errors and I will fix it !code have many errors ,show me client and server side luafiles too! You must add showgui not give GUI,I will fix this later now I am in CLG 

Sir, i dont have the  client? what should be the  code for that?

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