Jump to content

Snoozy

Members
  • Posts

    79
  • Joined

  • Last visited

Posts posted by Snoozy

  1. I'm wondering if I have a serverside table called for example Info[number]

    And I transfered it with getElementData and setElementData over to clientside and changed some of the info inside the table would it then only change on the clientside table or would it be changed also on the serverside table?

  2. So for some reason destroyElement() wont destroy the thing I asks it to.

    function MarkerHit ( hitPlayer, matchingDimension ) 
        if source == getElementData(hitPlayer,"Marker") then 
            outputChatBox("Hit the marker",hitPlayer) 
                                local Marker = getElementData(getLocalPlayer(),"Marker") 
            destroyElement(Marker) 
            local Blip = getElementData(getLocalPlayer(),"Blip") 
            destroyElement (Blip) 
        end 
    end 
    addEventHandler ( "onClientMarkerHit", getRootElement(), MarkerHit ) 
    

    Not either the Marker or the Blip gets destroyed.

    The data is set here:

    local Blip = createBlip(X,Y,Z,31,0, 0, 0, 255,source) 
                    local Marker = createMarker(X,Y,Z,"checkpoint",1.0,0,255,0,170,source) 
                    setElementData(source,"Marker",Marker) 
                    setElementData(source,"Blip",Blip) 
    

    They do appear ingame the created marker and blip

  3. Oh well I just found the problem when I was trying to explain when it happen :D Looking at the code I was about to put into this post I noticed the problem, it was that I created the infoRoot element twice, and it was after the MaxBusiness was defined so it got erased again lol

  4. Hey I've come across a problem with 'for' limit must be a number and have been unable to find a fix, anyhow heres the code and so on where it comes from

    infoRoot = getElementByID("infoRoot") 
    maxbi = getElementData(infoRoot,"MaxBusiness") 
    for idx=1,maxbi do -- 'for' limit must be a number appears here 
    triggerServerEvent ( "GetBizName", getLocalPlayer(),idx) 
    end 
    

    It have worked before which is why it just seems strange

    local infoRoot = createElement("infoRoot", "infoRoot") 
        setElementData(infoRoot, "MaxBusiness",maxbi) 
    

    This is where the data is set

  5. Well I've been trying but it doesn't seem to work the way I've been doing, the way I do is

    When a player joins it does:

    vehicle=getElementsByType("vehicle") 
        for k1,v in ipairs(vehicle) do 
            local Name = getElementData(source,"CharacterName") 
            setElementData(v,tostring(Name),0) 
        end 
    

    Got no problems here at all, used tostring to make sure that it turns out to be a string.

    Then in another lua file I do following, this is where the problem appears

        vehicle=getElementsByType("vehicle") 
        players=getElementsByType("player") 
        for k,v in ipairs(players) do 
            for k1,v1 in ipairs(vehicle) do 
                    local Name = getElementData(v,"CharacterName") 
                    if getElementData(v1,tostring(Name)) == 0 then 
                        outputChatBox("Test3",v) 
                        setElementData(v1,tostring(Name),1) 
                    end 
            end 
        end 
    

    But here it says that theres a bad argument at the getElementData, which I don't get since it works with the variable at start but in the getElement I get a error/warning

  6. getElementData(getLocalPlayer(),"CharacterCigarette") 
    

    Elements like that is currently when I try and use them with a if statement acting as a string even when the loading is clearly integers.

    I'm setting their values with values from mysql and the mysql columns is integers but when I'm ingame I get errors where it states that they are all of them strings? So I have to set tonumber() on like every single one.

  7. Okay now after some testing again and changing I came to a new error which is:

    [2011-05-27 10:45:58] WARNING: boulevard\business\server.lua:72: Bad argument @ 'getDistanceBetweenPoints3D'

    [2011-05-27 10:45:58] ERROR: boulevard\business\server.lua:72: attempt to compare boolean with number

      
    local b = tonumber(getElementData(source,"BizEntered")) 
                local int = tonumber(BizInfo[b].Interior) 
                local x,y,z = getElementPosition(source) 
                local pX = getElementData(IntInfo[int].Pickup,"PosX") 
                local pY = getElementData(IntInfo[int].Pickup,"PosY") 
                local pZ = getElementData(IntInfo[int].Pickup,"PosZ") 
                if getDistanceBetweenPoints3D(x,y,z,pX,pY,pZ) <= 3 then 
    

    That is the code used for line 72 which is the last shown the getDistanceBetween

  8. Yea I realized that it was tonumber that was required tho now I've come across a similar problem on like a few lines later.

    The whole thing I'm currently having trouble with in case you don't know yet is a enter and exit system, the enter system works now and you can enter.

    However now theres a problem in exiting.

    local int = BizInfo[getElementData(source,"BizEntered")].interior 
    if getDistanceBetweenPoints3D(x,y,z,IntInfo[int].X,IntInfo[int].Y,IntInfo[int].Z) <= 3 then 
    

    I've tried there with tonumber, tostring and toboolean but it wont work I just always get the:

    [2011-05-27 08:53:29] ERROR: boulevard\business\server.lua:67: attempt to index field '?' (a nil value)

×
×
  • Create New...