Jump to content

[HELP] Please with script


1LoL1

Recommended Posts

Hello, can you help me anyone?

I want when i dead, login, register give this items.

--Player Items on Start 
    for i,data in ipairs(playerDataTable) do 
        if data[1] =="Bandage" then 
            setElementData(player,data[1],1) 
        elseif data[1] =="Painkiller" then 
            setElementData(player,data[1],1) 
        elseif data[1] =="Morphine" then 
            setElementData(player,data[1],1) 
        elseif data[1] =="MAX_Slots" then 
            setElementData(player,data[1],10) 
        elseif data[1] =="skin" then 
            setElementData(player,data[1],73) 
        elseif data[1] =="blood" then 
            setElementData(player,data[1],12000) 
        elseif data[1] =="temperature" then 
            setElementData(player,data[1],37) 
        elseif data[1] =="brokenbone" then 
            setElementData(player,data[1],false)     
        elseif data[1] =="pain" then 
            setElementData(player,data[1],false) 
        elseif data[1] =="cold" then 
            setElementData(player,data[1],false) 
        elseif data[1] =="infection" then 
            setElementData(player,data[1],false) 
        elseif data[1] =="food" then 
            setElementData(player,data[1],100) 
        elseif data[1] =="thirst" then 
            setElementData(player,data[1],100) 
        elseif data[1] =="currentweapon_1" then 
            setElementData(player,data[1],false) 
        elseif data[1] =="currentweapon_2" then 
            setElementData(player,data[1],false)     
        elseif data[1] =="currentweapon_3" then 
            setElementData(player,data[1],false)     
        elseif data[1] =="bandit" then 
            setElementData(player,data[1],false)     
        elseif data[1] =="humanity" then 
            setElementData(player,data[1],2500)      
        else 
            setElementData(player,data[1],0) 
        end  
    end 
        account = getAccount(username) 
        local value = getAccounts() 
        local value = #value 
        setElementData(player,"playerID",value+1) 
        setAccountData(account,"playerID",value+1) 
        setElementData(player,"logedin",true) 
        createZombieTable (player) 
end 
addEvent("onPlayerDayZRegister", true) 
addEventHandler("onPlayerDayZRegister", getRootElement(), playerRegister) 
  
  
function saveAccounts () -- Save in the database 
    local account = getPlayerAccount(source) 
    if account then 
    for i,data in ipairs(playerDataTable) do 
        setAccountData(account,data[1],getElementData(source,data[1])) 
    end 
        local x,y,z =  getElementPosition(source) 
        setAccountData(account,"last_x",x) 
        setAccountData(account,"last_y",y) 
        setAccountData(account,"last_z",z) 
        destroyElement(getElementData(source,"playerCol")) 
    end  
    setElementData(source,"logedin",false) 
end 
addEventHandler ( "onPlayerQuit", getRootElement(), saveAccounts ) 
  
function saveAccounts2 () -- Save in the database 
for i, player in ipairs(getElementsByType("player")) do 
    local account = getPlayerAccount(player) 
    if account then 
    for i,data in ipairs(playerDataTable) do 
        setAccountData(account,data[1],getElementData(player,data[1])) 
    end 
        local x,y,z =  getElementPosition(player) 
        setAccountData(account,"last_x",x) 
        setAccountData(account,"last_y",y) 
        setAccountData(account,"last_z",z) 
    end  
    --setElementData(player,"logedin",false) 
end  
end 
addEventHandler ( "onResourceStop", getRootElement(), saveAccounts2 ) 

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