The following warnings occurred:
Warning [2] Use of undefined constant SAPI_NAME - assumed 'SAPI_NAME' (this will throw an Error in a future version of PHP) - Line: 3388 - File: inc/functions.php PHP 7.4.33-nmm7 (Linux)
File Line Function
/inc/functions.php 3388 errorHandler->error
/showthread.php 116 build_archive_link
Warning [2] Use of undefined constant IN_ARCHIVE - assumed 'IN_ARCHIVE' (this will throw an Error in a future version of PHP) - Line: 3331 - File: inc/functions.php PHP 7.4.33-nmm7 (Linux)
File Line Function
/inc/functions.php 3331 errorHandler->error
/inc/functions.php 3324 build_forum_breadcrumb
/showthread.php 195 build_forum_breadcrumb
Warning [2] Use of undefined constant IN_ARCHIVE - assumed 'IN_ARCHIVE' (this will throw an Error in a future version of PHP) - Line: 3331 - File: inc/functions.php PHP 7.4.33-nmm7 (Linux)
File Line Function
/inc/functions.php 3331 errorHandler->error
/showthread.php 195 build_forum_breadcrumb






Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Tags Comparison & Region
Author Message
pinku
Journeyman
*

Posts: 118
Likes Given: 4
Likes Received: 2 in 2 posts
Joined: Apr 2013
Reputation: 4



Post: #1
Tags Comparison & Region
Hey!

Two different but quick questions. Every help is appreciated, as usual!

I'm making a simple election process based on votes.
I got 10 tags (1 for each candidate) and for the election to be completed, I need the player who was voted the highest.

Is there an easy way to compare those 10 tags to find the person who got the most votes? Something that won't make me compare 100 times manually.. lol
I can't find the right way to do this..

Second question;

Is there a way I can add new EVENTS to an AREA without having to restart the server? Like making it reload or something.. Tongue

Thanks a lot! Smile
03-09-2014 08:54 PM
Find all posts by this user Like Post Quote this message in a reply
Feeh
Sphere Developer
*****

Posts: 156
Likes Given: 6
Likes Received: 40 in 29 posts
Joined: Sep 2012
Reputation: 4



Post: #2
RE: Tags Comparison & Region
The best way to find who was the player with most votes is by checking one by one, luckily the FOR statement is here to help us

Code:
local.mostVotedPlayer=1 //always assume the first tag is the one with most votes
local.mostVotes=<dtag.Player_1_Votes>
FOR x 1 10 // loop from 1 to 10, assuming your tags index is 1 based
  IF (<tag.Player_<dlocal.x>_Votes> > <dlocal.mostVotes>)
    local.mostVotedPlayer=<dlocal.x>
    local.mostVotes=<dtag.Player_<dlocal.x>_Votes>
  ENDIF
ENDFOR
//the player with most votes was the candidate <dlocal.mostVotedPlayer> with <dlocal.mostVotes> votes

If there is a draw, the first player who signed to the vote list will be elected


---

You could try to resync the server, it should re-load your scripts

Feeh/Epila - Nightly releases / SphereWiki / Github Issues / Sphere's GitHub
(This post was last modified: 03-09-2014 11:17 PM by Feeh.)
03-09-2014 11:16 PM
Find all posts by this user Like Post Quote this message in a reply
pinku
Journeyman
*

Posts: 118
Likes Given: 4
Likes Received: 2 in 2 posts
Joined: Apr 2013
Reputation: 4



Post: #3
RE: Tags Comparison & Region
Ooooh. Thanks Feeh.
I got your logic, I was thinking the long way. LOL
I feel completely stupid now. Sad

Thanks again!
03-10-2014 04:25 PM
Find all posts by this user Like Post Quote this message in a reply
Post Reply 


Forum Jump:


User(s) browsing this thread: 1 Guest(s)