• Player crashes on death.
    6 replies, posted
Hi, I'm creating a gamemode and every time a player dies, he/she dies. Does anyone know any quick method to fix this? Thanks. init.lua : [CODE]AddCSLuaFile("cl_init.lua") AddCSLuaFile("shared.lua") include("shared.lua") include("player.lua") function GM:PlayerConnect( name, ip ) print("Player: " .. name .. ", has joined the game.") end function GM:PlayerInitialSpawn( ply ) print("Player: " .. ply:Nick() .. ", has spawned.") ply:SetGamemodeTeam( 0 ) end function GM:PlayerAuthed( ply, steamID, uniqueID ) print("Player: " .. ply:Nick() .. ", has gotten authed.") end [/CODE] cl_init.lua : [CODE]include("shared.lua") [/CODE] shared.lua : [CODE]GM.Name = "SomeCoolGamemodeThatYouDontNeedToKnowItsName" GM.Author = "Scareh GhooooOost and mindfulhacker" GM.Email = "support@SomeCoolGamemodeThatYouDontNeedToKnowItsName.com" GM.Website = "http://SomeCoolGamemodeThatYouDontNeedToKnowItsName.com" team.SetUp( 0, "Robbers", Color(0, 0, 255) ) team.SetUp( 1, "Police", Color(255, 0, 0) ) function GM:Initialize() self.BaseClass.Initialize( self ) end /** ///////////////////////////////// // Creation of the jobs Table // /////////////////////////////// **/ JOBS = {} CLASS_ROBBERS = 0 CLASS_POLICE = 1 JOBS[CLASS_ROBBERS] = { name = "ROBBERS", color = Vector( 1, 0, 0 ), weapons = { "weapon_crowbar" } } JOBS[CLASS_POLICE] = { name = "Police", color = Color( 0, 0, 1 ), weapons = { "weapon_crowbar", "weapon_pistol"} }[/CODE] player.lua : [CODE]local ply = FindMetaTable("Player") function ply:SetGamemodeTeam( n ) if not JOBS[n] then return end self:SetTeam( n ) self:SetPlayerColor( JOBS[n].color ) self:GiveGamemodeWeapons() return true end function ply:GiveGamemodeWeapons() local n = self:Team() self:StripWeapons() for k, wep in pairs(JOBS[n].weapons) do self:Give(wep) end end [/CODE] Also, is there a way for me to have my jobs table in a separate file called "jobs.lua"? I tried to include() and AddCSLuaFile() but it wouldn't work D:
Temporary fix is to get the crashing client to unmount portal1/2. Real fix is something is breaking in your player_class. I've never been able to track down this issue for other people and I cant replicate it myself but if unmounting portal fixes it I'm willing to bet its something to do with your classes.
[QUOTE=mcd1992;46034027]Temporary fix is to get the crashing client to unmount portal1/2. Real fix is something is breaking in your player_class. I've never been able to track down this issue for other people and I cant replicate it myself but if unmounting portal fixes it I'm willing to bet its something to do with your classes.[/QUOTE] Is that so? I know that if you don't set a player model ( use the black gordon one ), it will crash on death.
[QUOTE=Robotboy655;46034321]Is that so? I know that if you don't set a player model ( use the black gordon one ), it will crash on death.[/QUOTE] Yep that's the one. And if you unmount portal you don't crash. This was a while ago, the 'coder' of some server I played on made some changes and then everyone was the black gordon model. Afterwards anyone with portal mounted would crash if a player died. No clue what he did in the code to make everyone black gordon but there was definitly a correlation between the two.
[QUOTE=Robotboy655;46034321]Is that so? I know that if you don't set a player model ( use the black gordon one ), it will crash on death.[/QUOTE] Thank you! You're awsome and you know it. [QUOTE]Also, is there a way for me to have my jobs table in a separate file called "jobs.lua"? I tried to include() and AddCSLuaFile() but it wouldn't work D:[/QUOTE]
I like how you take out the gamemode name like it's all secret but you can clearly see by the code it's either a role play or cops and robbers gamemode.
[QUOTE=AnonTakesOver;46037946]I like how you take out the gamemode name like it's all secret but you can clearly see by the code it's either a role play or cops and robbers gamemode.[/QUOTE] Shh! I would of thought this would give it away.. [CODE]JOBS = {}[/CODE]
Sorry, you need to Log In to post a reply to this thread.