Jump to content

[Help]player collide


Perfect

Recommended Posts

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)  

Link to comment
why the mixed player arguments?

you mean why there is localplayer,player,thePlayer ?

If that, thnx i typed fastly, so i forgot :P

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!!!

Link to comment
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

Link to comment
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'

Link to comment
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 by Guest
Link to comment
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'

Link to comment
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

Link to comment
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

Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...