01-08-2016, 03:06 AM
Quote:function DetectcPlayerByName(GivenName)
cRoot:Get():FindAndDoWithPlayer(GivenName,
function(a_Player)
if (a_Player:GetName() ~= GivenName) then
-- Callback is called for the player who matches the target playername the closest.
return false
end
-- Do stuff with the player
return(a_Player)
end
I've tried that to convert the string to a cPlayer, but the console says
Quote:LUA: Plugins/Sniper/main.lua~:86: error in function 'TakeDamage'.
argument #2 is 'number'; 'cEntity' expected.
Line 86 is
Quote:Entity:TakeDamage(dtArrow, DetectcPlayerByName(ShooterName), 18, ProjectileEntity:GetPosition())