Perfect Posted August 23, 2012 Posted August 23, 2012 Hi all, i want to know how to make player like a ghost ? i mean players can go through players which functions i can use or can someone make for me pls ? i wanted that with command /ghost then ghostmode on
CheiN Posted August 23, 2012 Posted August 23, 2012 ghost mode are not abble on your gamemode settings?
Perfect Posted August 23, 2012 Author Posted August 23, 2012 ghost mode are not abble on your gamemode settings? not car ghost mode, i mean players. if i type /ghost then they or car can go through from me
Perfect Posted August 23, 2012 Author Posted August 23, 2012 Search in Community.mtasa.com i can't find any
CheiN Posted August 23, 2012 Posted August 23, 2012 use this: setElementCollidableWith (offtopic: spark.... GHOST MODE)
Perfect Posted August 23, 2012 Author Posted August 23, 2012 use this: setElementCollidableWith (offtopic: spark.... GHOST MODE) ah, thnx I tried, can you check please! function playerghostmode() local localplayer = getLocalPlayer(source) for index,player in ipairs(getElementsByType("player")) do setElementCollidableWith(player, localplayer, false) outputChatBox("Server: Ghostmod: on", thePlayer, 0, 255, 0 ) else setElementCollidableWith(player, localplayer, false) outputChatBox("Server: Ghostmode: off", thePlayer, 0, 255, 0 ) end end addCommandHandler("ghostmode", playerghostmode)
CheiN Posted August 23, 2012 Posted August 23, 2012 i think that is correct,(i cant see now) but "ghostmode off" should be "true" not "false"
Perfect Posted August 23, 2012 Author Posted August 23, 2012 i think that is correct,(i cant see now) but "ghostmode off" should be "true" not "false" ah thnx, i forgot
Perfect Posted August 23, 2012 Author Posted August 23, 2012 why the mixed player arguments? you mean why there is localplayer,player,thePlayer ? If that, thnx i typed fastly, so i forgot EDIT: can you correct my code please if that is wrong ? EDIT: Warning:playerghost/ghost.lua:6: 'end' expected (to close 'for' at line 3) near 'else' . please help!!!
CheiN Posted August 23, 2012 Posted August 23, 2012 function playerghostmode() local localplayer = getLocalPlayer(source) for index,player in ipairs(getElementsByType("player")) do setElementCollidableWith(player, localplayer, false) outputChatBox("Server: Ghostmod: on", thePlayer, 0, 255, 0 ) else setElementCollidableWith(player, localplayer, true) outputChatBox("Server: Ghostmode: off", thePlayer, 0, 255, 0 ) end end addCommandHandler("ghostmode", playerghostmode) try it
Perfect Posted August 23, 2012 Author Posted August 23, 2012 function playerghostmode() local localplayer = getLocalPlayer(source) for index,player in ipairs(getElementsByType("player")) do setElementCollidableWith(player, localplayer, false) outputChatBox("Server: Ghostmod: on", thePlayer, 0, 255, 0 ) else setElementCollidableWith(player, localplayer, true) outputChatBox("Server: Ghostmode: off", thePlayer, 0, 255, 0 ) end end addCommandHandler("ghostmode", playerghostmode) try it same errors Warning:playerghost/ghost.lua:6: 'end' expected (to close 'for' at line 3) near 'else'
CheiN Posted August 23, 2012 Posted August 23, 2012 (edited) function playerghostmode() local localplayer = getLocalPlayer(source) for index,player in ipairs(getElementsByType("player")) do setElementCollidableWith(player, localplayer, false) outputChatBox("Server: Ghostmod: on", source, 0, 255, 0 ) else setElementCollidableWith(player, localplayer, true) outputChatBox("Server: Ghostmode: off", source, 0, 255, 0 ) end end end addCommandHandler("ghostmode", playerghostmode) TRY THIS Edited August 23, 2012 by Guest
Perfect Posted August 23, 2012 Author Posted August 23, 2012 function playerghostmode() local localplayer = getLocalPlayer(source) for index,player in ipairs(getElementsByType("player")) do setElementCollidableWith(player, localplayer, false) outputChatBox("Server: Ghostmod: on", source, 0, 255, 0 ) else setElementCollidableWith(player, localplayer, true) outputChatBox("Server: Ghostmode: off", source, 0, 255, 0 ) end end addCommandHandler("ghostmode", playerghostmode) srry for 2ble post TRY IT same errors Warning:playerghost/ghost.lua:6: 'end' expected (to close 'for' at line 3) near 'else'
Perfect Posted August 23, 2012 Author Posted August 23, 2012 try with the last (i modified it) same errors again Warning:playerghost/ghost.lua:6: 'end' expected (to close 'for' at line 3) near 'else'
CheiN Posted August 23, 2012 Posted August 23, 2012 function playerghostmode() local localplayer = getLocalPlayer(source) for index,player in ipairs(getElementsByType("player")) do setElementCollidableWith(player, localplayer, false) outputChatBox("Server: Ghostmod: on", source, 0, 255, 0 ) else setElementCollidableWith(player, localplayer, true) outputChatBox("Server: Ghostmode: off", source, 0, 255, 0 ) end end end addCommandHandler("ghostmode", playerghostmode) TRY THIS use that and put it on client
Perfect Posted August 23, 2012 Author Posted August 23, 2012 function playerghostmode() local localplayer = getLocalPlayer(source) for index,player in ipairs(getElementsByType("player")) do setElementCollidableWith(player, localplayer, false) outputChatBox("Server: Ghostmod: on", source, 0, 255, 0 ) else setElementCollidableWith(player, localplayer, true) outputChatBox("Server: Ghostmode: off", source, 0, 255, 0 ) end end end addCommandHandler("ghostmode", playerghostmode) TRY THIS use that and put it on client Still same error
Perfect Posted August 23, 2012 Author Posted August 23, 2012 what debugscript 3 says? WARNING: Loading script failed: player_ghostmode\pghost.lua:6: 'end' expected (to close 'for' at line 3) near 'else'
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