Hey! i'm trying to do some code and its not working :(
The srcds shows this:
.... atempted to call global 'AddChatCommand' ( a nil value)
...
...
It appears more msg's but i dont think that they are relevant, if there are please tell me.
[QUOTE]
function chatCommand( ply, text, public )
if(!ply:IsSuperAdmin()) then
ply:ChatPrint("Insufficient Permissions")
return
end
local ent = ents.Create("fuel_pump")
ent:SetPos(ply:FindPlayerTrace().HitPos)
ent:Spawn()
SaveFuelCarPositions()
ply:SendLua([[surface.PlaySound("UI/buttonclick.wav")]])
end
AddChatCommand("/spawnpump", function(ply)
local ent = ents.Create("fuel_pump")
ent:SetPos(ply:FindPlayerTrace().HitPos)
ent:Spawn()
SaveFuelCarPositions()
ply:SendLua([[surface.PlaySound("UI/buttonclick.wav")]])
end)[/QUOTE]
PS: I'm newbieww
It's not longer AddChatCommand, it's..
DarkRP.defineChatCommand.
For example, DarkRP.defineChatCommand("spawnpump", FunctionName)
[QUOTE=mib999;45397889]It's not longer AddChatCommand, it's..
DarkRP.defineChatCommand.
For example, DarkRP.defineChatCommand("spawnpump", FunctionName)[/QUOTE]
So it will be like this?
function chatCommand( ply, text, public )
if(!ply:IsSuperAdmin()) then
ply:ChatPrint("Insufficient Permissions")
return
end
local ent = ents.Create("fuel_pump")
ent:SetPos(ply:FindPlayerTrace().HitPos)
ent:Spawn()
SaveFuelCarPositions()
ply:SendLua([[surface.PlaySound("UI/buttonclick.wav")]])
end
DarkRP.defineChatCommand("/spawnpump", function(ply))
local ent = ents.Create("fuel_pump")
ent:SetPos(ply:FindPlayerTrace().HitPos)
ent:Spawn()
SaveFuelCarPositions()
ply:SendLua([[surface.PlaySound("UI/buttonclick.wav")]])
end)
"Unextpected symbol near ")" in the line of DarkRP.defineChatCommand("/spawnpump", function(ply))
...
PS: I tried this
[QUOTE]function chatCommand( ply, text, public )
if(!ply:IsSuperAdmin()) then
ply:ChatPrint("Insufficient Permissions")
return
end
local ent = ents.Create("fuel_pump")
ent:SetPos(ply:FindPlayerTrace().HitPos)
ent:Spawn()
SaveFuelCarPositions()
ply:SendLua([[surface.PlaySound("UI/buttonclick.wav")]])
end
DarkRP.defineChatCommand("/spawnpump", chatCommand)[/QUOTE]
But it showed:
Chat command is defined but not declareted
Sorry, you need to Log In to post a reply to this thread.