[FilterScript] Miki!Props - Advanced House System - MySQL
#11

Here is a few suggestions that could make your script better:

1. You are using a query per house rather than one single query for all of the houses. A example of this would be

pawn Код:
new query[256];
new count = 0, i = 0;
mysql_query("SELECT * FROM propertyinfo");
mysql_store_result();
while(mysql_fetch_row(query,"|"))              
{
    printf("\n|------ Loading Property ID: %d" , i );
    new field[22][MAX_PLAYER_NAME];
    explode(query, field, "|");
    count++;
    propertyInfo [i] [E_X]          =   floatstr( field[  1 ] );
    propertyInfo [i] [E_Y]          =   floatstr( field[  2 ] );
    propertyInfo [i] [E_Z]          =   floatstr( field[  3 ] );
    propertyInfo [i] [E_INT]        =   strval  ( field[  4 ] );
    propertyInfo [i] [E_VW]         =   strval  ( field[  5 ] );
    printf("|--- Exterior Info| X: %f | Y: %f | Z: %f" , propertyInfo [i] [E_X],propertyInfo [i] [E_Y],propertyInfo [i] [E_Z] );
    printf("|--- INT: %d | VW: %d" , propertyInfo [i] [E_INT],propertyInfo [i] [E_VW] );
    propertyInfo [i] [I_X]          =   floatstr( field[  6 ] );
    propertyInfo [i] [I_Y]          =   floatstr( field[  7 ] );
    propertyInfo [i] [I_Z]          =   floatstr( field[  8 ] );
    propertyInfo [i] [I_INT]        =   strval  ( field[  9 ] );

    printf("|--- Interior Info| X: %f | Y: %f | Z: %f" , propertyInfo [i] [I_X],propertyInfo [i] [I_Y],propertyInfo [i] [I_Z] );
    printf("|--- INT: %d" , propertyInfo [i] [I_INT]);
    propertyInfo [i] [TYPE]         =   strval  ( field[ 10 ] );
    propertyInfo [i] [LEVEL]        =   strval  ( field[ 11 ] );
    propertyInfo [i] [CASHBOX]      =   strval  ( field[ 12 ] );
    printf("|--- Property TYPE: %d | Level: %d | Cashbox: %d" , propertyInfo [i] [TYPE] , propertyInfo [i] [LEVEL] , propertyInfo [i] [CASHBOX] );
    propertyInfo [i] [NAME]         =   field[ 13 ];
    propertyInfo [i] [OWNER]        =   field[ 14 ];
    propertyInfo [i] [CO_OWNER]     =   field[ 15 ];
    printf("|--- Name: %s | Owner: %s | Co-Owner: %s" , propertyInfo [i] [NAME] , propertyInfo [i] [OWNER] , propertyInfo [i] [CO_OWNER] );
    propertyInfo [i] [SOLD]         =   strval  ( field[ 16 ] );
    propertyInfo [i] [LOCK]         =   strval  ( field[ 17 ] );
    propertyInfo [i] [ALARM]        =   strval  ( field[ 18 ] );
    propertyInfo [i] [PRICE]        =   strval  ( field[ 19 ] );
    printf("|--- Sold: %b | Lock Level: %d | Alarm Level: %d | Price: %d" , propertyInfo [i] [SOLD] , propertyInfo [i] [LOCK] , propertyInfo [i] [ALARM], propertyInfo [i] [PRICE]);
    propertyInfo [i] [USED_SLOT]    =   true;
///////////////////////////////////////////////////////////
    propertyCP   [i]                =   CreateDynamicCP(propertyInfo [i] [E_X] , propertyInfo [i] [E_Y] , propertyInfo [i] [E_Z] , 2 , propertyInfo [i] [E_VW] , propertyInfo [i] [E_INT] , -1 , 4);
    printf("|--- PROPERTYID: %d | Loaded propertyCP: ID: %d" , i , propertyCP[i] );
    i++;
}
mysql_free_result();
2. Take out the debugging commands such as /pegarumabufunfa and /pd as they can be used by anyone.

3. You use sscanf for some of it and explode for the other part of it. Use sscanf for the whole thing.
Reply


Messages In This Thread
Miki!Props - Advanced House System - MySQL - by steki. - 17.05.2011, 14:21
Re: Miki!Props - Advanced House System - MySQL - by Naruto_Emilio - 17.05.2011, 14:22
Re: Miki!Props - Advanced House System - MySQL - by steki. - 17.05.2011, 14:32
Re: Miki!Props - Advanced House System - MySQL - by Ricop522 - 17.05.2011, 15:44
Re: Miki!Props - Advanced House System - MySQL - by nuriel8833 - 17.05.2011, 15:46
Re: Miki!Props - Advanced House System - MySQL - by Forever Alone - 17.05.2011, 16:21
Re: Miki!Props - Advanced House System - MySQL - by hackzor4 - 17.05.2011, 19:24
Re: Miki!Props - Advanced House System - MySQL - by Jason010 - 27.05.2011, 20:21
Re: Miki!Props - Advanced House System - MySQL - by Tachibana - 23.06.2011, 09:30
Re: Miki!Props - Advanced House System - MySQL - by ViPGuy - 19.08.2011, 12:28
Re: Miki!Props - Advanced House System - MySQL - by [HiC]TheKiller - 19.08.2011, 12:58
Re: Miki!Props - Advanced House System - MySQL - by Surferdude - 27.09.2011, 04:09
Re: Miki!Props - Advanced House System - MySQL - by Jantjuh - 27.09.2011, 06:29
Re: Miki!Props - Advanced House System - MySQL - by Ammo - 29.09.2011, 09:25
Re: Miki!Props - Advanced House System - MySQL - by Leo_Johnson - 16.10.2011, 12:53
Re: Miki!Props - Advanced House System - MySQL - by Inn0cent - 16.08.2013, 10:08
Re : Miki!Props - Advanced House System - MySQL - by eyutha - 09.09.2013, 12:13
Re: Miki!Props - Advanced House System - MySQL - by HitterHitman - 20.11.2013, 11:57
Re: Miki!Props - Advanced House System - MySQL - by Th3oX - 31.01.2014, 15:39

Forum Jump:


Users browsing this thread: 1 Guest(s)