Jump to content

kick players with low screen resolution. (solved)


Fist

Recommended Posts

Can anyone tell me how to detect players resolution and if it's 800x600 or lower then it kicks them?

 

Edit: nvm you can do it by just using guiGetScreenSize i thought it was harder. ;d

Edited by Fist
Link to comment
  • Discord Moderators

So, you solved the problem? Btw here is my code

local x, y = guitGetScreenSize()
local lowY = 800
local lowX = 600

if x == lowX and y == lowY then
  kickPlayer(thePlayer, "Your screen resolution is too low!")
end

:

 

 

Link to comment
8 minutes ago, Pirulax said:

So, you solved the problem? Btw here is my code


local x, y = guitGetScreenSize()
local lowY = 800
local lowX = 600

if x == lowX and y == lowY then
  kickPlayer(thePlayer, "Your screen resolution is too low!")
end

:

 

 

Just to make it clear, that wouldn't work, you're mixing server/client functions. You'd have to ask the server to kick you using triggerServerEvent, also if the player had a resolution of 640x480 (yes, small resolution like that is possible), it wouldn't work.

Also, you mixed up your Xs and Ys, argh.. that code is just completely wrong :S

Edited by MIKI785
  • Like 1
Link to comment
  • Discord Moderators

Okey, i am very tired, so here is the edited code :D

---- Client
local y, x = guitGetScreenSize()
local lowY = 800
local lowX = 600

if x == lowX and y == lowY then
    triggerServerEvent("kickPlayerForLowRes", localPlayer, getLocalPlayer())
end

---- Server
addEvent("kickPlayerForLowRes", true)
addEventHandler("kickPlayerForLowRes", getRootElement(), function(thePlayer)
    kickPlayer(thePlayer, "Your screen resolution is too low!")
end)

 

Edited by Pirulax
Link to comment
function KickLow ()
	local x,y = guiGetScreenSize() 
	if ( x <= 800 ) and ( y <= 600 ) then
		triggerServerEvent("kickPlayerForLowRes", localPlayer, getLocalPlayer())
	end
end
addEventHandler ( "onClientPlayerJoin",root, KickLow )


---- Server
addEvent("kickPlayerForLowRes", true)
addEventHandler("kickPlayerForLowRes", getRootElement(),
function(thePlayer)
kickPlayer(thePlayer, "Your screen resolution is too low!")
end)

 

@Pirulax you're wrong tho

  • Like 1
Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...