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

Easy question


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
PawNod
Member
Join Date: Jun 2019
Location: Turkey
Old 07-19-2019 , 10:41   Easy question
Reply With Quote #1

how can ı give weapon if wood[33] is the highest from all player
PawNod is offline
thEsp
BANNED
Join Date: Aug 2017
Old 07-19-2019 , 11:02   Re: Easy question
Reply With Quote #2

Where do you think you are, a mind readers forum?
thEsp is offline
PawNod
Member
Join Date: Jun 2019
Location: Turkey
Old 07-19-2019 , 12:42   Re: Easy question
Reply With Quote #3

I want to find the player with the highest wood [33] variable from all players
PawNod is offline
Old 07-19-2019, 13:20
thEsp
This message has been deleted by thEsp.
Relaxing
AlliedModders Donor
Join Date: Jun 2016
Location: White Plains
Old 07-19-2019 , 13:43   Re: Easy question
Reply With Quote #4

Quote:
Originally Posted by thEsp View Post
Code:
new Highest = wood[ 0 ] new id; for( new i = 1; i < sizeof wood; i++ ) {       if( wood[ i ] > Highest){            Highest = wood[ i ]            id = i;       } } wood[id] // array index with highest value
Also, rename thread title to something like: Find the highest number in array.
__________________

Last edited by Relaxing; 07-20-2019 at 14:11. Reason: HamletEagle & Bugsy fault
Relaxing is offline
PawNod
Member
Join Date: Jun 2019
Location: Turkey
Old 07-19-2019 , 16:56   Re: Easy question
Reply With Quote #5

@Relaxing thanks for support i will try it
PawNod is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 07-20-2019 , 02:25   Re: Easy question
Reply With Quote #6

I smell infinite loop here. The condition should be <
__________________
HamletEagle is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 07-20-2019 , 12:28   Re: Easy question
Reply With Quote #7

Also, the scope of the id variable is limited to the for-loop, it should be defined outside if it is needed outside of the loop.
__________________
Bugsy 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 03:11.


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