[code]function GM.GetPos()
if(p) then if(!p:IsSuperAdmin()) then return end end
file.Write("pos.txt", "")
local posvec = string.gsub(tostring(v:GetPos()), " ", ", ");
local angvec = string.gsub(tostring(v:GetAngles()), " ", ", ");
if file.Exists("pos.txt") then
filex.Append("pos.txt", "GAMEMODE.Pos(Vector(" .. posvec .."), Angle(" .. angvec .. "), '" .. tostring(v:GetModel()) .."');\n")
end
end
end
concommand.Add('pos', GM.GetPos);
[/code]
I currently have this... but it doesnt wanna work... Whats wrong? No errors are returned.
May not be all the problems but you have "then return end end" in your first if statement, fix that.
removed it, still broken, even more broken than before, now the concommand doesnt work at all.
[editline]31st October 2010[/editline]
[code]attempt to concatenate local 'ang' (a userdata value)[/code]
Line 98 [code] filex.Append("pos.txt", "GAMEMODE.Pumpkins(Vector(" .. pos .."), Angle(" .. ang .. "));\n")[/code]
local function GetPosofBlackman(player, command, blackman)
if !player:IsSuperAdmin() then return end
player:SendLua("print('Position: " .. tostring(player:GetPos()) .. " Angle: " .. tostring(player:GetAngles()) .. "'");
end
concommand.Add('pos', GetPosofBlackman);
It'l do what the 'getpos' command does. lol
The p variable is not defined. The first line should be
function GM.GetPos(p)
That way the first statement wont be returning false every time because the player is a nil value.
And also, your code seems to have alot of redundant functions, for example it is writing a file then checking if it exists, and the first two if statements can be combined into one.
if p and !p:IsSuperAdmin() then
return
end
and add this befor line 98.
[lua]
ang = ang or player.GetAngle
filex.Append("pos.txt", "GAMEMODE.Pumpkins(Vector(" .. pos .."), Angle(" .. ang .. "));
[/lua]
Ignore dingusnin
You need to use tostring() on your ang/vec variables to turn them into a string before concatenating them
Cubar, You should really stop rating everybody dumb. Its really immature, let alone your already immature.
[QUOTE=mikeym;25856123]Cubar, You should really stop rating everybody dumb. Its really [b]immature[/b], let alone your already [b]immature[/b].[/QUOTE]
So is caring about ratings.
:X
not overv!
:X
I gaveup a long time ago after overv refused to help me :X
[QUOTE=Overv;25856583]So is caring about ratings.[/QUOTE]
you're not cool
Sorry, you need to Log In to post a reply to this thread.