Raimis_R Posted June 3, 2011 Share Posted June 3, 2011 Hello all i just looking around and learning lua and now i got problem with name check i whant to create function if player name it's "Player5345" then kick player from the server but when player connecting to the server he only spawning in the spawn point and my "NameCheck" function doesn't working Code : function prisijungimas() local x = 222.1 local y = 124.1 local z = 2.0 spawnPlayer(source, x, y, z) fadeCamera(source, true) setCameraTarget(source, source) outputChatBox("Hello " ..getPlayerName(source).. " Welcome To test server",source) end function checkdefaultname() local name = getPlayerName(source) if (name == "Player5345") then kickPlayer(source,"Bad Name") end end addEventHandler("onPlayerJoin",getRootElement(), prisijungimas,checkdefaultname) Link to comment
BriGhtx3 Posted June 3, 2011 Share Posted June 3, 2011 This should work : function checkname() local x = 222.1 local y = 124.1 local z = 2.0 local name = getPlayerName(source) if (name == "Player5345") then kickPlayer(source,"Bad Name") else spawnPlayer(source, x, y, z) fadeCamera(source, true) setCameraTarget(source, source) outputChatBox("Hello " ..getPlayerName(source).. " Welcome To test server",source) end end addEventHandler("onPlayerJoin",getRootElement(), checkname) Link to comment
Raimis_R Posted June 3, 2011 Author Share Posted June 3, 2011 Thanks but with this script then i connecting to the server i getting black screen and nothing else Link to comment
Aibo Posted June 3, 2011 Share Posted June 3, 2011 check your logs and ACL, probably your resource does not have access to kickPlayer function. Link to comment
Raimis_R Posted June 3, 2011 Author Share Posted June 3, 2011 Logs: [2011-06-04 11:01:25] JOIN: Player5345 joined the game (IP: 127.0.0.1)[2011-06-04 11:01:25] WARNING: rpgg\rpg.lua:9: Access denied @ 'kickPlayer' BTW i don't know what i need edit but maybe in the acl.xml \ \ and set Or not? Link to comment
BriGhtx3 Posted June 3, 2011 Share Posted June 3, 2011 (edited) Into Group "Admin" : <object name="resource.NAMEOFRESOURCE" /> <!-- I would prefer <object name="resource.*" /> because then you don't have to add each resource --> Edit : Changed Syntax Highlighting Edited June 3, 2011 by Guest Link to comment
Aibo Posted June 3, 2011 Share Posted June 3, 2011 BTW i don't know what i need edit but maybe in the acl.xml \ \ and set that edit would give access to kickPlayer to everyone and everything. you should add your rersource to some group (for example "Admin") that have the access to kickPlayer: <group name="Admin"> ... <object name="resource.yourResourceName" /> </group> Link to comment
Raimis_R Posted June 3, 2011 Author Share Posted June 3, 2011 Ok thank's guys but i don't understand why to group "Admin" Link to comment
BriGhtx3 Posted June 3, 2011 Share Posted June 3, 2011 Because your resource needs adminrights, to kick a player Link to comment
Aibo Posted June 3, 2011 Share Posted June 3, 2011 its just an example, you can add to any group that have access to kickPlayer. just see which group has and add your resource to that group. its just people tend to add resources in Admin group so they wont have any access restrictions. Link to comment
Raimis_R Posted June 3, 2011 Author Share Posted June 3, 2011 Okey thanks Aibo and xthepr0mise. Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now