Raised This Month: $ Target: $400
 0% 

Some things I wonder about.


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
pokemonmaster
princess milk
Join Date: Nov 2010
Location: Somewhere in this world
Old 08-21-2012 , 18:38   Re: Some things I wonder about.
Reply With Quote #3

Quote:
Originally Posted by Moody92 View Post
Hello there, I am in the intro tutorial but I didn't understand this

First thing is
PHP Code:
return PLUGIN_HANDLED 
why did he used PLUGIN_HANDLED exactly. and what if I put it without return PLUGIN_HANDLED, or retrun PLUGIN_CONTINUE or even return % what will happen ?
Quote:
Originally Posted by wiki.alliedmods.net
PLUGIN_CONTINUE generally means "continue with normal operation", and PLUGIN_HANDLED means "block further operation". The differences are subtle but important. For example, when binding a command, you should never return PLUGIN_CONTINUE. But if you return PLUGIN_HANDLED while binding to the "say" command, it will block the player's text from ever appearing.
So clearly, he used return PLUGIN_HANDLED to block any further functions from working (Stop the command from working to make it simpler)

Quote:
Originally Posted by Moody92 View Post
2nd thing
PHP Code:
     read_argv(1Arg123)
     
read_argv(2Arg23
I realize the number 1,2 the arguments number but which I didn't understand is 23,3 I think they're the ID of the operation but how to get the id or it should be specific numbers depends on the operation ?
Actully, your wrong.
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:
new szString1[35]     // Here, max characters that can be stored 34, but len can be 1,2,3,4,5,6,7.......34
// So,
charsmax(szString// == 34 
Quote:
Originally Posted by Moody92 View Post
also this one
PHP Code:
          new players[32], num 
What is 32 ? I saw in many threads that It's player index id, but what is player index id ?
Player index is the player's unique id, defined by amxx or half life engine (I don't really know).
Player index ranges from 1 to 32 (Thats why we created an array with 32 rows), but when you use this
PHP Code:
get_players(playersnum
All players indexes will be stored in players like this: (BTW, count is the number of the players)
PHP Code:
// You need to read arrays to understand this

// If count == 5  (Note that == is used for checking, = is used for assigning)
players[0] = 1
players
[1] = 2
players
[2] = 3
players
[3] = 4
players
[4] = 5

// If count == 10 (Players connected are 10)
players[0] = 1
players
[1] = 2
players
[2] = 3
players
[3] = 4
players
[4] = 5
players
[5] = 6
players
[6] = 7
players
[7] = 8
players
[8] = 9
players
[9] = 10
// Etc 
Also, as I know, ids (Players indexes) are assigned depending on who connects first, so if the server had 0 players, and you connected, players count will change to 1, also your index will be 1

Let's say that there were 3 players connected, and players[32] was like this
PHP Code:
players[0] = 1      // Player 1
players[1] = 2      // Player 2
players[2] = 3      // Player 3 
And then suddenly, player with index 2 has disconnected, so who will get index 2?
players are shifted automatically to fill the empty index
so players[32] will be like this:
PHP Code:
players[0] = 1      // Player 1
players[1] = 2      // Player 3 
That's all.

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.
__________________
اَشْهَدُ اَنْ لَّآ اِلٰهَ اِلَّا اللہُ وَحْدَه لَا شَرِيْكَ لَه وَ اَشْهَدُ اَنَّ مُحَمَّدًا عَبْدُه وَرَسُوْلُه
No longer active in AMXX. Sorry.

Last edited by pokemonmaster; 08-21-2012 at 18:53.
pokemonmaster is offline
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 05:42.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode