Jump to content

Protagonist95

Members
  • Posts

    53
  • Joined

  • Last visited

Everything posted by Protagonist95

  1. Hello guys,stuck on a problem.Heres code i wrote: items = { {1337,1356.69360,1546.84326,10.82031}, {1337,1356.59802,1536.86560,10.8203}, {1337,1368.62585,1547.30847,10.82031} } function spawnLoot() local object ,x, y, z = unpack ( items [ math.random ( #items ) ] ) createObject ( object,x,y,z,0,0,0) end addEventHandler ( "onResourceStart", getRootElement(), spawnLoot) problem is that script spawns only one object.What i want to do,is spawn multiple of them(for example spawn object at first and third point) Thank you)
  2. Hello ppl.Currently working on saving element datas,after player loggs in and out. Heres script i made,but apparently it doesn't want to work. function setDataOnQuit() local playeraccount = getPlayerAccount ( source ) if ( playeraccount ) and not isGuestAccount ( playeraccount ) then local health = getElementData(source,"health") setAccountData(playeraccount,"player.health",health) end end addEventHandler ( "onPlayerQuit", getRootElement ( ), setDataOnQuit ) function setDataOnJoin() local playeraccount = getPlayerAccount ( source ) if ( playeraccount ) and not isGuestAccount ( playeraccount ) then local health = getAccountData ( playeraccount, "player.health") if (health) then setElementData(playeraccount,"health",health) end end end addEventHandler ( "onPlayerLogin", getRootElement ( ), setDataOnJoin ) function statsOnSpawn() local player = source if player then setElementData(player,"health",100) setElementData(player,"stamina",100) setElementData(player,"food",100) setElementData(player,"thirst",100) end end addEventHandler ( "onPlayerSpawn", getRootElement(), statsOnSpawn )
×
×
  • Create New...