Need script help

  • bugzeeolboy
    1st Nov 2012 Member 0 Permalink
    How do I make a new element that won't overwrite a preexisting element, and make my new element liquid?

    I read the wiki and it did not make sense to me.
    Here is my code, tell me what to fix in it.

    local myNewElement = elements.allocate("samp", "trev")
    elements.property(elements.SAMP_PT_TREV, "State", "ST_LIQUID")
    elements.property(elements.SAMP_PT_TREV, "Name", "TREV")
    elements.property(elements.SAMP_PT_TREV, "Description", "Something?")
  • mniip
    1st Nov 2012 Developer 0 Permalink
    @bugzeeolboy (View Post)
    you should define a menu section for it to appear on menu
  • bugzeeolboy
    1st Nov 2012 Member 0 Permalink

    @mniip (View Post)

    I currently know how to get to it without menu, I do not want it to show yet. But how do I make it set to liquid state automatically? I tried property state to ST_LIQUID

  • mniip
    1st Nov 2012 Developer 0 Permalink
    Try
    elements.property(elements.SAMP_PT_TREV, "Type", "TYPE_LIQUID")
  • jacob1
    1st Nov 2012 Developer 0 Permalink
    States in tpt are complicated now, it uses 3 different variables for state for whatever reason. It should be made to only use 1 or 2 in the future probably. There is a function to copy all the properties from another element into your own. Try
    elements.element(elements.SAMP_PT_TREV, elements.element(elements.DEFAULT_PT_WATR))
    (or another liquid, put it's name instead of WATR)