TopAz Posted March 28, 2012 Posted March 28, 2012 Well, the title says it all. Please respond with useful post.
Kenix Posted March 28, 2012 Posted March 28, 2012 (edited) Use amx resource. But Better learn lua. viewtopic.php?f=148&t=40809 Edited March 29, 2012 by Guest
MTA Team qaisjp Posted March 29, 2012 MTA Team 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.
TopAz Posted March 29, 2012 Author 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.
drk Posted March 29, 2012 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.
MTA Team qaisjp Posted March 29, 2012 MTA Team 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.
TopAz Posted March 29, 2012 Author 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?
TopAz Posted March 29, 2012 Author Posted March 29, 2012 http://lua-users.org/wiki/SwitchStatement I have saw it already. An example code will be appreciated.
MTA Team qaisjp Posted March 30, 2012 MTA Team 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 )
Aibo Posted March 30, 2012 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.
TopAz Posted March 30, 2012 Author 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?
Alpha Posted March 30, 2012 Posted March 30, 2012 Which is why it won't match the values in the table, because they contain upper-case characters.
MTA Team qaisjp Posted March 30, 2012 MTA Team 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)
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