Derby - Selecting a winner
#1

Hello,
So i've recently made a derby system, works perfectly with 2 players but when there are 3 players it gets messy.
Here's the problem.
If there are 3 players playing, and if one of them falls off the other two wins the round, I've been trying to find the problem but i can't, Using height check at onplayerupdate.
PHP код:
public OnPlayerUpdate(playerid)
{
    if(
DB_On == && DB_Participants>&& DB_Onhold == && DB_Map==1)
    {
    new 
Float:xFloat:yFloat:z;
    
GetPlayerPos(playeridxyz);
    if(
2.1000)
    {
        
Dcar(playerid);
        
DB_Member[playerid]=0;
        
DB_Participants--;
        
Slap(playerid);
        
SpawnPlayer(playerid);
    }
    }
    if(
DB_On == && DB_Participants==&& DB_Onhold == 0)
    {
    if(
DB_Member[playerid]==1)
    {
    
Dcar(playerid);
    
DerbyWin(playerid);
    }
    }
    return 
1;

Should i use a timer instead?
Reply
#2

Bump
Reply
#3

Show where you assign/sort the positions (Code)
And I would recommend a 500 ms timer, even just a 1s timers for this purpose - running only when a derby is active.

I would suggest taking a look at the following subject:
https://en.wikipedia.org/wiki/Insertion_sort

This method works perfectly. If you're working with many many items to sort, take a look at some alternatives here: https://en.wikipedia.org/wiki/Sortin...ing_algorithms
Reply
#4

Fixed.
Thanks
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)