some scripting questions
Hi all!
I am new in amxmodx scripting and I don't know a lot about it.So, I have some question about some the scripting?
|
Re: some scripting questions
1. http://forums.alliedmods.net/showthread.php?t=140103
2. http://forums.alliedmods.net/showthread.php?t=90507 3. lvl and cid are parameters that contain information from the function registering. They should be used in combination with cmd_acess() found in amxmisc.inc. level is used to determine if you have access to the command. A better way than just using "flags & ADMIN_FLAG". cid stands for command id, it's used in various functions that are rarely used. In cmd_acess it's used to retreive the fourth parameter used when registering the command. If the number of arguments fewer than defined in cmd_access() it will display this string as a guide on how the command should be used. 4. Check out the .inc-files included in the default AMXX package. They supply a lot of information. There was an online function but it's broken as it doesn't show all functions. 5. Personal preference. sz basically stands for "string zero" which could be translated into "string of characters terminated by null(zero)". This is how strings in pawn works. Functions loop strings until it hits 0(null). It doesn't mean you have to use sz as a prefix. In pawn there are only 3 types of variables. Integer, float and boolean. Integers hold one integer value (I don't know the range of it). Float holds a decimal number. Boolean holds only true or false. An array is basically just a row of any of the 3 above. Strings are integer arrays with the exception of leaving the last cell unused for the null-termination. In other programming languages there are a lot more variable types to keep track of. Using these prefixes will make it easier to look into larger functions without going back and forth to check what the variable was initialized as. 6. These are placeholders to be replaced with a number/string or float. %d or %i is used to display an integer. %f is used to display a float. %s is used to display a string. %c is used to display a character. They are used like this: Code:
When printing floats you will get 6 decimals. You can limit this using %.2f for example. This will only print 2 decimals. You can limit strings in the same way. 7. I'm not following. What do you mean by function flags? 8. They look like flags used to filter a player menu. I can't find them in my includes, might be specific to a certain plugin. 9. SteamID. There is better information to be found on most subjects here. Search and you will find. |
Re: some scripting questions
Quote:
|
Re: some scripting questions
Quote:
Code:
if ( ( iPlayer = find_player("k", str_to_num( szUserId) )And 2 new question:
Code:
for ( --iNum; iNum >= 0; iNum--)Quote:
|
Re: some scripting questions
1. In this case it finds a player by his/her #userid
PHP Code:
2. 'a' is used as a character. Strings are composed from characters too, but here it is only one, so it isn't needed to make a whole array. 3. That's a loop using the get_players native for finding players and executing something on them. iNum is the number of total players. In this loop, it starts as iNum-1 and continues to decrease till it reaches zero (If the players are 6, it will start from 5 and go down to 0). Then the corresponding player index from the iPlayers array is saved in iPlayer variable for more convinient work. It's also common to see this loop using another variable, like this): PHP Code:
..But the code you showed is more efficient (better to use), because it uses directly the iNum variable, instead of making a new one. 4. Hungarian notation is something that some scripters use to make their code look more readable for them and other people. You can find more info about it here: http://forums.alliedmods.net/showthread.php?t=85274 (section "Global Variables and Type Prefixing") |
Re: some scripting questions
Thank you!
what editor do you use? , how do you put colored codes in the posts?:? And what does this error means when compiling:"loosed indentation"? |
Re: some scripting questions
1. AMXX Studio, doesn't really matter actually
2. [PHP][ /PHP] bb code 3. It means that the code isn't properly indented. On some line you have more/less spaces in front of it, differently to the previous one. It's not something serious. |
Re: some scripting questions
thanks!
I write a code in AMXX Studio and copy it and paste it in forum.But it looses it's properties.So, what can I do? |
Re: some scripting questions
Quote:
|
Re: some scripting questions
Quote:
Example: PHP Code:
|
| All times are GMT -4. The time now is 19:13. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.