Jaysds1 Posted May 3, 2012 Share Posted May 3, 2012 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. Link to comment
Castillo Posted May 3, 2012 Share Posted May 3, 2012 I don't understand what do you mean, though, if you don't post part of your script we can't help you. Link to comment
Jaysds1 Posted May 3, 2012 Author Share Posted May 3, 2012 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] Link to comment
Castillo Posted May 3, 2012 Share Posted May 3, 2012 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. Link to comment
Jaysds1 Posted May 3, 2012 Author Share Posted May 3, 2012 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) Link to comment
Castillo Posted May 3, 2012 Share Posted May 3, 2012 The script works fine here, I can't exit the vehicle if it's locked. Link to comment
Jaysds1 Posted May 3, 2012 Author Share Posted May 3, 2012 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 Link to comment
Castillo Posted May 3, 2012 Share Posted May 3, 2012 That doesn't work here either, why don't you use the server side one instead? Link to comment
Jaysds1 Posted May 3, 2012 Author Share Posted May 3, 2012 (edited) I'm still having the same problem... Anyways, forget that for now... Is it possible to get that ra to work in another function? Edited May 3, 2012 by Guest Link to comment
Castillo Posted May 3, 2012 Share Posted May 3, 2012 Yes, my local server is running a 1.3 nightly build. Link to comment
Jaysds1 Posted May 3, 2012 Author Share Posted May 3, 2012 Yes, my local server is running a 1.3 nightly build. oh, ok, lets forget about that right now, Is it possible to set ra for the radar global in-script? Link to comment
Castillo Posted May 3, 2012 Share Posted May 3, 2012 You must make a table with the radar/colshapes, because you have a loop there, is replacing "ra" variable with new radar area created. Link to comment
Jaysds1 Posted May 3, 2012 Author Share Posted May 3, 2012 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. Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now