1LoL1 Posted July 12, 2015 Share Posted July 12, 2015 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
iMr.Dawix~# Posted July 12, 2015 Share Posted July 12, 2015 "onPlayerLogin" "onPlayerWasted" Link to comment
1LoL1 Posted July 12, 2015 Author Share Posted July 12, 2015 "onPlayerLogin" "onPlayerWasted" //EDIT: Sorry i am idiot.. i fixed. Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now