Some things I wonder about.
Hello there, I am in the intro tutorial but I didn't understand this
PHP Code:
PHP Code:
2nd thing PHP Code:
also this one PHP Code:
|
Re: Some things I wonder about.
2nd thing: the 23 and 3 are charsmaxes from the arrays you've declared.
For example, you have Arg1[24], Arg2[4] read_argv(1, Arg1, charsmax(Arg1)) read_argv(2, Arg2, charsmax(Arg2)) This would just be the same 3rd thing, It's very hard to explain, but how much players can there be max in a server? 32, how many characters can a STEAM ID have? This is still being complained about, but it's just the size of the array you want it to be. |
Re: Some things I wonder about.
Quote:
Quote:
Quote:
The last argument in the function(s) (23, 3) are the len. Len is max characters that can be stored in Arg1, Arg2. Just to make sure you understood, PHP Code:
Quote:
Player index ranges from 1 to 32 (Thats why we created an array with 32 rows), but when you use this PHP Code:
PHP Code:
Let's say that there were 3 players connected, and players[32] was like this PHP Code:
players are shifted automatically to fill the empty index so players[32] will be like this: PHP Code:
I too at the first didn't understand much about indexes, but then I started reading and testing till I understood it. I think you should do that too. Hopefully, you understood everything. Regards. EDIT: LOOOOL! After I wrote all this post, I looked in the forum just to waste sometime, then I found this: http://forums.alliedmods.net/showthread.php?t=181629 My idea about indexes was just a thought, I only understood it from get_players as I got confused in it, but it turned out that my thought is true! LOL! PS: Only read the top of that post, you will get confused about other things. |
Re: Some things I wonder about.
I think I've understood about player indexes, so we need to put it [32] always to avoid mixing up with their numbers
|
Re: Some things I wonder about.
Each cell may store a value.
PHP Code:
If you want to use the cells from 1 to 32 inclusive, you have to define 33 cells. |
Re: Some things I wonder about.
Quote:
PHP Code:
PHP Code:
|
Re: Some things I wonder about.
Note that if he uses get_maxplayers(), he should use it like that:
PHP Code:
|
Re: Some things I wonder about.
Quote:
HTML Code:
(Index out of bounds) |
Re: Some things I wonder about.
Quote:
With the other method, on each iteration you need to check if the player is connected, which is bad for performances. Also get_players lets you add the "a" flag to retrieve only alive player that improve performances in the same way that having to put is_user_alive on each iteration. |
Re: Some things I wonder about.
Connor what I have meant was if he wants to use get_maxplayers, he should put 1 for starting value, I didn't mean he should use get_maxplayers.
|
| All times are GMT -4. The time now is 05:42. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.