Raised This Month: $32 Target: $400
 8% 

Weapons War v7.5 (26 Weapons)


Post New Thread Reply   
 
Thread Tools Display Modes
zmd94
Veteran Member
Join Date: Nov 2013
Location: Malaysia (9w2zow).
Old 01-24-2017 , 09:06   Re: Weapons War v7.4 (26 Weapons)
Reply With Quote #271

Welcome.
zmd94 is offline
Kotoamatsukami
Member
Join Date: Jan 2017
Location: Malaysia
Old 01-26-2017 , 10:53   Re: Weapons War v7.4 (26 Weapons)
Reply With Quote #272

PHP Code:
for(0iPlayerCounti++)
        {
            
id iPlayers[i
Pardon, curious on something here.
The above code, isn't this re-indexing? I though you can just use the 'i' as the index instead?
Kotoamatsukami is offline
addons_zz
Veteran Member
Join Date: Aug 2015
Location: Dreams, zz
Old 01-26-2017 , 12:16   Re: Weapons War v7.4 (26 Weapons)
Reply With Quote #273

No, on the above code there are no re-indexing. On the above code you cannot refer to the players by the index on the `i` variable, because:
  1. the players ids are from 1 until 32.
  2. the playersCount can low as 10.
For example, on the server there are 10 players with the id's 4, 31, 23, 1, 3, 9, 5, 15, 19, 22.
And doing a loop from 0 until 10 will:
  1. get the invalid players 2, 6, 7, 8
  2. and not get the valid players 31, 23, 22, 19, 15, 23

When we do get_players( players, playersCount ), we:
  1. get an array within the 4, 31, 23, 1, 3, 9, 5, 15, 19, 22.
  2. And doing a loop on that array from 0 until 10 accessing each array's index we got all the valid players we want to, because the get_players( players, playersCount ) will fill the array within the valid ids 4, 31, 23, 1, 3, 9, 5, 15, 19, 22.

This is re-indexing:
Code:
for(i = 0; i < iPlayerCount; i++)     {         // accessing the same array position more than one time.         client_print( iPlayers[i], print_chat, "Hi1" );         client_print( iPlayers[i], print_chat, "Hi2" );     }
This is not re-indexing:
Code:
new id; for(i = 0; i < iPlayerCount; i++)     {         id = iPlayers[i];         // not accessing the same array position more than one time.         client_print( id, print_chat, "Hi1" );         client_print( id, print_chat, "Hi2" );     }

More low code about why the reindexing is happening:
Code:
for(i = 0; i < iPlayerCount; i++)     {         // re-indexing come from the fact where each time you access         // an array index, the computer has to to a sum before it.         client_print( (iPlayers + i), print_chat, "Hi1" );         client_print( (iPlayers + i), print_chat, "Hi2" );         // (iPlayers + i) <-- this is not a valid code, just for illustrate the sum the computer is doing behind the scenes.     }
-->
Code:
new id; for(i = 0; i < iPlayerCount; i++)     {         // caching the value, we only do this sum one time.         id = (iPlayers + i);         client_print( id, print_chat, "Hi1" );         client_print( id, print_chat, "Hi2" );         // (iPlayers + i) <-- this is not a valid code, just for illustrate the sum the computer is doing behind the scenes.     }

For more details see: https://wiki.alliedmods.net/Optimizing_Plugins_(AMX_Mod_X_Scripting)#Don. 27t_Re-index_Arrays
__________________
Plugin: Sublime Text - ITE , Galileo
Multi-Mod: Manager / Plugin / Server

Support me on Patreon, Ko-fi, Liberapay or Open Collective

Last edited by addons_zz; 01-26-2017 at 14:39.
addons_zz is offline
Kotoamatsukami
Member
Join Date: Jan 2017
Location: Malaysia
Old 01-26-2017 , 13:18   Re: Weapons War v7.4 (26 Weapons)
Reply With Quote #274

Quote:
Originally Posted by addons_zz View Post
No, on the above code there are no re-indexing. On the above code you cannot refer to the players by the index on the `i` variable, because:
  1. the players ids are from 1 until 32.
  2. the playersCount can low as 10.
For example, on the server there are 10 players with the id's 4, 31, 23, 1, 3, 9, 5, 15, 19, 22.
And doing a loop from 0 until 10 will:
  1. get the invalid players 2, 6, 7, 8
  2. and not get the valid players 31, 23, 22, 19, 15, 23

When we do get_players( players, playersCount ), we:
  1. get an array within the 4, 31, 23, 1, 3, 9, 5, 15, 19, 22.
  2. And doing a loop on that array from 0 until 10 accessing each array's index we got all the valid players we want to, because the get_players( players, playersCount ) will fill the array within the valid ids 4, 31, 23, 1, 3, 9, 5, 15, 19, 22.

This is re-indexing:
Code:
for(i = 0; i < iPlayerCount; i++)     {         // accessing the same array position more than one time.         client_print( iPlayers[i], print_chat, "Hi1" );         client_print( iPlayers[i], print_chat, "Hi2" );     }
This is not re-indexing:
Code:
new id; for(i = 0; i < iPlayerCount; i++)     {         id = iPlayers[i];         // not accessing the same array position more than one time.         client_print( id, print_chat, "Hi1" );         client_print( id, print_chat, "Hi2" );     }

More low code about why the reindexing is happening:
Code:
for(i = 0; i < iPlayerCount; i++)     {         // re-indexing come from the fact where each time you access         // an array index, the computer has to to a sum before it.         client_print( (iPlayers + i) , print_chat, "Hi1" );         client_print( (iPlayers + i), print_chat, "Hi2" );         // (iPlayers + i) <-- this is not a valid code, just for illustrate the sum the computer is doing behind the scenes.     }
-->
new id;
Code:
for(i = 0; i < iPlayerCount; i++)     {         // caching the value, we only do this sum one time.         id = (iPlayers + i);         client_print( id, print_chat, "Hi1" );         client_print( id, print_chat, "Hi2" );         // (iPlayers + i) <-- this is not a valid code, just for illustrate the sum the computer is doing behind the scenes.     }

For more details see: https://wiki.alliedmods.net/Optimizing_Plugins_(AMX_Mod_X_Scripting)#Don. 27t_Re-index_Arrays
That was marvelous!
Understood, sir. Thank you.
Kotoamatsukami is offline
Old 02-20-2017, 23:34
instinctpt1
This message has been deleted by instinctpt1. Reason: fixed !!
instinctpt1
Senior Member
Join Date: Dec 2016
Location: Chandigarh, India
Old 03-12-2017 , 13:01   Re: Weapons War v7.4 (26 Weapons)
Reply With Quote #275

A Serious Bug please Fix ...

When a War is going on ; if someone connects in between to server he can get random guns regardless of SPecial War which is going on and also VIP plugin also interupts this plugin bcoz of VIP menu opened on Player's Screen ====> Like a Admin Started SPR then all will get that GUN , but VIP menu is still open on VIP's Screen then they will select desired GUN from VIP menu and hence then can overpass Special Round (SPR) and disturbs whole Server ||

But its not the case with knife .. Knife Works PERFECTLY !! ( Both problems are not there in Knife )
instinctpt1 is offline
zmd94
Veteran Member
Join Date: Nov 2013
Location: Malaysia (9w2zow).
Old 03-16-2017 , 21:01   Re: Weapons War v7.4 (26 Weapons)
Reply With Quote #276

Really appreciate your report, Instinctpt. Yet, I just want more comfirmation.

Although, player can get other gun that current gun of weapon war, they still cannot use it right? The gun will be mulfunction.

Last edited by zmd94; 03-16-2017 at 23:46.
zmd94 is offline
instinctpt1
Senior Member
Join Date: Dec 2016
Location: Chandigarh, India
Old 03-17-2017 , 11:15   Re: Weapons War v7.4 (26 Weapons)
Reply With Quote #277

Quote:
Originally Posted by zmd94 View Post
Really appreciate your report, Instinctpt. Yet, I just want more comfirmation.
No no

Look its like this :
1=> Sometimes its caused by VIP menu when SPECIAL WAR starts , VIP quickly take another GUN from the menu which is still open (VIP MENU of too many other GUns) on their Screen ( So now they are not exactly same like others )

2=> Whenever someone (new) enters the server During SPECIAL WAR ; they can now buy anything they likes

3=> During SPECIAL WAR of any Weapon Ex. TMP or any GUN is going on, Players can still buy like just Press F1 and yippee you got m4 too powerful then TMP , now they disturbs everyone

....... i dont knw but this only happens with GUNS ... Knife and grenades Round are not affected and they have no Bugs
instinctpt1 is offline
zmd94
Veteran Member
Join Date: Nov 2013
Location: Malaysia (9w2zow).
Old 03-19-2017 , 03:11   Re: Weapons War v7.4 (26 Weapons)
Reply With Quote #278

Quote:
Although, player can get or buy other gun than current gun of weapon war, they still cannot use it right? The gun will be mulfunction.

Last edited by zmd94; 03-19-2017 at 03:12.
zmd94 is offline
instinctpt1
Senior Member
Join Date: Dec 2016
Location: Chandigarh, India
Old 03-21-2017 , 14:56   Re: Weapons War v7.4 (26 Weapons)
Reply With Quote #279

Nope its not malfunctioning they are Getting it very well and can use it Properly
instinctpt1 is offline
zmd94
Veteran Member
Join Date: Nov 2013
Location: Malaysia (9w2zow).
Old 03-24-2017 , 00:09   Re: Weapons War v7.4 (26 Weapons)
Reply With Quote #280

It is weird as the code should block it. Please try to put this plugin in the first place in your plugins.ini file.
zmd94 is offline
Reply



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 17:06.


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