Jump to content

Radar Area trouble...


Recommended Posts

Posted

Hi all,

I didn't know whether to put this as Scripting or Server, but I think this is a server problem...

Anyways, I'm using radars.xml for my turf script/resource, and when I start it, I get errors like these: Image

Line number On/Off | Expand/Contract | Select all

2012-04-30 09:43:29] WARNING: [JWR]\turfs\server.lua:24: Bad argument @ 'createColPolygon'

I want to use createColRectangle, and it tells me to use createColPolygon, I don't know why...

Any reason why?

If you need anymore info, let me know.

My in-game name: Jaysds1

Retired CMG Scripter

World Of Tanks GameMode (Open-Source): https://github.com/Jaysds1/mtasa-wot-gamemode

Online GUI-Editor (WIP): https://forum.mtasa.com/topic/47678-online-gui-editor/

 

sE5Qm.png

TiV3C.png

img.php?id=0&text=Lua%20Scripter

Posted

I don't understand what do you mean, though, if you don't post part of your script we can't help you.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

oh, ok,

here:

addEventHandler("onResourceStart",resourceRoot,function() 
    local radarXML = xmlLoadFile("radars.xml") 
    if radarXML then 
        for index,child in pairs(xmlNodeGetChildren(radarXML))do 
            name = xmlNodeGetAttribute(child,"name") 
            px = xmlNodeGetAttribute(child,"posX") 
            py = xmlNodeGetAttribute(child,"posY") 
            sx = xmlNodeGetAttribute(child,"sizeX") 
            sy = xmlNodeGetAttribute(child,"sizeY") 
            clr = xmlNodeGetAttribute(child,"color") 
            dim = xmlNodeGetAttribute(child,"dimension") 
            team = xmlNodeGetAttribute(child,"team") 
            ra = createRadarArea(px,py,sx,sy,clr,100) 
            setElementData(ra,"team",team) 
            setElementData(ra,"turfName",name) 
             
            cX = xmlNodeGetAttribute(child,"colX") 
            cY = xmlNodeGetAttribute(child,"coY") 
            cW = xmlNodeGetAttribute(child,"colW") 
            cH = xmlNodeGetAttribute(child,"colH") 
            colR = createColRectangle(cX,cY,40,40) 
            col = createColPolygon(cX,cY,40,40) 
        end 
    end 
    addEventHandler("onColShapeHit",colR,turf) 
    xmlUnloadFile(radarXML) 
end) 

here's the radar.xml file

<radars> 
    <areas name="Grove Street" posX="-2183.5678710938" posY="705.67950439453" sizeX="40" sizeY="-40" color="#33CC00" dimension="0" col="Rec" colX="-2171.0678710938" colY="678.17950439453" colW="15" colH="15" team="Grove Street Famillies"/> 
</radars> 

Last log:

  
[2012-05-02 18:26:11] WARNING: [JWR]\turfs\server.lua:28: Bad argument @ 'createColPolygon' 
[2012-05-02 18:26:11] WARNING: [JWR]\turfs\server.lua:29: Bad argument @ 'createColRectangle' 
[2012-05-02 18:26:11] WARNING: [JWR]\turfs\server.lua:32: Bad argument @ 'addEventHandler' [Expected element at argument 2, got nil] 

My in-game name: Jaysds1

Retired CMG Scripter

World Of Tanks GameMode (Open-Source): https://github.com/Jaysds1/mtasa-wot-gamemode

Online GUI-Editor (WIP): https://forum.mtasa.com/topic/47678-online-gui-editor/

 

sE5Qm.png

TiV3C.png

img.php?id=0&text=Lua%20Scripter

Posted
addEventHandler ( "onResourceStart", resourceRoot, 
    function ( ) 
        local radarXML = xmlLoadFile ( "radars.xml" ) 
        if ( radarXML ) then 
            for index, child in ipairs ( xmlNodeGetChildren ( radarXML ) )do 
                name = xmlNodeGetAttribute ( child, "name" ) 
                px = xmlNodeGetAttribute ( child, "posX" ) 
                py = xmlNodeGetAttribute ( child, "posY" ) 
                sx = xmlNodeGetAttribute ( child, "sizeX" ) 
                sy = xmlNodeGetAttribute ( child, "sizeY" ) 
                clr = xmlNodeGetAttribute ( child, "color" ) 
                dim = xmlNodeGetAttribute ( child, "dimension" ) 
                team = xmlNodeGetAttribute ( child, "team" ) 
                ra = createRadarArea ( px, py, sx, sy, clr, 100 ) 
                setElementData ( ra, "team", team ) 
                setElementData ( ra, "turfName", name ) 
  
                cX = tonumber ( xmlNodeGetAttribute ( child, "colX" ) ) 
                cY = tonumber ( xmlNodeGetAttribute ( child, "colY" ) ) -- You had "coY" instead of "colY". 
                cW = tonumber ( xmlNodeGetAttribute ( child, "colW" ) ) 
                cH = tonumber ( xmlNodeGetAttribute ( child, "colH" ) ) 
                colR = createColRectangle ( cX, cY, 40, 40 ) 
                addEventHandler ( "onColShapeHit", colR, turf ) -- You added the event after ending the loop. 
            end 
        end 
  
        xmlUnloadFile ( radarXML ) 
    end 
) 

Read the comments.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

Thanks, I've been having problems with this for the paste couple of days

sorry, to bother you again, for some reason this event isn't cancelling:

addEventHandler("onVehicleStartExit",root,function(plr) 
    if(isVehicleLocked(source))then 
        cancelEvent() 
        outputChatBox("The vehicle is still locked, please unlock to get out.",plr,100,0,0) 
    end 
end) 

My in-game name: Jaysds1

Retired CMG Scripter

World Of Tanks GameMode (Open-Source): https://github.com/Jaysds1/mtasa-wot-gamemode

Online GUI-Editor (WIP): https://forum.mtasa.com/topic/47678-online-gui-editor/

 

sE5Qm.png

TiV3C.png

img.php?id=0&text=Lua%20Scripter

Posted

The script works fine here, I can't exit the vehicle if it's locked.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

ya, it's not working for me:

addEventHandler("onClientVehicleStartExit",root,function() 
    if(isVehicleLocked(source))then 
        cancelEvent() 
    end 
end) 

you can try it on my 1.4 server: mtasa://67.204.56.189:21892

My in-game name: Jaysds1

Retired CMG Scripter

World Of Tanks GameMode (Open-Source): https://github.com/Jaysds1/mtasa-wot-gamemode

Online GUI-Editor (WIP): https://forum.mtasa.com/topic/47678-online-gui-editor/

 

sE5Qm.png

TiV3C.png

img.php?id=0&text=Lua%20Scripter

Posted

That doesn't work here either, why don't you use the server side one instead?

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

Yes, my local server is running a 1.3 nightly build.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

You must make a table with the radar/colshapes, because you have a loop there, is replacing "ra" variable with new radar area created.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

DAMN DAMN DAMN DAMN,

sorry, I'm mad, I thought about this and I thought it would be a great idea, but now :?:

Anyways, is there anyway around this?

I know I can't insert the radar areas and the colshapes in a table through a loop.

My in-game name: Jaysds1

Retired CMG Scripter

World Of Tanks GameMode (Open-Source): https://github.com/Jaysds1/mtasa-wot-gamemode

Online GUI-Editor (WIP): https://forum.mtasa.com/topic/47678-online-gui-editor/

 

sE5Qm.png

TiV3C.png

img.php?id=0&text=Lua%20Scripter

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...