PDA

Archiv verlassen und diese Seite im Standarddesign anzeigen : Wie Movement Typ ändern und ein paar weitere Fragen...



CGamer
14.04.2009, 17:28
(bin mir nicht sicher obs hierrein gehört)

Ich suche seit ner stunde den Befehl um vom Player den Movement Typ zu ändern. Gefunden habe ich bisher nichts. Wie heißt dieser?

(für den ders wissen will... ich bau mir nen eigenen gamemode. zum üben derzeit)

Pac_187
14.04.2009, 18:16
Wir haben ne extra Kategorie für Lua, steht sogar "Lua" dran ;)

Hier ist ne Übersicht aller Funktionen:
http://wiki.garrysmod.com/wiki/?title=Category:Lua_functions

Und das was du suchst nennt sich: Entity.SetMoveType (http://wiki.garrysmod.com/wiki/?title=Entity.SetMoveType)

Entity deshalb weil der Spieler ja auch ein Entity ist.

CGamer
14.04.2009, 21:49
danke:) funktioniert leider nicht:/

cl_init.lua
include("shared.lua")

function UpdateTeam()
local frame
frame = vgui.Create( "DFrame" )
frame:SetPos( ScrH() / 2, ScrW() / 2 ) //Create Teamchange Window
frame:SetSize( 200, 140 ) //Set the size
frame:SetTitle( "Select Mode" )
frame:SetVisible( true )
frame:SetDraggable( false )
frame:ShowCloseButton( true )
frame:MakePopup()

but_spec = vgui.Create( "DButton", frame )
but_spec:SetPos( 10, 10 )
but_spec:SetSize( 180, 55 )
but_spec:SetText( "Spectate" )
but_spec.DoClick = function()
RunConsoleCommand( "ghidden_spectator" )
end

but_hidd = vgui.Create( "DButton", frame )
but_hidd:SetPos( 10, 70 )
but_hidd:SetSize( 180, 55 )
but_hidd:SetText( "Playing" )
but_hidd.DoClick = function()
RunConsoleCommand( "ghidden_hunter" )
end
end
concommand.Add( "ghidden_team", UpdateTeam )

init.lua
AddCSLuaFile( "cl_init.lua" ) //Tell the server that the client needs to download cl_init.lua
AddCSLuaFile( "shared.lua" ) //Tell the server that the client needs to download shared.lua

include( 'shared.lua' ) //Tell the server to load shared.lua

function GM:PlayerIntitialSpawn( ply )
ply:SetTeam( 1 ) //Join Team Spectators
ply:ConCommand( "ghidden_team" )
ply:ChatPrint( "[GHidden]Welcome to the Server, " .. ply:Nick() )
ply:CrosshairDisable()
end

function GM:PlayerLoadout( ply )
if ply:Team() == 1 then
ply:Spectate( 6 )
ply:SetMoveType( MOVETYPE_OBSERVER )
elseif ply:Team() == 2 then
//Weapons
ply:Give( "weapon_phycannon" )
ply:Give( "weapon_knife" )

//Ammo

//Model
ply:SetModel( "models/player/kleiner.mdl" )
ply:SetColor( 255, 255, 255, 22.5 )

//Data
ply:SetMaxHealth( 250 )
ply:SetHealth( 250 )
ply:SetArmor( 0 )

//Physics
ply:SetMoveSpeed( 350 )
ply:SetGravity( 0.75 )
ply:SetJumpPower( 320 )
ply:SetMoveType( MOVETYPE_WALK )
elseif ply:Team() == 3 then
//Weapons
ply:Give( "weapon_pistol" )
ply:Give( "weapon_357" )
ply:Give( "weapon_ar2" )

//Ammo
ply:GiveAmmo( 60, "pistol" )
ply:GiveAmmo( 12, "357" )
ply:GiveAmmo( 60, "ar2" )

//Model
ply:SetModel( "models/player/barney.mdl" )

//Data
ply:SetMaxHealth( 100 )
ply:SetArmor( 100 )

//Physics
ply:SetMoveSpeed( 250 )
ply:SetGravity( 1 )
ply:SetJumpPower( 160 )
ply:SetMoveType( MOVETYPE_WALK )
end
ply:Spawn()
end

// Custom Functions(Team)
function team_spec( ply )
ply:SetTeam( 1 )
ply:Kill()

ply:Spectate( 6 )
ply:SetMoveType( MOVETYPE_OBSERVER )

ply:ChatPrint( "Joined Team " .. Team.GetName( 3 ) )

ply:Spawn()
end

function team_playing( ply )
ply:SetTeam( 3 )
ply:Kill()
ply:ChatPrint( "" )
end

//ConCommands
concommand.Add( "ghidden_spectator", team_spec )
concommand.Add( "ghidden_hunter", team_playing )

shared.lua
GM.Name = "Hidden: GMod" //Set the gamemode name
GM.Author = "perfectdeath545" //Set the author name
GM.Email = "[email protected]" //Set the author email
GM.Website = "http://ssgn.net63.net/" //Set the author website

team.SetUp( 1, "Spectator", color(127, 127, 127, 255) )
team.SetUp( 2, "Hidden", color(255, 0, 0, 255) )
team.SetUp( 3, "S.W.A.T.", color(204, 204, 204, 255) )

function GetAliveCount()
local Count = 0
for k, v in Player:GetAll() do
if v.Alive() == true then
Count = Count + 1
end
end
return Count
end

function GetPlayerCount()
local Count = 0
for k, v in Player:GetAll() do
Count = Count + 1
end
return Count
end

Ich denke man kann erkennen das ich nen gmod gamemode von The Hidden: Source (http://www.hidden-source.com/) machen möchte;)

Pac_187
14.04.2009, 21:57
Irgendwelche Fehler?

CGamer
14.04.2009, 22:03
ja C Stack Overflow und Unknown command(oder so) :SetMoveType

[edit] diese c stack overflow:
ERROR: GAMEMODE:'PlayerSelectSpawn' Failed: includes\util.lua:9: C stack overflow
ERROR: GAMEMODE:'SetPlayerAnimation' Failed: base\gamemode\player.lua:15: C stack overflow
ERROR: GAMEMODE:'PlayerSpawn' Failed: base\gamemode\player.lua:377: C stack overflow

BennyG
14.04.2009, 23:18
Mach das ply:Spawn() aus den Loadout raus.
Was hat das denn da verloren,schließlich willst du den Spieler ja nicht nochmal spawnen wenn er gerade Spawnt.