Jump to content

Protagonist95

Members
  • Posts

    53
  • Joined

  • Last visited

Everything posted by Protagonist95

  1. No working,btw I tried to inset the "setObjectParameters" into "spawnloot"
  2. objects = { {1337,23.15625,-5.677734375,3}, {1338,19.15625,-5.677734375,3}, {1339,15.15625,-5.677734375,3} }
  3. Heres code to spawn objects and add indidivual ElementData by theyr model Parameters = { {1337,"data","data"}, -- works {1338,"data1","data1"}, -- works {1339,"data2",100} -- doesn't work,duno why } function spawnLoot() for i,k in ipairs(objects) do obj = createObject(k[1],k[2],k[3],k[4]) col = createColCuboid(k[2],k[3],k[4],1.6,1.6,1.6) if(obj) then -- if it exists then setElementData(col,"col",true) setElementData(obj,"loot",true) attachElements(col,obj,-0.7,-0.7,-0.5) setElementCollisionsEnabled(obj,false) end end end addEventHandler ( "onResourceStart", getResourceRootElement(), spawnLoot) function setObjectParameters() local objects = getElementsByType ( "object" ) for i,loot in ipairs(objects) do if getElementData(loot,"loot") == true then for index,key in ipairs(Parameters) do if getElementModel(loot) == key[1] then setElementData(loot,key[2],key[3]) outputChatBox("ID added") end end end end end addEventHandler ( "onResourceStart", getRootElement(), setObjectParameters) The problem is that it sets data only if second and third parameters are equil in Parameters table.I can't figure out why...
  4. Ok,so what i didn't know that players are allways in world collision(lets call it that way),so i added ElementData to mine ones,works great now.
  5. So heres a bit of code that i wrote: function onColEnter ( thePlayer ) local item = getElementsWithinColShape ( source, "object" ) if getElementsWithinColShape ( source, "player" ) then for index,key in ipairs(item) do outputChatBox ( tostring(getElementModel(key)) ) end setElementData(thePlayer,"inLoot",true) outputChatBox ( tostring(getElementData(thePlayer,"inLoot")) ) end end addEventHandler ("onColShapeHit", getRootElement(), onColEnter) The problem is that when I start resource it spamms through whole objects outputing results that must be only when i hit colshape. Picture
  6. No,as I already said, I solved it.Works fine.Also planing on small algorithm for password.If you are interested i can share it.
  7. Yeah,but at the same time how often do you reinstall your OS.Also if u're managing to create like DayZ server(for example,but im not sure) you're not really dependent of your account.
  8. No,i actually meant serial ID.I mentioned to do login system,that generates unique login and password,so you are able to create account once.
  9. Unfortunately the "else" method doesn't work,so i solved it with recursion function onGuestAccount() local serial = getPlayerSerial(source) local account = getAccount(tostring(getPlayerSerial(source))) if (account ~= false) then logIn(source,account,"****") outputChatBox("Welcome back!") else addAccount(serial,"****") -- checked onGuestAccount() end end addEventHandler ( "onPlayerJoin", getRootElement(), onGuestAccount )
  10. Cant trigger login function after creating account function onGuestAccount() local serial = getPlayerSerial(source) local account = getAccount(tostring(getPlayerSerial(source))) if (account ~= false) then logIn(source,account,"****") outputChatBox("Welcome back!") else addAccount(serial,"****") logIn(source,account,"****") end end addEventHandler ( "onPlayerJoin", getRootElement(), onGuestAccount ) logIn(source,account,"****") ---> boolean error
  11. Give some examples of inserting elementData by knowing player name(inserted by runcode)
  12. Is it possible to execute whole function with variables,loops etc in "execute command"(default admin panel),or is it only one command at a time? If it is,it would be great to have some examples.
  13. Hello guys,so heres script i got,but apparently i cant shoot wheels,bacause cancelEvent.Can some one help me out? addEventHandler("onClientVehicleDamage",getRootElement(),function(attacker,weapon,loss,x,y,z,tyre) cancelEvent() local parent = getElementData(source,"parent") if getElementData(parent,"vehicle_armor") > 0 then if getElementData(parent,"vehicle_armor")-loss < 1 then local hp = math.floor(getElementData(parent,"vehicle_armor") - loss) if hp < 0 then hp = hp * -1 end setElementHealth(source,getElementHealth(source) - hp) setElementData(parent,"vehicle_armor",0) return true end setElementData(parent,"vehicle_armor",getElementData(parent,"vehicle_armor")-loss) return true end for _, data in ipairs (details) do if parent and isElement(parent) then local detail = getElementData(parent,data[1]) or 0 if detail > 0 then local detail_dam = getElementData (parent,data[1].."dam") or 0 if detail_dam >= 6 then local random = math.random(1,#details) local detale = getElementData(parent,details[random][1]) or 0 if detale > 0 then setElementData(parent,details[random][1],detale - 1) setElementData(parent,details[random][1].."dam",0) checkVehicleMovable(source) break end else setElementData(parent, data[1].."dam", detail_dam+1) break end end end end setElementHealth (source,getElementHealth(source) - loss) end)
  14. Hello,can some one give me example of gui poppoing up when player enters colsphere? Thank you.
  15. So heres script that i made,cant get what seems to be the problem local objectSpawn = { {1343.36511,1541.53662,10.82031}, {1344.08984,1531.10254,10.82031}, {1350.97217,1535.13367,10.82031} } function SpawnPicks ( ) for i,v in ipairs(objectSpawn) do local x,y,z = objectSpawn[1],objectSpawn[2],objectSpawn[3] createObject(1337,x,y,z,nil,nil,nil) end end addEventHandler ( "onResourceStart", resourceRoot, SpawnPicks )
  16. Your code doesn't work properly,it spawns object in one place.
  17. local objectID, x, y, z = unpack(items[randomItemIndex])---------table expected got nil
  18. The perfect option would be random,because otherwise players will completeley know,where loot is.
  19. It's supposed to be loot for players(1337 and etc is just testing object,after im done with this the model will be changed),so player has to pick it up some how.
×
×
  • Create New...