Jump to content

Recommended Posts

--This is the function we'll call remotely to do it's thing, in this case make you giant!
local function GrowGiant(player, size)
    local valid_grow_state = true -- todo: make sure the player is allowed to grow right now
    if valid_grow_state then
    	player.Transform:SetScale(size,size,size)
    end
end
--This adds the handler, which means that if the server gets told "GrowGiant",
-- it will call our function, GrowGiant, above
AddModRPCHandler("GrowGiantRPC", "GrowGiant", GrowGiant)

--This has it send the RPC to the server when you press "v"
local size = 1
local function SendGrowGiantRPC()
  	size = size + 1
  	if size == 6 then size = 1 end
	SendModRPCToServer(GetModRPC("GrowGiantRPC", "GrowGiant"), size)
end
GLOBAL.TheInput:AddKeyDownHandler(GLOBAL.KEY_V, SendGrowGiantRPC)

 

I set the above example code to client mode, deployed a dedicated server, and pressed V. Instead of increasing the character size, the server console throws an error

Error decoding lua RPC mod namespace

I need to build in server mode to use RPC...?
 

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
×
  • Create New...