toptional Posted December 4, 2012 Share Posted December 4, 2012 Getting retarded errors like this ERROR: attempt to call global 'spawnPlayer' (a nil value) and ERROR: attempt to call global 'killPlayer' (a nil value) Script Client : addCommandHandler ( 'afk', function (AFKZone) spawnPlayer ( source, 1958.7082519531, -1517.5471191406, 973.55889892578, 0, 1, 0, 0 ) setElementFrozen ( thePlayer, true ) toggleControl ( thePlayer, "fire", false ) outputChatBox ( "#FF0000You are now in AFK mode do /stopafk to go back and play!", getRootElement(), 255, 255, 255, true ) end ) addCommandHandler ( 'stopafk', function (StopAFK) killPlayer(sourcePlayer, sourcePlayer) setElementFrozen ( thePlayer, false ) toggleControl ( thePlayer, "fire", true ) end ) Link to comment
AhmadQTR Posted December 4, 2012 Share Posted December 4, 2012 Getting retarded errors like thisERROR: attempt to call global 'spawnPlayer' (a nil value) and ERROR: attempt to call global 'killPlayer' (a nil value) Script Client : addCommandHandler ( 'afk', function (AFKZone) spawnPlayer ( source, 1958.7082519531, -1517.5471191406, 973.55889892578, 0, 1, 0, 0 ) setElementFrozen ( thePlayer, true ) toggleControl ( thePlayer, "fire", false ) outputChatBox ( "#FF0000You are now in AFK mode do /stopafk to go back and play!", getRootElement(), 255, 255, 255, true ) end ) addCommandHandler ( 'stopafk', function (StopAFK) killPlayer(sourcePlayer, sourcePlayer) setElementFrozen ( thePlayer, false ) toggleControl ( thePlayer, "fire", true ) end ) Your using it on client-side , use it on server-side and it will work. because killPlayer and spawnPlayer is server-sided functions. Link to comment
Cadu12 Posted December 4, 2012 Share Posted December 4, 2012 Try check your meta.xml. Link to comment
toptional Posted December 4, 2012 Author Share Posted December 4, 2012 Which advice to follow ? lol ill check the function stuff thanks Link to comment
toptional Posted December 4, 2012 Author Share Posted December 4, 2012 Bit confused bit heres what i got Server: addCommandHandler ( 'afk', function (AFKZone) setElementPosition ( thePlayer, 1958.7082519531, -1517.5471191406, 973.55889892578 ) setElementFrozen ( thePlayer, true ) toggleControl ( thePlayer, "fire", false ) outputChatBox ( "#FF0000You are now in AFK mode do /stopafk to go back and play!", getRootElement(), 255, 255, 255, true ) end ) addCommandHandler ( 'stopafk', function (StopAFK) killPlayer(sourcePlayer, sourcePlayer) setElementFrozen ( thePlayer, false ) toggleControl ( thePlayer, "fire", true ) end ) Link to comment
Baseplate Posted December 4, 2012 Share Posted December 4, 2012 (edited) server.lua addCommandHandler ( 'afk', function (thePlayer) setElementPosition ( thePlayer, 1958.7082519531, -1517.5471191406, 973.55889892578) setElementFrozen ( thePlayer, true ) toggleControl ( thePlayer, "fire", false ) outputChatBox ("#FF0000You are now in AFK mode do /stopafk to go back and play!", thePlayer, 255, 255, 255) end ) addCommandHandler ( 'stopafk', function (thePlayer) killPed(thePlayer) setElementFrozen ( thePlayer, false ) toggleControl (thePlayer, "fire", true ) end ) meta.xml <script src="server.lua" type="server"/> Edited December 4, 2012 by Guest Link to comment
toptional Posted December 4, 2012 Author Share Posted December 4, 2012 Getting loads of bad arguement errors! Link to comment
toptional Posted December 4, 2012 Author Share Posted December 4, 2012 works! Thanks Brooo!!!! 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