Hi Guys, I am not really a coder more of a novice in lua and Need some help.
I have a large list of players that I want to check are on a server I'm playing on, So I'm trying to develop a clientside script to do this, so I can type in a console command and it will tell me if the players are on and the "reason". The table isn't mine and would take ages to reformat it and I've put what the table structure and my attempt at doing what I'm trying to do below.
This is all trying to be done completely clientside (DarkRP servers) so no interacting with the server whatsoever.
My idea was to add a console command which will loop through the players, check if their steamID is on the table and if it is print their "reason".
I am not really a coder and have just tried to take stuff from the gmod wiki and edit it, so please be easy.
[CODE]
concommand.Add ("check_for_ppl" ,function ()
for k, v in pairs(player.GetAll()) do
if table.HasValue( naughty, v) then
print( v:Nick() ) // I also want to print the reason here.
else continue end
end
end)
local GG = "Member of -----------"
local Snix = "Member of ---------"
local SK = "STEAM_0:"
local naughty = {
[SK.."1:3333333"] = "reason would go here",
[SK.."1:2222222"] = "reason would go here",
[SK.."1:1111111"] = "reason would go here",
}
[/CODE]
There's a lot more players on the list I've just put some examples of what it would be like, How would I go about reporting if those certain players are on the same server I get errors when trying to run this.
Thanks.
You can't do it completely clientside since player.GetAll only returns players in the PVS clietnside.
[QUOTE=code_gs;50380255]You can't do it completely clientside since player.GetAll only returns players in the PVS clietnside.[/QUOTE]
Are you sure? I've looked up what PVS is and it seems to be if the entity is visible?
That I don't understand because how to things like printing out the players names on a server still result in all the players names even if you aren't visible to them?
[CODE]for k, v in pairs(player.GetAll()) do
Msg( v:Nick() .. "\n")
end[/CODE]
This code seems to print out all the bots names on my test server, even if I'm not looking at them.
Either way is it still possible to do this for just visible players?
[QUOTE=code_gs;50380255]You can't do it completely clientside since player.GetAll only returns players in the PVS clietnside.[/QUOTE]
can you imagine how much shit wouldn't work if that were true
[QUOTE=StonedPenguin;50380320]can you imagine how much shit wouldn't work if that were true[/QUOTE]
You can only get their names and stuff, though. You can't invoke any methods that require them to be in the PVS.
Despite the PVS issues, Is this still possible to do at all? Could anyone give me some possible solutions please?
[CODE]local GG = "Member of -----------"
local Snix = "Member of ---------"
local SK = "STEAM_0:"
local naughty = {
[SK.."1:3333333"] = "reason would go here",
[SK.."1:2222222"] = "reason would go here",
[SK.."1:1111111"] = "reason would go here",
}
concommand.Add("check_for_ppl" ,function ()
for k, v in next, player.GetAll() do
if(naughty[v:SteamID()]) then
print( v:Nick(), naughty[v:SteamID()] ) // I also want to print the reason here.
else
continue
end
end
end)
[/CODE]
Why are you putting
[CODE]else continue end[/CODE]
?
There's no reason for it to be there beacouse it will automatically continue when that code finishes running.
Is this "list" you are trying to read by any chance SkidCheck?
Anyway, just do something like this
[CODE]
for k, v in pairs(player.GetHumans()) do -- No need to check bots
local steamid = v:SteamID()
local reason = naughty[steamid]
if not reason then continue end
print(reason)
end
[/CODE]
Using something like a halo wallhack reveals that you can still call functions and stuff on players not within your PVS, but they themselves don't render, which makes the halo around them stay in one spot and keep the same animation. Would it still be possible to create a dummy clientside model in their place and apply the position and animations from the player onto it (to add the halo on), or would that yield the same result?
Sorry, you need to Log In to post a reply to this thread.