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.