Skip to content

Instantly share code, notes, and snippets.

@gallexme
Created February 17, 2018 22:40
Show Gist options
  • Save gallexme/8d252c7fdca293681169197922211bbd to your computer and use it in GitHub Desktop.
Save gallexme/8d252c7fdca293681169197922211bbd to your computer and use it in GitHub Desktop.
function SinglePlayer.Server:OnClientConnect( channelId )
local params =
{
name = "Dude",
class = "Player",
position = {x=0, y=0, z=0},
rotation = {x=0, y=0, z=0},
scale = {x=1, y=1, z=1},
};
player = Actor.CreateActor(channelId, params);
if (not player) then
Log("OnClientConnect: Failed to spawn the player!");
return;
end
function luafunc(str)
Log(str)
dofile("C:/Program Files (x86)/Steam/steamapps/common/KingdomComeDeliverance/test.lua")
end
System.AddCCommand("testlua", "luafunc(%line)", "desc");
local spawnId = self.game:GetFirstSpawnLocation(0);
if (spawnId) then
local spawn=System.GetEntity(spawnId);
if (spawn) then
player:SetWorldPos(spawn:GetWorldPos(g_Vectors.temp_v1));
spawn:GetAngles(g_Vectors.temp_v1);
g_Vectors.temp_v1.x = 0;
g_Vectors.temp_v1.y = 0;
player.actor:PlayerSetViewAngles(g_Vectors.temp_v1);
spawn:Spawned(player);
return;
end
end
System.Log("$1warning: No spawn points; using default spawn location!")
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment