Optimizing code
#1

Hello, I'd like an opinion on some code I have and how to optimize it to run as fast as possiable.
If you see a better way code this, please tell me
Код:
enum pInfo
{
	pLoggedIn,
	pPass[256],
	pSpawn,
	UniqueID,
	pIP[33],
	pOwner,
	pDisconnected,
	pLevel,
	pArmorUpgrade,
	pUpgradePoints,
	pMinutes,
	pRegisterDay[32],
	pTMinutes,
	pHours,
	pGender,
	pAge,
	pMoney,
	Text3D:aMeID,
	aMeStatus,
	CardOwner,
	pTogReports,
	pAcceptedHelp,
	pAcceptReport,
	pTrashReport,
	pDutyHours,
	pModel,
	pAdmin,
	pBanned,
	pBannedBy[MAX_PLAYER_NAME],
	Float:pX,
	Float:pY,
	Float:pZ,
	pInt,
	pVW,
	pVehVW,
	pWalkStyle,
	pNeon,
	pVNeon,
	pTGun[2],
	pTGunAmmo[2],
	pvTGun[2],
	pvTGunAmmo[2],
	pFac,
	pFacRank,
	pFacLeader,
	pWeapon[13],
	pWeaponAmmo[13],
	pHospital,
	pFacDuty,
	pFacDiv,
	pFacDivLeader,
	pBiz,
	pVBiz,
	pVVBiz,
	pHouse,
	pVHouse,
	pVVHouse,
	pFuelStation,
	pFuel,
	pGarage,
	pVGarage,
	pJob,
	pJobSkill[MAX_JOBS],
	pJackSkill,
	pOwnsMask,
	HasBoughtMask,
	pMail,
	TicketReason[128],
	TicketPrice,
	sTickets,
	pZPackages,
	pFPackages,
	pTPackages,
	pMPackages,
	pDPackages,
	pMaterials,
	pMMaterials,
	pMMPackages,
	pHMaterials,
	pHPackages,
	pWeed,
	pAkamol,
	pNurofen,
	pMorphine,
	pcocaine,
	pTWeed,
	pTcocaine,
	pvTWeed,
	pvTcocaine,
	pHasCellphone,
	pCellphone,
	pPhonebook,
	pDice,
	pCigar,
	pSprunk,
	pSpray,
	pRope,
	pBlindfold,
	pWT,
	pWTC,
	pGas,
	pRadio,
	Float:pHealth,
	Float:pArmor,
	pInternet,
	pPrison,
	pPrisonTime,
	pPrisonReason[64],
	pPrisonBy[MAX_PLAYER_NAME],
	pRobbing,
	pWanted,
	pWanted1[64],
	pWanted2[64],
	pWanted3[64],
	pWanted4[64],
	pWanted5[64],
	pWanted6[64],
	pCrimes,
	pArrested,
	pContract,
	pContractBy[32],
	pTutorial,
	pWarns,
	pWarn1[64],
	pWarn2[64],
	pWarn3[64],
	pMute,
	pOMute,
	pNMute,
	pVMute,
	pRMute,
	pADMute,
	pSpawnFreeze,
	pFam,
	pFamRank,
	pCSuccess,
	pCFail,
	pDeath,
	pKill,
	pGold,
	pHelper,
	pExp,
	pGangMod,
	pFacMod,
	pBanAppealer,
	pCarLic,
	pFlyLic,
	pJetpack,
	pWepLic,
	pWeedLic,
	pAccent[16],
	pVIP,
	pVIPJob,
	pNumber,
	// ------ Personal Vehicles ------ //
	pVeh, // Vehicle 1
	vModel,
	Float:vX,
	Float:vY,
	Float:vZ,
	Float:vA,
	vC1,
	vC2,
	vPJ,
	vPlate1[128],
	pVehMod[14],
	vLocked,
	vRegistered,
	pVVeh, // Vehicle 2
	vVModel,
	Float:vVX,
	Float:vVY,
	Float:vVZ,
	Float:vVA,
	vVC1,
	vVC2,
	vVPJ,
	vPlate2[128],
	pVVehMod[14],
	vVLocked,
	vVRegistered,
	pVVVeh, // Vehicle 3
	vVVModel,
	Float:vVVX,
	Float:vVVY,
	Float:vVVZ,
	Float:vVVA,
	vVVC1,
	vVVC2,
	vVVPJ,
	vPlate3[128],
	pVVVehMod[14],
	vVVLocked,
	vVVRegistered,
	p4VVeh, // Vehicle 4
	v4VModel,
	Float:v4VX,
	Float:v4VY,
	Float:v4VZ,
	Float:v4VA,
	v4VC1,
	v4VC2,
	v4VPJ,
	vPlate4[128],
	p4VVehMod[14],
	v4VLocked,
	v4VRegistered,
	p5VVeh, // Vehicle 5
	v5VModel,
	Float:v5VX,
	Float:v5VY,
	Float:v5VZ,
	Float:v5VA,
	v5VC1,
	v5VC2,
	v5VPJ,
	vPlate5[128],
	p5VVehMod[14],
	v5VLocked,
	v5VRegistered,
	// ------ End Of Personal Vehicles ------ //
	pTempVIP,
	pBuddyInvited,
	pVIPInviteDay,
	pBrinkDeliverTruck,
	pDeliverTruck,
	pNew,
	pRefPoints,
	pFightStyle,
	pScope,
	pCookies,
	pOldskool,
	pReward,
	pFish[5],
	pStoned,
	pGate[3],
	pDynamicFac,
	pFacDoor,
	pRelationShip,
	pRelationWith[128],
	pSafeAdmin
}
new PlayerInfo[MAX_PLAYERS+1][pInfo];
Reply
#2

there is nothing to opt
Reply
#3

Quote:
Originally Posted by SPAWN_METAL
Посмотреть сообщение
there is nothing to opt
Okay Thanks for the confidence. I saw a post from ****** saying:

Quote:
Originally Posted by TheCman
Посмотреть сообщение
in pawn (like, when people create an enum with 60 or 70 parameters and then fill a MAX_PLAYERS-sized array of this enum with zeroes? :P).
Quote:
Originally Posted by ******
Посмотреть сообщение
That's just bad coding - bad coders will write bad code in any language.
Reply
#4

I don't know, maybe you can change these sizes?
VPlate3[128]
if this is intended to vehicle number plates then, it should be lessened, vehicle plates can only have 32 characters at maximum including color embedding, only about 9 or 10 characters will show up on the plate, more will cause the text to split. So why are using a 128 sized array? It's too much.

TicketReason[128]
I don't know if this is necessary, as, for me, a reason should be short and summed up, not a huge string, I would make it roughly at 30 characters at best.

PPass[256]
If you're hashing passwords, I think 128 is long enough,
those are just a few examples I picked up on the fly, take another analysis view on your enum, and change the array sizes reasonably.
Reply
#5

Quote:
Originally Posted by Eoussama
Посмотреть сообщение
I don't know, maybe you can change these sizes?
VPlate3[128]
if this is intended to vehicle number plates then, it should be lessened, vehicle plates can only have 32 characters at maximum including color embedding, only about 9 or 10 characters will show up on the plate, more will cause the text to split. So why are using a 128 sized array? It's too much.

TicketReason[128]
I don't know if this is necessary, as, for me, a reason should be short and summed up, not a huge string, I would make it roughly at 30 characters at best.

PPass[256]
If you're hashing passwords, I think 128 is long enough,
those are just a few examples I picked up on the fly, take another analysis view on your enum, and change the array sizes reasonably.
Okay, thats a start. good vision! thank you.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)