hi i have deathrun server and i was trying to change the death model with this code :
i removed this code from init.lua :
[CODE]ply:SetModel( mdl or table.Random( rModels ) )[/CODE]
for this code :
[CODE]
if ply:Team() == TEAM_RUNNER then
ply:SetModel( mdl or table.Random( rModels ) )
elseif ply:Team()== TEAM_DEATH then
ply:SetModel( "yourmodelhere" )
return
end[/CODE]
and i changed the gamemode to sandbox to add some things to the server and when i come in i started with no model and no weapons and stuff
and i was trying to change the code back to the normal and its still didit work help pls
There is probably an error in your code somewhere. See if there are any in the console.
Also, if there is any other code after that if statement, then that 'return' will prevent any of it from running, which is a bad thing most likely. Remove it, unless you're really sure you need it there.
Ideally, invest some time into learning Lua properly and learning what you are doing before posting questions like these. There really is not enough information here. Help us help you.
[QUOTE=typedef state;50766429]There is probably an error in your code somewhere. See if there are any in the console.
Also, if there is any other code after that if statement, then that 'return' will prevent any of it from running, which is a bad thing most likely. Remove it, unless you're really sure you need it there.
Ideally, invest some time into learning Lua properly and learning what you are doing before posting questions like these. There really is not enough information here. Help us help you.[/QUOTE]
this is the error :
[ERROR] gamemodes/deathrun/gamemode/cl_init.lua:76: attempt to call method 'GetRoundTime' (a nil value)
1. unknown - gamemodes/deathrun/gamemode/cl_init.lua:76
and i change the code to the normal code and this is more codes beside :
[CODE]ply:SetNoCollideWithTeammates( true )
ply:SetAvoidPlayers( push:GetInt() == 1 and true or false )
local mdl = hook.Call( "ChangePlayerModel", GAMEMODE, ply ) or false
ply:SetModel( mdl or table.Random( rModels ) )
end
function GM:PlayerSetHandsModel( ply, ent )
local simplemodel = player_manager.TranslateToPlayerModelName( ply:GetModel() )
local info = player_manager.TranslatePlayerHands( simplemodel )
if ( info ) then
ent:SetModel( info.model )
ent:SetSkin( info.skin )
ent:SetBodyGroups( info.body )
end[/CODE]
The error you posted is a clientside error and has nothing to do with anything on the server, which is responsible for models and weapons.
If you are using a dedicated server, look in the server's console (not your client). If you are on a listen server, look for error messages in blue color.
Post the entire init.lua
[QUOTE=typedef state;50766528]The error you posted is a clientside error and has nothing to do with anything on the server, which is responsible for models and weapons.
If you are using a dedicated server, look in the server's console (not your client). If you are on a listen server, look for error messages in blue color.
Post the entire init.lua[/QUOTE]
here :
[CODE]CreateConVar( "dr_roundtime_seconds", "360" )
AddCSLuaFile( "shared.lua" )
AddCSLuaFile( "cl_scoreboard.lua" )
AddCSLuaFile( "cl_voice.lua" )
AddCSLuaFile( "cl_init.lua" )
AddCSLuaFile( "cl_frames.lua" )
AddCSLuaFile( "menutext.lua" )
AddCSLuaFile( "rtv/config.lua" )
AddCSLuaFile( "rtv/cl_rtv.lua" )
include( "shared.lua" )
include( "sv_round.lua" )
include( "sv_weps.lua" )
include( "rtv/config.lua" )
include( "rtv/sv_rtv.lua" )
-- include( "cl_init.lua" )
-- Used to be required for autorefresh, guess it isn't anymore.
local highlight = CreateConVar( "dr_highlight_admins", "1", FCVAR_ARCHIVE )
local rounds = CreateConVar( "dr_total_rounds", "10", FCVAR_ARCHIVE )
local suicide = CreateConVar( "dr_allow_death_suicide", "0", FCVAR_ARCHIVE )
local bhop = CreateConVar( "dr_allow_autojump", "1", FCVAR_ARCHIVE )
local uammo = CreateConVar( "dr_unlimited_ammo", "1", FCVAR_ARCHIVE )
local pickup = CreateConVar( "dr_allow_death_pickup", "0", FCVAR_ARCHIVE )
local falldamage = CreateConVar( "dr_realistic_fall_damage", "1", FCVAR_ARCHIVE )
local push = CreateConVar( "dr_push_collide", "0", FCVAR_ARCHIVE )
util.AddNetworkString( "Deathrun_Func" )
local meta = FindMetaTable( "Player" )
gameevent.Listen("player_connect")
gameevent.Listen("player_disconnect")
local rModels = {}
for i = 1, 8 do
rModels[#rModels+1] = "models/player/group01/male_0"..i..".mdl"
end
function GM:PlayerSpawn( ply )
ply._HasPressedKey = false
if ply:Team() == TEAM_SPECTATOR then
ply:Spectate(OBS_MODE_ROAMING)
return
end
self.BaseClass:PlayerSpawn( ply )
ply:SetHealth(ply:GetMaxHealth())
ply:StripWeapons()
ply:StripAmmo()
ply:SetWalkSpeed(260)
ply:SetRunSpeed(300)
ply:AllowFlashlight(true)
ply:SetArmor(0)
ply:SetupHands()
ply:SetJumpPower(190)
local col = team.GetColor( ply:Team() )
ply:SetPlayerColor( Vector( col.r/255, col.g/255, col.b/255 ) )
local spawns = ents.FindByClass( ply:Team() == TEAM_RUNNER and "info_player_counterterrorist" or "info_player_terrorist" )
if #spawns > 0 then
local pos = table.Random( spawns ):GetPos()
ply:SetPos( pos )
timer.Simple( 1, function()
if (IsValid(ply) and ply:Alive() and pos) then
ply:SetPos( pos )
end
end )
end
ply:SetNoCollideWithTeammates( true )
ply:SetAvoidPlayers( push:GetInt() == 1 and true or false )
local mdl = hook.Call( "ChangePlayerModel", GAMEMODE, ply ) or false
ply:SetModel( mdl or table.Random( rModels ) )
end
function GM:PlayerSetHandsModel( ply, ent )
local simplemodel = player_manager.TranslateToPlayerModelName( ply:GetModel() )
local info = player_manager.TranslatePlayerHands( simplemodel )
if ( info ) then
ent:SetModel( info.model )
ent:SetSkin( info.skin )
ent:SetBodyGroups( info.body )
end
end
function GM:NotifyAll( str )
--PrintMessage( HUD_PRINTCENTER, str )
--PrintMessage( HUD_PRINTCONSOLE, "Deathrun: "..str )
self:Deathrun_Func( nil, "Notify", str )
end
function meta:Notify( str )
GAMEMODE:Deathrun_Func( self, "Notify", str )
end
function Notify( str )
return GAMEMODE:NotifyAll( str )
end
function GM:Deathrun_Func( ply, str, ... )
if not (str) then MsgN( "Invalid Deathrun_Func" ) return end
net.Start( "Deathrun_Func" )
net.WriteString( str )
net.WriteTable( {...} )
if IsValid(ply) then net.Send( ply ) else net.Broadcast() end
end
local WMeta = FindMetaTable( "Weapon" )
local oldTake = WMeta.TakePrimaryAmmo
function WMeta:TakePrimaryAmmo( num )
if uammo:GetInt() == 1 then return end
return oldTake( self, num )
end
function meta:AltDropWeapon( wep )
local class = wep:GetClass()
local ammo = wep.Clip1 and wep:Clip1() or 0
if self:HasWeapon( class ) then
self:StripWeapon( class )
local ent = ents.Create( class )
if not IsValid(ent) then return end
ent:SetPos( self:GetPos() + Vector( 0, 0, 50 ) )
ent:SetAngles( self:GetAngles() )
ent.JCanPickup = { player = self, time = CurTime() + 2 }
ent:Spawn()
if ent.SetClip1 then
ent:SetClip1( ammo )
end
local phys = ent:GetPhysicsObject()
if IsValid(phys) then
phys:Wake()
phys:SetVelocity( self:GetVelocity() + self:GetAimVector()*300 )
end
self:SelectWeapon( "weapon_crowbar" )
end
end
local callbacks = {}
local callbackv = {}
local function ConVarCallback( name, func ) -- cvars.AddChangeCallback doesn't seem to want to work; no idea why.
callbacks[name] = func
end
function GM:ConVarThink()
for k, v in pairs( callbacks ) do
local s = GetConVarString( k )
if not callbackv[k] then
callbackv[k] = s
continue
else
local ov = callbackv[k]
if ov != s then
v( k, ov, s )
callbackv[k] = s
end
end
end
end
local random = math.random
function GM:Tick()
for k, v in pairs( player.GetAll() ) do
if v:Alive() and v:WaterLevel() >= 3 then
if not v._DrownTime then
v._DrownTime = RealTime() + 10
continue
elseif v._DrownTime <= RealTime() then
local dmg = DamageInfo()
dmg:SetDamageType(DMG_DROWN)
dmg:SetDamage( 15 )
dmg:SetAttacker(game.GetWorld())
dmg:SetInflictor(game.GetWorld())
dmg:SetDamageForce( Vector( random(-5,5), random(-2,3), random(-10,9) ) )
v:TakeDamageInfo(dmg)
v._DrownTime = RealTime() + 3
end
else
v._DrownTime = nil
end
end
end
function GM:EntityTakeDamage( vict, dmginfo )
local atk = dmginfo:GetAttacker()
if IsValid(atk) and atk:IsPlayer() and vict:IsPlayer() and vict:Team() == atk:Team() then
dmginfo:ScaleDamage(0)
end
end
function GM:CanPlayerSuicide( ply )
if not ply:Alive() then return false end
if ply:Team() == TEAM_DEATH and suicide:GetInt() == 0 then return false end
if self:GetRound() == ROUND_PREPARING then return false end
return self.BaseClass:CanPlayerSuicide( ply )
end
function GM:PlayerCanPickupWeapon( ply, wep )
if not ply:Alive() then return false end
local Active = ply:GetActiveWeapon()
if IsValid(Active) then
Active = Active:GetClass()
if Active == "weapon_physgun" then return false end
if Active == "weapon_placer" then return false end
end
if ply:HasWeapon( wep:GetClass() ) then return false end
if ply:Team() == TEAM_DEATH then
if wep:GetClass() != "weapon_crowbar" and pickup:GetInt() == 0 then
return false
end
end
local pickup = wep.JCanPickup
if pickup and pickup.player and pickup.player == ply then
if pickup.time and pickup.time >= CurTime() then
return false
else
wep.JCanPickup = nil
end
elseif pickup then
wep.JCanPickup = nil
end
if wep.Primary and wep.Primary.Ammo and wep.Primary.Ammo != "none" then
ply:GiveAmmo( 1000000, wep.Primary.Ammo, true )
end
return true
end
function GM:PlayerCanHearPlayersVoice( listen, talker )
return true
end
concommand.Add( "_dr_req_drop", function( ply )
if not ply:Alive() then return end
local wep = ply:GetActiveWeapon()
if not IsValid(wep) then return end
if wep:GetClass() == "weapon_crowbar" then return end
ply:AltDropWeapon( wep )
end )
function GM:ShowHelp( ply )
self:Deathrun_Func( ply, "F1" )
end
local connecting = {}
hook.Add( "player_connect", "Add Connecting Players", function(d)
connecting[d.networkid] = d.name
GAMEMODE:Deathrun_Func( nil, "Connecting_Player", d.name, d.networkid )
end )
hook.Add( "player_disconnect", "Remove Connecting Player", function( d )
connecting[d.networkid] = nil
GAMEMODE:Deathrun_Func( nil, "Remove_CPlayer", d.networkid )
end )
hook.Add( "PlayerInitialSpawn", "Remove Connecting Player", function( ply )
local id = ply:SteamID()
connecti
What you might want to do is change this
[lua]
ply:SetModel( mdl or table.Random( rModels ) )
[/lua]
to this
[lua]
ply:SetModel( table.Random( rModels ) )
[/lua]
[QUOTE=typedef state;50766545]What you might want to do is change this
[lua]
ply:SetModel( mdl or table.Random( rModels ) )
[/lua]
to this
[lua]
ply:SetModel( table.Random( rModels ) )
[/lua][/QUOTE]
still the model is black and it not gives weapons and its not starting the round maybe the problem not in the init file
If there are no errors in the server console, then there is nothing we can do for you. Nobody is going to fix your code for you for free. Learn Lua and diagnose the problem yourself, or hire a coder to do it for you.
There is simply not enough information for us to be of any help.
[QUOTE=typedef state;50766610]If there are no errors in the server console, then there is nothing we can do for you. Nobody is going to fix your code for you for free. Learn Lua and diagnose the problem yourself, or hire a coder to do it for you.
There is simply not enough information for us to be of any help.[/QUOTE]
there is some errors i see on the console in red :
KeyValues Error: RecursiveLoadFromBuffer: got EOF instead of keyname in file materials/models/korka007/marrybody.vmt
VertexLitGeneric,
KeyValues Error: RecursiveLoadFromBuffer: got EOF instead of keyname in file materials/models/korka007/marryface.vmt
VertexLitGeneric,
CMaterial::PrecacheVars: error loading vmt file for models/mcmodelpack/mobs/creeper
CMaterial::PrecacheVars: error loading vmt file for models/mcmodelpack/mobs/pig
CMaterial::PrecacheVars: error loading vmt file for models/mcmodelpack/mobs/zombie
CMaterial::PrecacheVars: error loading vmt file for models/mcmodelpack/mobs/pigzombie2
CMaterial::PrecacheVars: error loading vmt file for models/mcmodelpack/mobs/pigzombie
CMaterial::PrecacheVars: error loading vmt file for models/mcmodelpack/cake
CMaterial::PrecacheVars: error loading vmt file for models/mcmodelpack/transparent_blocks
CMaterial::PrecacheVars: error loading vmt file for models/mcmodelpack/mobs/spider
CMaterial::PrecacheVars: error loading vmt file for models/mcmodelpack/mobs/ghast
CMaterial::PrecacheVars: error loading vmt file for models/mcmodelpack/mobs/ghast-fire
Error! Variable "$blendtintbybasealpha" is multiply defined in material "models/player/wolf/fur"!
Error! Variable "$blendtintcoloroverbase" is multiply defined in material "models/player/wolf/fur"!
Error: Material "blackrockshooter/iris_r" : proxy "FleshInterior" unable to initialize!
Error: Material "blackrockshooter/iris_l" : proxy "FleshInterior" unable to initialize!
Are the models missing (huge red ERROR placeholders) or are they black/missing textures? If it's the latter, then the issue is with the models/materials themselves.
Can't say anything about the weapons, though.
[QUOTE=typedef state;50766620]Are the models missing (huge red ERROR placeholders) or are they black/missing textures? If it's the latter, then the issue is with the models/materials themselves.
Can't say anything about the weapons, though.[/QUOTE]
yes the models are black and its not starting rounds maybe becasue of that the models are black and its start with no weapons i think if i fix the rounds problem everything should work well
Sorry, you need to Log In to post a reply to this thread.