Jump to content

problem in trigger


HoLsTeN

Recommended Posts

hello :)

i have problem here :cry:

my problem in trigger

i don't post the full script because i'm scare to stole my idea 8)

i just post example for what i want to do :mrgreen:

Client

pc1 = createColSphere(482.31958, -23.93058 ,1003.10938,0.5) 
pc2 = createColSphere(483.46457, -24.80609 ,1003.10938,0.5) 
  
function ClubBind( theElement ) 
    if ( theElement == getLocalPlayer() ) then 
        if source == pc1 then 
        WTF = "pc1" 
        bindKey("action", "down", SitAtChair,WTF) 
        outputChatBox(WTF,255,0,0) 
        elseif source == pc2 then 
        WTF = "pc2" 
        bindKey("action", "down", SitAtChair,WTF) 
        outputChatBox(WTF,255,0,0) 
        end 
    end 
end 
addEventHandler( "onClientColShapeHit", getRootElement(), ClubBind ) 
  
function SitAtChair(WTF) 
triggerServerEvent ("SitForm", getLocalPlayer() , WTF) 
end 

server

addEvent("SitForm", true) 
addEventHandler("SitForm", rootElement, 
function(WTF) 
if WTF == pc1 then 
outputChatBox("pc1",255,0,0) 
elseif WTF == pc2 then 
outputChatBox("pc2",255,0,0) 
end 
end 
) 

sorry for my poor English ..

Edited by Guest
Link to comment
addEvent ( "SitForm", true ) 
addEventHandler ( "SitForm", root, 
    function ( WTF ) 
        if ( WTF == "pc1" ) then 
            outputChatBox ( "pc1", 255, 0, 0 ) 
        elseif ( WTF == "pc2" ) then 
            outputChatBox ( "pc2", 255, 0, 0 ) 
        end 
    end 
) 

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