Optimization variable
#1

how to Optimization the variable

PHP код:
new total_vehicles_from_files=0;
new    
rBit2:CC_BUKIT<MAX_PLAYERS>;
new 
rBit2:UnderWater<MAX_PLAYERS>;
new 
god_mode[MAX_PLAYERS];
new 
boolInDM[MAX_PLAYERS];
new 
headshot[MAX_PLAYERS];
new 
KillStreak[MAX_PLAYERS];
new 
DM[MAX_PLAYERS];
new 
Text3D:label[MAX_PLAYERS];
new 
Text3D:wanted[MAX_PLAYERS];
new 
bool:bapakko[MAX_PLAYERS];
new 
randSpawn 0;
new 
shop;
new 
Andy;
new 
baju[2];
new 
gPlayerCitySelection[MAX_PLAYERS];
new 
gPlayerHasCitySelected[MAX_PLAYERS];
new 
gPlayerLastCitySelectionTick[MAX_PLAYERS];
new 
playerCar[MAX_PLAYERS];
new 
PlayerText:Textdraw0;
new 
PlayerText:Textdraw1;
new 
PlayerText:Textdraw2;
new 
PlayerText:Textdraw3;
new 
Airplanes mS_INVALID_LISTID;
new 
Bikes mS_INVALID_LISTID;
new 
Boats mS_INVALID_LISTID;
new 
Convertible mS_INVALID_LISTID;
new 
Helicopters mS_INVALID_LISTID;
new 
Industrials mS_INVALID_LISTID;
new 
Lowrider mS_INVALID_LISTID;
new 
OffRoad mS_INVALID_LISTID;
new 
PublicService mS_INVALID_LISTID;
new 
RC mS_INVALID_LISTID;
new 
Saloon mS_INVALID_LISTID;
new 
Sports mS_INVALID_LISTID;
new 
StationWagon mS_INVALID_LISTID;
new 
Trailer mS_INVALID_LISTID;
new 
Unique mS_INVALID_LISTID;
new 
skinlist mS_INVALID_LISTID;
new 
NUMBER = -1
Reply
#2

PHP код:
new
    
total_vehicles_from_files=0,
    
rBit2:CC_BUKIT<MAX_PLAYERS>,
    
rBit2:UnderWater<MAX_PLAYERS>,
    
god_mode[MAX_PLAYERS],
    
boolInDM[MAX_PLAYERS],
    
headshot[MAX_PLAYERS],
    
KillStreak[MAX_PLAYERS],
    
DM[MAX_PLAYERS],
    
Text3D:label[MAX_PLAYERS],
    
Text3D:wanted[MAX_PLAYERS],
    
bool:bapakko[MAX_PLAYERS],
    
randSpawn 0,
    
shop,
    
Andy,
    
baju[2],
    
gPlayerCitySelection[MAX_PLAYERS],
    
gPlayerHasCitySelected[MAX_PLAYERS],
    
gPlayerLastCitySelectionTick[MAX_PLAYERS],
    
playerCar[MAX_PLAYERS],
    
PlayerText:Textdraw0,
    
PlayerText:Textdraw1,
    
PlayerText:Textdraw2,
    
PlayerText:Textdraw3,
    
Airplanes mS_INVALID_LISTID,
    
Bikes mS_INVALID_LISTID,
    
Boats mS_INVALID_LISTID,
    
Convertible mS_INVALID_LISTID,
    
Helicopters mS_INVALID_LISTID,
    
Industrials mS_INVALID_LISTID,
    
Lowrider mS_INVALID_LISTID,
    
OffRoad mS_INVALID_LISTID,
    
PublicService mS_INVALID_LISTID,
    
RC mS_INVALID_LISTID,
    
Saloon mS_INVALID_LISTID,
    
Sports mS_INVALID_LISTID,
    
StationWagon mS_INVALID_LISTID,
    
Trailer mS_INVALID_LISTID,
    
Unique mS_INVALID_LISTID,
    
skinlist mS_INVALID_LISTID,
    
NUMBER = -1

Reply
#3

Quote:
Originally Posted by Feynman
Посмотреть сообщение
PHP код:
new
    
total_vehicles_from_files=0,
    
rBit2:CC_BUKIT<MAX_PLAYERS>,
    
rBit2:UnderWater<MAX_PLAYERS>,
    
god_mode[MAX_PLAYERS],
    
boolInDM[MAX_PLAYERS],
    
headshot[MAX_PLAYERS],
    
KillStreak[MAX_PLAYERS],
    
DM[MAX_PLAYERS],
    
Text3D:label[MAX_PLAYERS],
    
Text3D:wanted[MAX_PLAYERS],
    
bool:bapakko[MAX_PLAYERS],
    
randSpawn 0,
    
shop,
    
Andy,
    
baju[2],
    
gPlayerCitySelection[MAX_PLAYERS],
    
gPlayerHasCitySelected[MAX_PLAYERS],
    
gPlayerLastCitySelectionTick[MAX_PLAYERS],
    
playerCar[MAX_PLAYERS],
    
PlayerText:Textdraw0,
    
PlayerText:Textdraw1,
    
PlayerText:Textdraw2,
    
PlayerText:Textdraw3,
    
Airplanes mS_INVALID_LISTID,
    
Bikes mS_INVALID_LISTID,
    
Boats mS_INVALID_LISTID,
    
Convertible mS_INVALID_LISTID,
    
Helicopters mS_INVALID_LISTID,
    
Industrials mS_INVALID_LISTID,
    
Lowrider mS_INVALID_LISTID,
    
OffRoad mS_INVALID_LISTID,
    
PublicService mS_INVALID_LISTID,
    
RC mS_INVALID_LISTID,
    
Saloon mS_INVALID_LISTID,
    
Sports mS_INVALID_LISTID,
    
StationWagon mS_INVALID_LISTID,
    
Trailer mS_INVALID_LISTID,
    
Unique mS_INVALID_LISTID,
    
skinlist mS_INVALID_LISTID,
    
NUMBER = -1

Код:
enum intbool
{

    bool:InDM,
    bool:bapakko,
    god_mode,
    headshot,
    KillStreak,
    DM,
    Text3D:label,
    Text3D:wanted,
    gPlayerCitySelection,
    gPlayerHasCitySelected,
    gPlayerLastCitySelectionTick,
    playerCar
}

new
    total_vehicles_from_files=0,
    rBit2:CC_BUKIT<MAX_PLAYERS>,
    rBit2:UnderWater<MAX_PLAYERS>,
    randSpawn = 0,
    shop,
    Andy,
    baju[2],
    PlayerText:Textdraw0,
    PlayerText:Textdraw1,
    PlayerText:Textdraw2,
    PlayerText:Textdraw3,
    Airplanes = mS_INVALID_LISTID,
    Bikes = mS_INVALID_LISTID,
    Boats = mS_INVALID_LISTID,
    Convertible = mS_INVALID_LISTID,
    Helicopters = mS_INVALID_LISTID,
    Industrials = mS_INVALID_LISTID,
    Lowrider = mS_INVALID_LISTID,
    OffRoad = mS_INVALID_LISTID,
    PublicService = mS_INVALID_LISTID,
    RC = mS_INVALID_LISTID,
    Saloon = mS_INVALID_LISTID,
    Sports = mS_INVALID_LISTID,
    StationWagon = mS_INVALID_LISTID,
    Trailer = mS_INVALID_LISTID,
    Unique = mS_INVALID_LISTID,
    skinlist = mS_INVALID_LISTID,
    NUMBER = -1,
    PlayerIntBool[MAX_PLAYERS][intbool];
Reply
#4

use enums better and it will be easy.
Код:
new tmp[enumname];
enumname = tmp;
Reply
#5

How in rbit
Reply
#6

how in rbit?
Reply
#7

You want a bitfield to store your boolean variables? Honestly, it's more pain than anything especially considering your situation. You're not going to save much RAM, and you're going to get more complex (and therefore potentially more error-prone) code as a result.

EDIT: Never mind, you seem to be talking about a specific library, seeing the rBit2: tags in your code.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)