Raised This Month: $51 Target: $400
 12% 

Trying to print out some text


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
DoPe^
Veteran Member
Join Date: Jul 2008
Location: Denmark / Copenhagen
Old 08-05-2013 , 09:07   Trying to print out some text
Reply With Quote #1

Hey guys, im adding some more features to a plugin im working on.
Now the issue is that I can't get it to work correctly

This is how the code looks like

cfg_supporter_total_players = 5
PHP Code:
public showWINNERS(client){

    if (
g_hDB != INVALID_HANDLE)
    {
        new 
String:buffer[200];
        
Format(buffersizeof(buffer), "SELECT * FROM supporter_time ORDER BY total DESC LIMIT %d"GetConVarInt(cfg_supporter_total_players));
        
SQL_TQuery(g_hDBSQLWinnersShowbufferclient);
    } 
    else
    {
        
PrintToChat(client"Winner System is not available");
    }
}

public 
SQLWinnersShow(Handle:ownerHandle:hndl, const String:error[], any:client){

        if(
hndl == INVALID_HANDLE)
        {
            
LogError(error);
            
PrintToServer("SQL Error: %s"error);
            return;
        }

        
PrintToChat(client"\x03Supporter Winners Today:");
        
PrintToChat(client"\x03___________________");


        new 
orden 0;
        new 
count 0;
        new 
String:number[64];
        new 
String:name[100];
        new 
String:text[128];

        if (
SQL_HasResultSet(hndl))
        {
            while (
SQL_FetchRow(hndl))
            {
                
orden++;
                
count++;
                
Format(number,64"option%i"orden);
                
SQL_FetchString(hndl1namesizeof(name));
                new 
Time SQL_FetchInt(hndl,4);
                new 
Hours = (Time/60/60);
                
//new Minutes = (Time/60)%(60);
                //new Seconds = (Time%60);
                
if(Hours >= && orden == 1)
                {
                    
PrintToChat(client"\x03Open Spots (4)");
                    
PrintToChat(client"\x03___________________");
                    
#if defined DEBUG
                    
PrintToServer("[DEBUG]4 Open Spots");
                    
#endif
                
}
                else if(
Hours >= && orden == 2)
                {
                    if(
count <= 1)
                    {
                        
PrintToChat(client"\x03Open Spots (3)");
                        
PrintToChat(client"\x03___________________");
                        
#if defined DEBUG
                        
PrintToServer("[DEBUG]3 Open Spots");
                        
#endif
                    
}
                }
                else if(
Hours >= && orden == 3)
                {
                    if(
count <= 1)
                    {
                        
PrintToChat(client"\x03Open Spots (2)");
                        
PrintToChat(client"\x03___________________");
                        
#if defined DEBUG
                        
PrintToServer("[DEBUG]2 Open Spots");
                        
#endif
                    
}
                }
                else if(
Hours >= && orden == 4)
                {
                    if(
count <= 1)
                    {
                        
PrintToChat(client"\x03Open Spots (1)");
                        
PrintToChat(client"\x03___________________");
                        
#if defined DEBUG
                        
PrintToServer("[DEBUG]1 Open Spots");
                        
#endif
                    
}
                }
                else if(
Hours >= && orden == 5)
                {
                    if(
count <= 1)
                    {
                        
PrintToChat(client"\x03Open Spots (0)");
                        
PrintToChat(client"\x03___________________");
                        
#if defined DEBUG
                        
PrintToServer("[DEBUG]0 Open Spots");
                        
#endif
                    
}
                }
                if(
Hours >= 1)
                {
                    
Format(text,128"\x01\x04%i. \x07CC00FF%s"orden,name);
                    
PrintToChat(client"%s"text);
                }

                else if(
Hours && orden <= 1)
                {
                    
PrintToChat(client"\x04There is no Winners today yet!");
                }
            }
        }

        if(
orden 1
        {
            
PrintToChat(client"\x04Database is empty!");
        }
        
//PrintToChat(client, "\x03___________________");
        //PrintToChat(client, "\x03Do you like our server?");
        //PrintToChat(client, "\x03www.ClanRoyaL.dk/Donate");
        //PrintToChat(client, "\x03Donate and get supporter");

Now what I want it to do is print out when there is 5/4/3/2/1/0 spots available
Atm it's not doing that.

There can be a total of 5 winning players.

So if there is 3 players that have won, it shows both that there is 4 spots left but also 3 spots and 2.
what I want it to do here is only show that there Is 2 spots left and so on.

This is how the Database table looks like




edit:

nvm I got it working
__________________

Last edited by DoPe^; 08-06-2013 at 07:37. Reason: got it working
DoPe^ 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:27.


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