Hello my fellow g-tards out there…
I am working on a gameMODe called “AIDS-Mod”. [I know this is a serious treat to many, begging you pardon, it is NOT meant to offend anyone!!]
I wanted to derive it from Fretta, but the VoteForChange menu wont show up. (f1/f2/f3/f4 wont do anything)
I tried starting via Fretta as overwrite, or directly; Deriving from Fretta or base; and I got two results when pressing F1:
- LUA error: [XXXX.lua]: attempt to call global ‘ShowHelp’ (a nil value) <-- Some like duh’
- Original GMOD Help (that flash-video-tutorial thingi)
When I derive from sandbox, neither ‘C’ nor ‘Q’ will bring up any menus, from which I conclude Deriving fails.
In both cases the console reads
registering gamemode fretta/sandbox derived from base
registering gamemode aidsmod derived from fretta/sandbox
CONSOLE SOMEWHAT IS DISABLED
registering gamemode aidsmod derived from base
after a “gamemode_reload”.
I even commented out all my custom code, same result.
My Files:
gamemodes/aidsmod/gamemode/init.lua
--SERVERSIDE--
AddCSLuaFile( "cl_init.lua" )
AddCSLuaFile( "shared.lua" )
AddCSLuaFile( "cl_hud.lua" )
include( "shared.lua" )
function CheckRoundEnd()
if ( !GAMEMODE:InRound() ) then return end
for k,v in pairs( team.GetPlayers( TEAM_HUMAN ) ) do
if v:Frags() >= 10 then
GM.RoundEndWithResult(ply, ply:GetName() .. " wins!")
end
end
end
function EntityTakeDamage( ent, inflictor, attacker, amount )
if ent:GetClass() == "entity_aids" and inflictor:GetClass() == "weapon_aidsbar" then
if attacker:GetNWBool( "HasAids" ) then
attacker:PrintMessage( HUD_PRINTCENTER, "You gave your aids to " .. ent:GetOwner():GetName() )
ent:GetOwner():PrintMessage( HUD_PRINTCENTER, "You were infected by " .. attacker:GetName() )
UnInfect( attacker )
Infect( ent:GetOwner() )
end
end
end
function OnRoundStart()
for k,v in pairs( player.GetAll() ) do
self:UnInfect( ply )
end
NewAids()
end
function GM:PlayerDeath( ply, inflictor, attacker )
if ply:GetNWBool( "HasAids" ) then
attacker:AddFrags(2)
NewAids()
end
end
function PlayerDisconnected( ply )
if ply:GetNWBool( "HasAids" ) then
NewAids()
end
end
function PlayerInitialSpawn( ply )
ply:SetNWInt( "AidsTime", 20 )
local ent=ents.Create( "entity_aids" )
Msg( "SPAWN ENTITY" )
ent:SetPos( ply:GetPos() + Vector( 0,0,132 ) )
ent:SetOwner( ply )
ent:SetParent( ply )
ent:Spawn()
return true
end
function PlayerShouldTakeDamage( victim, ply )
if ply:IsPlayer() then
if victim:GetNWInt( "AidsTime" ) != 0 then
return false
end
end
return true
end
local secondtick = 0
function Think()
if ( CurTime() >= secondtick ) then
for k,v in pairs( player.GetAll() ) do
if v:GetNWBool( "HasAids" ) then
if v:GetNWInt( "AidsTime" ) == 1 then
v:PrintMessage( HUD_PRINTCENTER, "You can now be hurt!" )
v.Trail = util.SpriteTrail(v, 0, Color(255,0,0), false, 15, 1, 3, 1/(15+1)*0.5, "trails/plasma.vmt")
end
if v:GetNWInt( "AidsTime" ) != 0 then
v:SetNWInt( "AidsTime", v:GetNWBool( "AidsTime" ) - 1 )
end
end
end
secondtick = CurTime() + 1
end
end
hook.Add( "CheckRoundEnd", "ACheckRoundEnd", CheckRoundEnd )
hook.Add( "EntityTakeDamage", "AEntityTakeDamage", EntityTakeDamage )
hook.Add( "OnRoundStart", "AOnRoundStart", OnRoundStart )
hook.Add( "PlayerDeath", "APlayerDeath", PlayerDeath )
hook.Add( "PlayerDisconnected", "APlayerDisconnected", PlayerDisconnected )
hook.Add( "PlayerInitialSpawn", "APlayerInitialSpawn", PlayerInitialSpawn )
hook.Add( "PlayerShouldTakeDamage", "APlayerShouldTakeDamage", PlayerShouldTakeDamage )
hook.Add( "Think", "AThink", Think )
---------
function NewAids()
players = player.GetAll()
aidzor = players[ math.random( #players ) ]
aidzor:PrintMessage( HUD_PRINTCENTER, "You were infected with aids!" )
Infect( aidzor )
end
function Infect( ply )
ply:SetNWBool( "HasAids", true )
end
function UnInfect( ply )
SafeRemoveEntity( ply.Trail )
ply:SetNWBool( "HasAids", false )
ply:SetNWInt( "AidsTime", 20 )
end
gamemodes/aidsmod/gamemode/shared.lua
GM.Name = "AIDS-Gamemode"
GM.Author = "[W33D|] S0lll0s"
GM.Email = "SMOArena@gmx.de"
GM.Website = "w33d-clan.cwsurf.de"
GM.Help = "People with aids try to infect others,
and get miraculosely healed when they transfer the Virus.
Dafuq?"
DeriveGamemode( "fretta" )
IncludePlayerClasses()
GM.Data = {}
function GM:Initialize()
self.BaseClass.Initialize( self )
end
GM.TeamBased = false
GM.AllowAutoTeam = true
GM.AllowSpectating = true
GM.SecondsBetweenTeamSwitches = 10
GM.GameLength = 15
GM.RoundLimit = 10
GM.VotingDelay = 10
GM.NoPlayerSuicide = false
GM.NoPlayerDamage = false
GM.NoPlayerSelfDamage = false
GM.NoPlayerTeamDamage = false
GM.NoPlayerPlayerDamage = false
GM.NoNonPlayerPlayerDamage = false
GM.NoPlayerFootsteps = false
GM.PlayerCanNoClip = false
GM.TakeFragOnSuicide = true
gamemodes/aidsmod/gamemode/cl_init.lua
--CLIENTSIDE--
include( "cl_hud.lua" )
gamemodes/aidsmod/gamemode/cl_hud.lua
--CLIENT HUD EXTENSION--
client = client or LocalPlayer()
local function HUDPaint()
draw.SimpleText( "3.2.1 TESTING" , "ScoreboardText", 100, 60, Color( 86, 104, 86, 255 ), 0, 0 )
draw.SimpleText( client:GetNWInt( "AidsTime" ) , "ScoreboardText", 100, 50, Color( 86, 104, 86, 255 ), 0, 0 )
end
hook.Add( "HUDPaint", "PaintOurHud", HUDPaint )
also the entities “entity_aids” (infact a red bathtub for testing) and the “weapon_aidsbar” (modified standard crowbar SWEP).
gamemodes/aidsmod/entities/entities/entity_aids/init.lua
AddCSLuaFile( "cl_init.lua" )
AddCSLuaFile( "shared.lua" )
include('shared.lua')
function ENT:Initialize()
self.Entity:SetModel( "models/props_interiors/BathTub01a.mdl" )
self.Entity:PhysicsInit( SOLID_VPHYSICS )
self.Entity:SetMoveType( MOVETYPE_FLY )
self.Entity:SetSolid( SOLID_VPHYSICS )
local phys = self.Entity:GetPhysicsObject()
if (phys:IsValid()) then
phys:Wake()
end
end
function ENT:Use( activator, caller )
activator:ChatPrint( "AIDS'D" )
end
function ENT:Think()
self.R = self.R or 0; -- if R is nil, make it 0
if( self.R >= 255 ) then
self.R = 0; -- reset R if it's over 255
end
self:SetColor( self.R, 0, 0, 255 ); -- actually set the color
self.R = self.R + 1; -- increment R
end
gamemodes/aidsmod/entities/entities/entity_aids/shared.lua
ENT.Type = "anim"
ENT.Base = "base_entity"
ENT.PrintName = "Lua Test"
ENT.Author = "Ich"
ENT.Contact = "Ne."
ENT.Category = "Lua Beispiele"
ENT.Purpose = "Beispiel SEnt"
ENT.Instructions = "Benutzen auf eigene Gefahr, nicht während Wintersaison benutzen, nicht in kleinen Räumen verwenden."
ENT.Spawnable = true
ENT.AdminSpawnable = true
gamemodes/aidsmod/entities/entities/entity_aids/cl_init.lua
include('shared.lua')
function ENT:Draw()
self.Entity:DrawModel()
end
I hope you can help me!