tinnetju Posted December 18, 2010 Share Posted December 18, 2010 (edited) Heey, i got some probs with my RC Car script. I think im done with my script, except setPedControlState, it keeps saying bad argumant in mta sa. I debugged it with the 50p script editor thing and he doesnt say anything. In my script i got a couple of setPedControlState's and he says they are all bad argument... Here are my scripts: Meta.xml: "Tinne_Spoel" version="1.0" type="script" description="A RC race track with rc cars" /> script_s.lua: rccar1=createVehicle(441, -2932.93, 485.22, 4.91, 0, 0, 180) rccar2=createVehicle(441, -2934.93, 485.22, 4.91, 0, 0, 180) rccar3=createVehicle(441, -2936.93, 485.22, 4.91, 0, 0, 180) rccar4=createVehicle(441, -2938.93, 485.22, 4.91, 0, 0, 180) rccarman1=createPed(180, 3500, 485.22, 4.91) rccarman2=createPed(180, 3500, 485.22, 4.91) rccarman3=createPed(180, 3500, 485.22, 4.91) rccarman4=createPed(180, 3500, 485.22, 4.91) setElementID(rccarman1,"rccarman1") setElementID(rccarman2,"rccarman2") setElementID(rccarman3,"rccarman3") setElementID(rccarman4,"rccarman4") warpPedIntoVehicle(rccarman1,rccar1) warpPedIntoVehicle(rccarman2,rccar2) warpPedIntoVehicle(rccarman3,rccar3) warpPedIntoVehicle(rccarman4,rccar4) setVehicleDamageProof(rccar1,true) setVehicleDamageProof(rccar2,true) setVehicleDamageProof(rccar3,true) setVehicleDamageProof(rccar4,true) function replaceModel() txd = engineLoadTXD("rcbandit.txd", 441 ) engineImportTXD(txd, 441) dff = engineLoadDFF("rcbandit.dff", 441 ) engineReplaceModel(dff, 441) end addEventHandler ( "onClientResourceStart", getResourceRootElement(getThisResource()), replaceModel) script_c.lua rccarman1=getElementByID("rccarman1") rccarman2=getElementByID("rccarman2") rccarman3=getElementByID("rccarman3") rccarman4=getElementByID("rccarman4") rccarman1controls={accelerate="w",brake_reverse="s",vehicle_left="a",vehicle_right="d",handbrake="space"} rccarman2controls={accelerate="w",brake_reverse="s",vehicle_left="a",vehicle_right="d",handbrake="space"} rccarman3controls={accelerate="w",brake_reverse="s",vehicle_left="a",vehicle_right="d",handbrake="space"} rccarman4controls={accelerate="w",brake_reverse="s",vehicle_left="a",vehicle_right="d",handbrake="space"} function ctrlrccarman1() for ctrl,key in pairs(rccarman1controls) do setPedControlState(rccarman1,ctrl,getKeyState(key)) end end function ctrlrccarman2() for ctrl,key in pairs(rccarman2controls) do setPedControlState(rccarman2,ctrl,getKeyState(key)) end end function ctrlrccarman3() for ctrl,key in pairs(rccarman3controls) do setPedControlState(rccarman3,ctrl,getKeyState(key)) end end function ctrlrccarman4() for ctrl,key in pairs(rccarman4controls) do setPedControlState(rccarman4,ctrl,getKeyState(key)) end end addEventHandler("onClientPreRender",getRootElement(),ctrlrccarman1) addEventHandler("onClientPreRender",getRootElement(),ctrlrccarman2) addEventHandler("onClientPreRender",getRootElement(),ctrlrccarman3) addEventHandler("onClientPreRender",getRootElement(),ctrlrccarman4) I hope you guys can help me! And sorry for my bad english, im just a dutch person. Edited December 18, 2010 by Guest Link to comment
x86 Posted December 18, 2010 Share Posted December 18, 2010 function replaceModel() txd = engineLoadTXD("rcbandit.txd", 441 ) engineImportTXD(txd, 441) dff = engineLoadDFF("rcbandit.dff", 441 ) engineReplaceModel(dff, 441) end addEventHandler ( "onClientResourceStart", getResourceRootElement(getThisResource()), replaceModel) That's a clientside script, you put it in a serverside file. Link to comment
tinnetju Posted December 18, 2010 Author Share Posted December 18, 2010 (edited) Ok, my mistake but he keeps saying the setPedControlState has a bad argument Edited December 28, 2010 by Guest Link to comment
tinnetju Posted December 28, 2010 Author Share Posted December 28, 2010 Please man help me, more replys please! Link to comment
Castillo Posted December 28, 2010 Share Posted December 28, 2010 don't try to force someone to reply because that will result on none reply, be patient. Link to comment
dzek (varez) Posted December 28, 2010 Share Posted December 28, 2010 https://wiki.multitheftauto.com/wiki/Deb ... s_executed Link to comment
tinnetju Posted December 28, 2010 Author Share Posted December 28, 2010 https://wiki.multitheftauto.com/wiki/Debugging#Add_debugmessages_to_check_if.2C_when_or_how_often_a_section_of_code_is_executed So, i have to do like this? if (colshapeTimer == nil) then And then with my variables? Im sorry man, english is hard for me, i don't understand everything in the page you posted... Link to comment
MaddDogg Posted December 28, 2010 Share Posted December 28, 2010 He wanted to tell you that you should debug your script. As a good scripter, it should be like breathing for you to know how to properly debug a script. The easiest way to locate the source of problems is to add debug messages as dzek suggested. Follow his link and the text here explains to you that you should just add certain output lines to your script. When the script is executed afterwards, you can see, what and how far the messages got printed. Then you can isolate the erroneous line more and more. To learn this stuff means to become more autonomous in scripting/programming. Just keep learning Link to comment
tinnetju Posted December 28, 2010 Author Share Posted December 28, 2010 He wanted to tell you that you should debug your script.As a good scripter, it should be like breathing for you to know how to properly debug a script. The easiest way to locate the source of problems is to add debug messages as dzek suggested. Follow his link and the text here explains to you that you should just add certain output lines to your script. When the script is executed afterwards, you can see, what and how far the messages got printed. Then you can isolate the erroneous line more and more. To learn this stuff means to become more autonomous in scripting/programming. Just keep learning How to learn if no ones helping? Im on not smart, im on one of the lowest study thingy's on school... Link to comment
Castillo Posted December 29, 2010 Share Posted December 29, 2010 we are helping you but you won't listen to us. Link to comment
tinnetju Posted December 29, 2010 Author Share Posted December 29, 2010 we are helping you but you won't listen to us. Debugging? Link to comment
tinnetju Posted December 29, 2010 Author Share Posted December 29, 2010 Ok, i worked hard on debugging, i tried serieusly a lot but english is realy hard for me, so can you explain it what it says? Something i understand but many things i don't... Link to comment
Castillo Posted December 29, 2010 Share Posted December 29, 2010 post what you tryied to do. Link to comment
Aibo Posted December 29, 2010 Share Posted December 29, 2010 it's possible (?) that you can't getElementByID in client when script is loaded because server haven't yet set this id, cause its also loads the script. just my guess, i'd use events to keep things 100% synced. Link to comment
tinnetju Posted December 29, 2010 Author Share Posted December 29, 2010 it's possible (?) that you can't getElementByID in client when script is loaded because server haven't yet set this id, cause its also loads the script.just my guess, i'd use events to keep things 100% synced. Well, the guy on this vid made it work! I got all the script thingy's from him 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