Jump to content

Mann56

Members
  • Posts

    306
  • Joined

  • Last visited

Posts posted by Mann56

  1. There is a very negligible difference in the computation speed of both the loops.

     

    For example, if there were 100 elements in a table to be iterated, pairs was faster than ipairs by 3.41E-07 seconds that's 0.0000000341 seconds roughly. So, the speed doesn't really matter till you have many thousands of values. Also as @KariiiM said, it's good to use ipairs in the above example.

    • Like 1
  2. Hey guys,

    I am making a script which teleports a guy away from area 51 to random cords but when i used processLineOfSight to detect whether the land is aboveor below the player ( after the teleport , since i didnt change the z cord on teleport) but it just doesn't detect the hit. I want it to detect a world model but it doesn't detect leaving my player either below the world object or far above it after teleport. Can someone help me to detect world objects using processLineOfSight?

    function detectProperPos(thePlayer) 
        local x,y,z = getElementPosition(thePlayer) 
        local hit,hitX,hitY,hitZ = processLineOfSight(x,y,z,x,y,z + 300,true,true,true,true,true,false,false,false,thePlayer,true) 
        if hit then 
            setElementPosition(thePlayer,hitX,hitY,hitZ) 
            setElementFrozen(thePlayer,false) 
        else 
            local shit,hitX,hitY,hitZ = processLineOfSight(x,y,z,x,y,z - 300,true,true,true,true,true,false,false,false,thePlayer,true) 
            if shit then 
                setElementPosition(thePlayer,hitX,hitY,hitZ) 
                setElementFrozen(thePlayer,false) 
                outputChatBox(hit) 
            else  
                outputChatBox("Fail") 
            end 
        end 
    end 
    

    Thanks,

    Mann

  3. Why you're checking if the player is a localPlayer ? it's just a waste of time and waste of memory

    the function triggerClientEvent has an argument named sendTo.

    @Mann56, you left this argument empty which that means: root ( everyone )

    server side:

    function checkIfMember(thePlayer) 
        local inGroup = dbPoll ( dbQuery ( connection, "SELECT Name FROM Members WHERE Name = ?", getAccountName ( getPlayerAccount ( thePlayer ) ) ), -1 ) 
        if ( #inGroup > 0 ) then 
            if ( not state )  then 
                state = true 
                triggerClientEvent ( thePlayer, "showTheGui", thePlayer, thePlayer, state ) 
            else 
                state = false 
                triggerClientEvent ( thePlayer, "showTheGui", thePlayer, thePlayer, state ) 
            end 
        end 
    end 
      
    addEvent ( "memberCheck", true ) 
    addEventHandler ( "memberCheck", root, checkIfMember ) 
    

    Ah got it, thanks!!

  4. Hello guys,

    I was making a group system where i encountered this error. Whenever i open the gui, it shows for everybody even on my pressing the bound key... I am not able to figure out the reason of this thing.

    Here's da code

    SERVER

    function checkIfMember(thePlayer) 
        local inGroup = dbPoll(dbQuery(connection,"SELECT Name FROM Members WHERE Name = ?",getAccountName(getPlayerAccount(thePlayer))),-1) 
        if #inGroup > 0 then 
            if state == false then 
                state = true 
                triggerClientEvent("showTheGui",thePlayer,thePlayer,state) 
            else 
                state = false 
                triggerClientEvent("showTheGui",thePlayer,thePlayer,state) 
            end 
        end 
    end 
      
    addEvent("memberCheck",true) 
    addEventHandler("memberCheck",root,checkIfMember) 
      
    function bindPanelKey() 
        bindKey(source,panelOpenKey,"up",checkIfMember) 
    end 
      
    addEventHandler("onPlayerLogin",root,bindPanelKey) 
    

    CLIENT

      
      
    function triggerGui(player,state) 
            guiSetVisible(mainWindow,state) 
            showCursor(state) 
            state = false 
    end 
      
    addEvent("showTheGui",true) 
    addEventHandler("showTheGui",root,triggerGui) 
      
    

    Hope someone can help me in this...

    ( I hope this extract of the code is enough, if not please inform me, i'll give the gui part)

    Mann.

  5. sorry i didn't play DayZ gamemode, but i think the last 3 values are the coordination of the item X , Y , Z.
    {"item name","model id"," X ","Y","Z"}, 
    

    We have a value ->

    {"Wood Pile",1463,0.4,0,13}, 
    

    0.4 , 0 and 13 can't be co-ordinates since mostly the second last value is mostly zero.

  6. Hello guys,

    I am editing the DayZ gamemode, the old one by Marvin. There is an item table like -

    {"Wood Pile",1463,0.4,0,13}, 
    

    Here can i get the meaning of the third value?

    Wood Pile = object

    1463 = model id

    0.4 = ?

    0 = rotation? (Maybe)

    13 = Spawning probability.

    I'd like someone to give me the meaning of the third and fourth value, thanks!

  7. Thank you very, very much.... I'll look through all of the above mentioned, if i have any doubts I'd ask here :P

    Btw, the Doppler Effect in MTA in your signature is also very great...

    Thanks

  8. Hello guys,

    I was studying the shader examples, i understood the "simple" example, but i am finding it difficult to understand the second one, can someone help me, and i saw that there is a lot of difference in shaders used in shadertoy and mta, i can't get the hang of the proper syntax ad such....

  9. I tried many times but still is not working..... This time, i tried like suppose my car's mass is X kg, i typed X + 3 kg and it showed 60 , thats correct but just after it, i typed X + @ and it showed $120 instead of $ 40 ( dunno why but it does 20 + 60 + 40, using the outputChatBox, i have used, i could detect this)

    Any help?

  10. If you do not see that I already wrote that dayz not pay so you can be blind .. well the other things I have done so myself .. I do not know what you write for s.h.i.t. And prerment ban should get such people here who can create posts that they have as much.

    Looking the posts above, the others things are from Russian tutorials, who gave you the right to add them and make a resource and sell them?

  11. You could have it check if there was any previous money, and if so set that to 0

    I tried that but did not work.... I've already set mass_money to 0 in the function starting so it'd every time start with a zero value still it's not working.

×
×
  • Create New...