Anyway of making this code optimised?
#5

I wrote a long text with all the mistakes and how to use better ways but somehow had me to re-log in and couldn't post. Refreshing the page did not bring the text back so I won't spend another 30 minutes to write it.

- Don't use strmid to copy strings, it's only for extracting part of text.
- Set "Name" as UNIQUE INDEX to speed up the searching.
- The expire time won't always be correct.
pawn Код:
if ((Month += length) > 12) Month -= 12, Year++;
but day will still be displayed wrong if the expire month has less days than the current month.
- Use in-built mysql functions (example: https://github.com/Konstantinos-Sk/vip-expiration)

PHP код:
switch (length)
{
    case 
0:
    {
        
// demote..
        
return 1;
    }
    case 
1:
    {
        switch (
level)
        {
            case 
0:
            {
                
NZD 5;
                
ban 300000;
            }
            case 
1:
            {
                
NZD 15;
                
ban 750000;
            }
        }
    }
    case 
6:
    {
        switch (
level)
        {
            case 
0:
            {
                
NZD 10;
                
ban 600000;
            }
            case 
1:
            {
                
NZD 20;
                
ban 1500000;
            }
        }
    }
    case 
12:
    {
        switch (
level)
        {
            case 
0:
            {
                
NZD 12;
                
ban 1200000;
            }
            case 
1:
            {
                
NZD 25;
                
ban 5000000;
            }
        }
    }
}
mysql_format(ServerMySQLquerysizeof(query),
    
"UPDATE Users u JOIN Inventory i ON i.uID=u.uID JOIN Ownered o ON o.uID=u.uID SET i.NZT=i.NZT+%d,o.Bank=o.Bank+%d,u.VIP=%d,u.VIPJoinDate='%s',u.VIPExpireDate='%s' WHERE u.name='%e'",
    
NZDbanleveljoinexpirename);
mysql_tquery(ServerMySQLquery""""); 
Reply


Messages In This Thread
Anyway of making this code optimised? - by Tass007 - 04.07.2017, 06:22
Re: Anyway of making this code optimised? - by Kaperstone - 04.07.2017, 07:26
Re: Anyway of making this code optimised? - by Tass007 - 04.07.2017, 07:30
Re: Anyway of making this code optimised? - by Kaperstone - 04.07.2017, 08:04
Re: Anyway of making this code optimised? - by Konstantinos - 04.07.2017, 11:03
Re: Anyway of making this code optimised? - by OneDay - 04.07.2017, 11:51
Re: Anyway of making this code optimised? - by Tass007 - 08.07.2017, 11:40
Re: Anyway of making this code optimised? - by Kaperstone - 10.07.2017, 16:51
Re: Anyway of making this code optimised? - by Tass007 - 11.07.2017, 10:17
Re: Anyway of making this code optimised? - by Konstantinos - 11.07.2017, 15:17

Forum Jump:


Users browsing this thread: 1 Guest(s)