Greenie0101 Posted July 10, 2012 Posted July 10, 2012 hi i made my 1st client sided script today and i really struggle with them. This is it: function roll() x,y,z = getElementPosition(player) ground = getGroundPosition(x,y,z) outputChatBox(ground) setTimer(roll, 1000, 0) end addCommandHandler( "test", roll) its supposed to tell me what height the ground is when i type test and continue to tell me every second after. I have no warnings but it wont work. Why not? New CMG 2.0 Screenshot! http://img560.imageshack.us/img560/4269/cmg2screen.png CMG 2.0 Trailer! Learn to script from simple video tutorials completely free! Click here for forum page Was the scripter for CMG server! Leaving CMG: 100%
robhol Posted July 10, 2012 Posted July 10, 2012 Where is "player" being declared? Debugscript 3 and post results. You're after the THIRD, not the first argument of getGroundPosition. (Edit: oh, and make your temporary variables local) Do NOT PM ME for help unless invited. - New MTA Script Editor Scripting help "etiquette": understandable language, relevant code (ALL code if unsure), [Lua] tags, error messages with line numbers. Super simple stuff.
Jaysds1 Posted July 10, 2012 Posted July 10, 2012 try this: function roll() local x,y,z = getElementPosition(localPlayer) --instead of player try localPlayer local ground = getGroundPosition(x,y,z) outputChatBox(ground) setTimer(roll, 1000, 0) end addCommandHandler( "test", roll) 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/
Greenie0101 Posted July 10, 2012 Author Posted July 10, 2012 nothing worked debugscript 3 said incorrect client type for this command New CMG 2.0 Screenshot! http://img560.imageshack.us/img560/4269/cmg2screen.png CMG 2.0 Trailer! Learn to script from simple video tutorials completely free! Click here for forum page Was the scripter for CMG server! Leaving CMG: 100%
Jaysds1 Posted July 10, 2012 Posted July 10, 2012 is this client-side? 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/
Anderl Posted July 10, 2012 Posted July 10, 2012 function fnRoll( pPlayer ) local nX, nY, nZ = getElementPosition( pPlayer ); outputChatBox( getGroundPosition( nX, nY, nZ ) ); setTimer( fnRoll, 1000, 0 ); end addCommandHandler( 'test', fnRoll ); "[...] If you don’t love it, if you’re not having fun doing it, you don’t really love it, you’re going to give up." - Steve Jobs, 2007
TwiX! Posted July 10, 2012 Posted July 10, 2012 getGroundPosition Client-Side ONLY function fnRoll() local nX, nY, nZ = tonumber(getElementPosition( getLocalPlayer())); outputChatBox( tonumber(getGroundPosition( nX, nY, nZ )) ); setTimer( fnRoll, 1000, 0 ); end addCommandHandler( 'test', fnRoll ); - Working on [php/HTML/Mysql/Lua/Java Scripts/Web Design/3D Modeling]
Anderl Posted July 10, 2012 Posted July 10, 2012 getGroundPosition Client-Side ONLY function fnRoll() local nX, nY, nZ = tonumber(getElementPosition( getLocalPlayer())); outputChatBox( tonumber(getGroundPosition( nX, nY, nZ )) ); setTimer( fnRoll, 1000, 0 ); end addCommandHandler( 'test', fnRoll ); The code is client-side and.. mine is correct. "[...] If you don’t love it, if you’re not having fun doing it, you don’t really love it, you’re going to give up." - Steve Jobs, 2007
TwiX! Posted July 10, 2012 Posted July 10, 2012 on client-side script don't know what it's "pPlayer" - Working on [php/HTML/Mysql/Lua/Java Scripts/Web Design/3D Modeling]
Anderl Posted July 10, 2012 Posted July 10, 2012 on client-side script don't know what it's "pPlayer" God damnit Thought it was pPlayer in client-side and didn't exist the commandName param "[...] If you don’t love it, if you’re not having fun doing it, you don’t really love it, you’re going to give up." - Steve Jobs, 2007
Jaysds1 Posted July 10, 2012 Posted July 10, 2012 use my script above^ 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/
TwiX! Posted July 10, 2012 Posted July 10, 2012 use my script above^ in your code he too will got error localPlayer in your code.. argument is undefined - Working on [php/HTML/Mysql/Lua/Java Scripts/Web Design/3D Modeling]
Anderl Posted July 10, 2012 Posted July 10, 2012 use my script above^ in your code he too will got error localPlayer in your code.. argument is undefined He won't. "[...] If you don’t love it, if you’re not having fun doing it, you don’t really love it, you’re going to give up." - Steve Jobs, 2007
Jaysds1 Posted July 10, 2012 Posted July 10, 2012 use my script above^ in your code he too will got error localPlayer in your code.. argument is undefined localPlayer is part of the predefined variables in MTA: Predefined_variables_list 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/
TwiX! Posted July 10, 2012 Posted July 10, 2012 use my script above^ in your code he too will got error localPlayer in your code.. argument is undefined localPlayer is part of the predefined variables in MTA: Predefined_variables_list exactly, i forgot it - Working on [php/HTML/Mysql/Lua/Java Scripts/Web Design/3D Modeling]
DarkLink Posted July 10, 2012 Posted July 10, 2012 Maybe his problem is about meta.xml , because he tryed fixing with that player argument and still now working.. Show us your meta.xml file, u should have a pointer to your script file refering to a client side script on the tag... Good luck Borderpatrol Project Gamemode - Under Development (80%)
Jaysds1 Posted July 10, 2012 Posted July 10, 2012 Examples: ="client.lua" type="client" /> ="server.lua" />="server2.lua" type="server" /> 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/
DarkLink Posted July 10, 2012 Posted July 10, 2012 Examples: ="client.lua" type="client" /> ="server.lua" />="server2.lua" type="server" /> Ye thats right, I didnt had time to explain better, but this is it. Grennie go check your meta.xml and give us feedback Borderpatrol Project Gamemode - Under Development (80%)
Greenie0101 Posted July 10, 2012 Author Posted July 10, 2012 none of them work : meta is <meta> <script src="parkour.lua" type="client"></script> </meta> New CMG 2.0 Screenshot! http://img560.imageshack.us/img560/4269/cmg2screen.png CMG 2.0 Trailer! Learn to script from simple video tutorials completely free! Click here for forum page Was the scripter for CMG server! Leaving CMG: 100%
Anderl Posted July 10, 2012 Posted July 10, 2012 none of them work :meta is <meta> <script src="parkour.lua" type="client"></script> </meta> <meta> <script src="parkour.lua" type="client" /> </meta> "[...] If you don’t love it, if you’re not having fun doing it, you don’t really love it, you’re going to give up." - Steve Jobs, 2007
robhol Posted July 11, 2012 Posted July 11, 2012 As far as I know, that doesn't matter. MTA looks at the attributes anyway, not the (non-existant) contents of the tag. Anyway, seriously, run debugscript 3. You need to enter it in the in-game F8 console, not in the server window. Do NOT PM ME for help unless invited. - New MTA Script Editor Scripting help "etiquette": understandable language, relevant code (ALL code if unsure), [Lua] tags, error messages with line numbers. Super simple stuff.
Jaysds1 Posted July 11, 2012 Posted July 11, 2012 As far as I know, that doesn't matter. MTA looks at the attributes anyway, not the (non-existant) contents of the tag.Anyway, seriously, run debugscript 3. You need to enter it in the in-game F8 console, not in the server window. plus you have to be signed in to your MTA account. 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/
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