TopAz Posted March 28, 2012 Share Posted March 28, 2012 Well, the title says it all. Please respond with useful post. Link to comment
Kenix Posted March 28, 2012 Share Posted March 28, 2012 (edited) Use amx resource. But Better learn lua. viewtopic.php?f=148&t=40809 Edited March 29, 2012 by Guest Link to comment
qaisjp Posted March 29, 2012 Share Posted March 29, 2012 It seems you are a new user, and have come from that other mod, well congratulations for joining this modification and welcome. Lua is much faster and doesn't require compiling, if you use the amx resource you are building a wall between the awesomeness and your server. I recommend you to learn Lua, you can ask questions here any time you feel like and take a look at the tutorials too. Link to comment
TopAz Posted March 29, 2012 Author Share Posted March 29, 2012 It seems you are a new user, and have come from that other mod, well congratulations for joining this modification and welcome. Lua is much faster and doesn't require compiling, if you use the amx resource you are building a wall between the awesomeness and your server. I recommend you to learn Lua, you can ask questions here any time you feel like and take a look at the tutorials too. I am a PAWN and C# programmer but Lua is not my type language. It's a very close language. Link to comment
drk Posted March 29, 2012 Share Posted March 29, 2012 Lua is flexible and easy to understand. If you know C# and Pawn, will be not hard for you to learn Lua. Link to comment
qaisjp Posted March 29, 2012 Share Posted March 29, 2012 We all need to learn new things TopAz, Pawn is a pile of wank, use Lua. Lua takes less than a minute to understand. Give Lua a chance. Link to comment
TopAz Posted March 29, 2012 Author Share Posted March 29, 2012 We all need to learn new things TopAz, Pawn is a pile of wank, use Lua.Lua takes less than a minute to understand. Give Lua a chance. Well is there any chance to use switch statement on LUA? Link to comment
Castillo Posted March 29, 2012 Share Posted March 29, 2012 http://lua-users.org/wiki/SwitchStatement Link to comment
TopAz Posted March 29, 2012 Author Share Posted March 29, 2012 http://lua-users.org/wiki/SwitchStatement I have saw it already. An example code will be appreciated. Link to comment
qaisjp Posted March 30, 2012 Share Posted March 30, 2012 local unacceptedNames = { ['Bill']=false, [ 'Sex']=true, ['Orange']=true, ['Kiwi']=true, ['Dora_the_explorer']=true, [ '41snakesolid']=true, [ 'lelee']=true addEventHandler( 'onPlayerJoin', root, function() if unacceptedNames[ string.lower( getPlayerName(source) ) ] then kickPlayer(source) end end) This gets the players name when he joins, puts it in lowercase, checks the array/table to see if it has an index with the name AND a value other than false. So if my name is Dora_the_explorer then I will be kicked. If my name is Bill, then i won't be kicked ( i dont see why i should put bill, but just to make you understand the table concept too ) Link to comment
TopAz Posted March 30, 2012 Author Share Posted March 30, 2012 Thank you very much Noddy! Link to comment
Aibo Posted March 30, 2012 Share Posted March 30, 2012 local unacceptedNames = { ['Bill']=false, [ 'Sex']=true, ['Orange']=true, ['Kiwi']=true, ['Dora_the_explorer']=true, [ '41snakesolid']=true, [ 'lelee']=true addEventHandler( 'onPlayerJoin', root, function() if unacceptedNames[ string.lower( getPlayerName(source) ) ] then kickPlayer(source) end end) This gets the players name when he joins, puts it in lowercase, checks the array/table to see if it has an index with the name AND a value other than false. So if my name is Dora_the_explorer then I will be kicked. If my name is Bill, then i won't be kicked ( i dont see why i should put bill, but just to make you understand the table concept too ) you wont be kicked with "Dora_the_explorer" name, because that table key has a capital letter. same with all other names, except the last 2. and the whole thing wont work anyway because you forgot to close the table constructor. Link to comment
TopAz Posted March 30, 2012 Author Share Posted March 30, 2012 local unacceptedNames = { ['Bill']=false, [ 'Sex']=true, ['Orange']=true, ['Kiwi']=true, ['Dora_the_explorer']=true, [ '41snakesolid']=true, [ 'lelee']=true addEventHandler( 'onPlayerJoin', root, function() if unacceptedNames[ string.lower( getPlayerName(source) ) ] then kickPlayer(source) end end) This gets the players name when he joins, puts it in lowercase, checks the array/table to see if it has an index with the name AND a value other than false. So if my name is Dora_the_explorer then I will be kicked. If my name is Bill, then i won't be kicked ( i dont see why i should put bill, but just to make you understand the table concept too ) you wont be kicked with "Dora_the_explorer" name, because that table key has a capital letter. same with all other names, except the last 2. and the whole thing wont work anyway because you forgot to close the table constructor. But wouldn't string.lower change all the character's casing? Link to comment
Alpha Posted March 30, 2012 Share Posted March 30, 2012 Which is why it won't match the values in the table, because they contain upper-case characters. Link to comment
qaisjp Posted March 30, 2012 Share Posted March 30, 2012 yes, sorry, do this; local unacceptedNames = { ['bill']=false, [ 'sex']=true, ['orange']=true, ['kiwi']=true, ['dora_the_explorer']=true, [ '41snakesolid']=true, [ 'lelee']=true } addEventHandler( 'onPlayerJoin', root, function() if unacceptedNames[ string.lower( getPlayerName(source) ) ] then kickPlayer(source) end end) 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