Hello. I'm currently expanding the emitter tool, and someone asked me to put the AR2's Muzzleflash. So using this list: [url]http://maurits.tv/data/garrysmod/wik...indexe14a.html[/url] I searched for it, but i couldn't find it
anyone happen to know the ar2 Muzzleflash Particle name that i can use with the Util.Effect script?
Thanks in advance
[QUOTE=hellguy;39380351]AWESOME! now if someone kill an innocent, with any weapon, I mean, it tells you who killed you (and if he was inno or T), it would be like this?[/QUOTE]
That is nearlly correct. But all you need is this:
[lua]hook.Add("PlayerDeath", "DeathInform", function(vic, wea, kill)
CustomMsg(vic, "You were killed by "..kill:Nick(),Color(255,0,0))
end)[/lua]
[QUOTE=Science;39380511]That is nearlly correct. But all you need is this:
[lua]hook.Add("PlayerDeath", "DeathInform", function(vic, wea, kill)
CustomMsg(vic, "You were killed by "..kill:Nick(),Color(255,0,0))
end)[/lua][/QUOTE]
great.. and how do I add a code that tells if hes a traitor or inno? thanks!
kill:Role() should return it I think.
I think the function is Player:GetRoleString()
Try implementing it, and get back to me, ill tell you if your correct.
I got a problem making a stopwatch in my gamemode{bhop}
Could anyone help me creating a normal timer?
This is all i have come up with :L
[code]
function GM:HUDPaint()
self.BaseClass:HUDPaint()
local person = LocalPlayer()
local ply = LocalPlayer()
local Health = LocalPlayer():Health()
st2 = (string.ToMinutesSecondsMilliseconds(string.Left(CurTime(), 9)))
draw.SimpleText(st2, "3", ScrW() / 1 - 100, ScrH() - 16, Color(255, 255, 255, 255),TEXT_ALIGN_LEFT)
end
[/code]
[B]EDIT:[/B]
Oh, how could you add velocity to your screen too?
i tried making cl_showpos 1 convars in very different ways but it didnt work
i also tried LocalPlayer:GetVelocity() which spammed console with module errors.
Hope someone could help me with this, i have been trying to figure it out for 2 days :\
It's LocalPlayer():GetVelocity() not LocalPlayer:GetVelocity() :)
I'm trying to rename trigger_hurt and this is what I have so far
[code]
language.Add("trigger_hurt","You Deserved it.")
[/code]
Is this all I need?
And Where would I put this?
lua/autorun/client/cl_language.lua
1. SWEP.Primary.Sound = Sound(")weapons/awp/awp1.wav")
2. SWEP.Primary.Sound = Sound("weapons/awp/awp1.wav")
Is there a difference between 1 and 2? if so what is it?
Does the ) make a difference/ point to a game?
It would look for a folder titled ")weapons" the first way. But yes there's a difference.
Since the awp sound is a CSS weapon sound and is in "weapons/awp/awp1.wav" should i just remove the ) then?
EDITED^
ent:SetRenderGroup( RENDERMODE_TRANSALPHA ) makes my entities not able to be used.
For example, I've placed an invisible fountain on the spawn fountain in rp_downtown_v4c, and as soon as I apply (RENDERMODE_TRANSALPHA) the prop becomes invisible, but unfortunately I can't press use on the entity, when I take OFF the SetRenderGroup, it becomes normal coloured and the alpha won't change, how come it changes my ability to operate the entity when I change the RenderGroup?
[QUOTE=Pandaman09;39383191]Since the awp sound is a CSS weapon sound and is in "weapons/awp/awp1.wav" should i just remove the ) then?
EDITED^[/QUOTE]
yes
[QUOTE=fairy;39383663]yes[/QUOTE]
thanks
Hello, im having a proplem with this console command:
[LUA]
function BuyVehicle( ply, command, arguments )
if arguments == "jeep" then
local car = ents.Create( "Jeep" )
car:SetPos( Vector( -2629, 2304, 139 ) )
car:Spawn()
chat.AddText(Color(255,255,128), "Merchant: ",Color(255,255,255), "Welcome to my shop, how can I help you?" )
GAMEMODE:Notify(ply, 1, 4, "You've bought a jeep!");
else chat.AddText(Color(255,255,128), "Merchant: ",Color(255,255,255), "Welcome to my shop, how can I help you?" );
end
end
concommand.Add("buycar", BuyVehicle)
[/LUA]
The chat.add's are for debuging,.
whats wrong with it ?
-snip-
[QUOTE=Gravity_;39384534]ents.Create( "Jeep" ) should be ents.Create( "vehicle_jeep" )[/QUOTE]
It keeps saying Unknown command when i attempt to run it , idk why
Does anyone have any pre-made functions for getting the average from a table? For example if I have a table with only integer values, how would I get the average of the integers inside of it?
I'm bad at math.
[QUOTE=fairy;39384654]Does anyone have any pre-made functions for getting the average from a table? For example if I have a table with only integer values, how would I get the average of the integers inside of it?
I'm bad at math.[/QUOTE]
Basic average is = (Value1 + value2 +etc ... )/#of Vaues
[QUOTE=havejack;39384688]Basic average is = (Value1 + value2 +etc ... )/#of Vaues[/QUOTE]
Could I do something like
(table.unpack(tbl))/table.Count(tbl)
?
[QUOTE=fairy;39384723]Could I do something like
(table.unpack(tbl))/table.Count(tbl)
?[/QUOTE]
[lua]local function GetTableAverage( tbl )
local total, count = 0,0
for _,v in pairs(tbl) do
if type(v)=="number" then
total = total+v
count = count+1
end
end
return (total/count)
end[/lua]
Ok Heres the new working code but gives me this error:
[LUA] local function BuyCar( ply, args, args2 )
if not args2[1] or args2[1] == "" then return "" end
if args2[1] == "jeep" then
local car = ents.Create( "jeep" )
car:SetPos( Vector( -2629, 2304, 139 ) )
car:Spawn()
chat.AddText(Color(255,255,128), "Merchant: ",Color(255,255,255), "Welcome to my shop, how can I help you?" )
GAMEMODE:Notify(ply, 1, 4, "You've bought a jeep!");
else
chat.AddText(Color(255,255,128), "Merchant: ",Color(255,255,255), "Failed" )
end
end
concommand.Add( "rp_buycar", BuyCar)
[/LUA]
/npc_car/cl_init.lua:43: attempt to call field 'Create' (a nil value)
1. unknown - gamemodes/darkrp/entities/entities/npc_car/cl_init.lua:43
2. unknown - l
Hello guys, im new to the forums, i consider myself a lua noob soo im asking your help to create a boolean console command, im trying to make a console command like: example_isallowed [Boolean value]
But i dont know how to make it, i just know to create a function and register a command, but i have no idea how to add the parameter [boolean value]
[QUOTE=Mecha;39385109]Hello guys, im new to the forums, i consider myself a lua noob soo im asking your help to create a boolean console command, im trying to make a console command like: example_isallowed [Boolean value]
But i dont know how to make it, i just know to create a function and register a command, but i have no idea how to add the parameter [boolean value][/QUOTE]
[url]http://maurits.tv/data/garrysmod/wiki/wiki.garrysmod.com/index142b.html[/url]
[QUOTE=Hyper Iguana;39385146][url]http://maurits.tv/data/garrysmod/wiki/wiki.garrysmod.com/index142b.html[/url][/QUOTE]
Yep, Thank you
No help for me :(
EDIT:
Here are all the files:
init.lua:
[LUA]AddCSLuaFile( "cl_init.lua" )
AddCSLuaFile( "shared.lua" )
include('shared.lua')
function ENT:Initialize( )
self:SetModel( "models/humans/group01/female_01.mdl" )
self:SetHullType( HULL_HUMAN )
self:SetHullSizeNormal( )
self:SetNPCState( NPC_STATE_SCRIPT )
self:SetSolid( SOLID_BBOX )
self:CapabilitiesAdd( CAP_ANIMATEDFACE or CAP_TURN_HEAD )
self:SetUseType( SIMPLE_USE )
self:DropToFloor()
self:SetMaxYawSpeed( 90 ) --Sets the angle by which an NPC can rotate at once.
end
function ENT:OnTakeDamage()
return false -- This NPC won't take damage from anything.
end
function ENT:AcceptInput( Name, Activator, Caller )
if Name == "Use" and Caller:IsPlayer() then
umsg.Start("ShopNPCUsed", Caller)
umsg.End()
end
end
function ENT:createGun()
local gun = ents.Create("Jeep")
gun = ents.Create("Jeep")
gun:SetPos(Vector( -2629, 2304, 139 ))
gun:Spawn()
end
function BuyCar( ply, args, args2 )
if not args2[1] or args2[1] == "" then return "" end
if args2[1] == "jeep" then
createGun()
else
chat.AddText(Color(255,255,128), "Merchant: ",Color(255,255,255), "Failed" )
end
end
concommand.Add( "rp_buycar", BuyCar)
[/LUA]
cl_init.lua:
[LUA]
include("shared.lua")
function NPCShopMenu()
-- Small derma panel just for the example.
local pShop = vgui.Create("DFrame")
pShop:SetSize(500, 510)
pShop:Center()
pShop:SetTitle("Car Shop!")
pShop:SetSizable(true)
pShop:SetDeleteOnClose(false)
pShop:MakePopup()
pShop:SetSkin("DarkRP")
local WepCat = vgui.Create("DCollapsibleCategory", pShop)
WepCat:SetLabel("Cars")
WepCat:SetSize(500,900)
WepCat:SetPos(1,25)
local WepPanel = vgui.Create("DPanelList")
WepPanel:SetSize(470, 100)
WepPanel:SetAutoSize(true)
WepPanel:SetSpacing(1)
WepPanel:EnableHorizontal(true)
WepPanel:EnableVerticalScrollbar(true)
local function AddIcon(Model, description, command)
local icon = vgui.Create("SpawnIcon")
icon:InvalidateLayout( true )
icon:SetModel(Model)
icon:SetSize(64, 64)
icon:SetToolTip(description)
icon.DoClick = function() LocalPlayer():ConCommand("say "..command) end
WepPanel:AddItem(icon)
end
AddIcon("models/buggy.mdl","Jeep","hi")
WepCat:SetContents(WepPanel)
end
usermessage.Hook("ShopNPCUsed", NPCShopMenu)
[/LUA]
Shared.lua:
[LUA]
ENT.Base = "base_ai"
ENT.Type = "ai"
ENT.AutomaticFrameAdvance = true
function ENT:SetAutomaticFrameAdvance( bUsingAnim )
self.AutomaticFrameAdvance = bUsingAnim
end
[/LUA]
[QUOTE=havejack;39385246]No help for me :(
EDIT:
Here are all the files:
[code]alot of lua[/code][/QUOTE]
Unless you made your own entity called "Jeep", you should be using vehicle_jeep, as that is the default hl2 jeep.
I'm having a bit of trouble saving users information to a database upon the player disconnecting.
The save function works like a charm, how ever when used in the hook GM:PlayerDisconnected, the user is removed from the server before it has a chance to run the query.
How can I fix this?
[lua]
function checkConnection()
stat = db:status()
if stat == mysqloo.DATABASE_NOT_CONNECTED then
print("-------------------------------------")
print("Not connected, reconnecting now...")
print("-------------------------------------")
db:connect();
else
print("-------------------------------------")
print("Connection already established.")
print("-------------------------------------")
end
end
function savePlayerData(ply)
checkConnection()
local query1 = db:query("SELECT * FROM Users WHERE steamID='"..ply:SteamID().."';");
query1.onSuccess = function(q)
local query2 = db:query("UPDATE Users SET money='"..ply:GetMoney().."' WHERE steamID ='"..ply:SteamID().."';");
query2.onSuccess = function(q) print("Saved money: $"..ply:GetMoney()); end
query2.onError = function(err) print("Problem saving money: ", err); end
query2:start();
local query3 = db:query("UPDATE Users SET points='"..ply:GetNWInt("Points").."' WHERE steamID ='"..ply:SteamID().."';");
query3.onSuccess = function(q) print("Saved points: "..ply:GetNWInt("Points")); end
query3.onError = function(err) print("Problem saving points: ", err); end
query3:start();
local query4 = db:query("UPDATE Users SET ip='"..ply:IPAddress().."' WHERE steamID ='"..ply:SteamID().."';");
query4.onSuccess = function(q) print("Saved IP: "..ply:IPAddress()); end
query4.onError = function(err) print("Problem saving IP: ", err); end
query4:start();
end
query1.onError = function(q, err, sql)
print("Saving player data failed: ", err);
checkConnection();
end
query1:start();
query1:wait();
end
[/lua]
I've been trying to make a [B]clientside[/B] command where I can activate a console command with a chat command. Let me show you what I mean:
[CODE]test_chicken pizza [/CODE]
How can I make it so I can type !testcommand chicken pizza and then my chosen first half of the console command runs (chosenfirsthalfconsolecommand)_chicken pizza
Thanks for any help, hope this made sense.
Sorry, you need to Log In to post a reply to this thread.