• FindPlayer returning a nil value
    34 replies, posted
You must be overriding the player library somewhere... [editline]03:51PM[/editline] or you haven't placed the function I gave you in the correct place.
is it the fact i am testing it in single player?
I doubt it.
jesus christ how can you be so fucking retarded Find player: [lua] function SethAdmin.PlayerFind( ply, target ) players = {} if not target then ply:ChatPrint("Please specify a player.") return; end for _, v in ipairs( player.GetAll()) do if string.find( string.lower( v:Nick() ), string.lower( target ) ) != nil then table.insert( players, v ) end end if #players >1 then ply:ChatPrint("Multiple targets found.") return nil elseif #players <1 then ply:ChatPrint("No players found.") return nil elseif #players == 1 then return players[1] end end [/lua] Example slay command: [lua] local Plugin = {} Plugin.Name = "Slay" Plugin.Verb = " slayed " Plugin.CC = "slay" function Plugin.Command( ply, cmd, args ) local plf = SethAdmin.PlayerFind( ply, args[1] ) if plf then plf:Kill() SethAdmin.Notify( ply, Plugin.Verb, plf ) end end SethAdmin.AddPlugin( Plugin ) [/lua] Just remove all the SethAdmin stuff, I can't be bothered to, and remove the notify bit.
ok, trying what you just posted [editline]05:14PM[/editline] ok, your thing doesn't kick me when i do the command then me but it doesnt give me an error [editline]05:16PM[/editline] Thanks, does work!!! do you want a copy?
Sorry, you need to Log In to post a reply to this thread.