04.07.2017, 11:03
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.
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)
- 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++;
- 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(ServerMySQL, query, sizeof(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'",
NZD, ban, level, join, expire, name);
mysql_tquery(ServerMySQL, query, "", "");

