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-22-2012 , 05:05   Re: Some things I wonder about.
Reply With Quote #6

Quote:
Originally Posted by Moody92 View Post
I think I've understood about player indexes, so we need to put it [32] always to avoid mixing up with their numbers
PHP Code:
// As I said before, player indexes ranges from 1 two 32
// Lets say you made a new array with 32 rows
new iArray[32]
// and id = 32
// Now if you did this it will give you an error (Index out of bounds)
iArray[id] = 5
server_print
("%d"iArray[id])// And this function won't work
// What happened here that it gave an error because there is no such a row with the number 32 in Array
// Arrays ranges from 0 to (Whatever you assign the array with) - 1


// So to make it correct, you must declare the array with 33 rows (last row is 32)
new iArray[33]
iArray[id] = 5
server_print
("%d"iArray[id])    // This would print in server console 5 
You just declare the array (that you are going to use with get_players) with 32 rows, because that's how the function works
PHP Code:
new players[32], count
get_players
(playerscount)

/* 
if count == 5
Then players will look like this
players[0] = 1
players[1] = 2
players[2] = 3
players[3] = 4
players[4] = 5
*/ 
__________________
اَشْهَدُ اَنْ لَّآ اِلٰهَ اِلَّا اللہُ وَحْدَه لَا شَرِيْكَ لَه وَ اَشْهَدُ اَنَّ مُحَمَّدًا عَبْدُه وَرَسُوْلُه
No longer active in AMXX. Sorry.

Last edited by pokemonmaster; 08-22-2012 at 05:11.
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