quick question
#1

I have alot of New `s in my server like 100 and my server is using a lot of cpu when a lot of players are on . I just coded my drug system using #define , I was wondering whats better to use or if theirs a difference between using new and define what one take more memory if it dose ?
Reply
#2

Quote:
Originally Posted by [SF
robmob ]
I have alot of New `s in my server like 100 and my server is using a lot of cpu when a lot of players are on . I just coded my drug system using #define , I was wondering whats better to use or if theirs a difference between using new and define what one take more memory if it dose ?
I think your problem may be with Loops, not with 'NEW's and 'DEFINE's , if you're using loops like:
pawn Код:
for(new i=0;i<MAX_PLAYERS;i++){
  if(IsPlayer....
Try changing your Loops to Foreach: Foreach By ******

The bad using of OnPlayerUpdate can cause lag as well..

Also, you may read this: Code optimisations.
Reply
#3

ok thanks so your saying try and change theese

new weed[MAX_PLAYERS];
new coke[MAX_PLAYERS];
new crack[MAX_PLAYERS];
new hash1[MAX_PLAYERS];
new heroin[MAX_PLAYERS];
new tobbacco[MAX_PLAYERS];
new extacy[MAX_PLAYERS];
new lsd[MAX_PLAYERS];
new acid[MAX_PLAYERS];
new level[MAX_PLAYERS];
new logged[MAX_PLAYERS];
new serverrank[MAX_PLAYERS];
new muted[MAX_PLAYERS];
new serverpoints[MAX_PLAYERS];
new WeaponSpawn[MAX_PLAYERS];
new Teleport[MAX_PLAYERS];
new JobSpammed[MAX_PLAYERS];
new InJail[MAX_PLAYERS];
new PlayerWantedLevel[MAX_PLAYERS];
new gTeam[MAX_PLAYERS];
new DMZone[MAX_PLAYERS];
Reply
#4

Quote:
Originally Posted by [SF
robmob ]
ok thanks so your saying try and change theese

new weed[MAX_PLAYERS];
new coke[MAX_PLAYERS];
new crack[MAX_PLAYERS];
new hash1[MAX_PLAYERS];
new heroin[MAX_PLAYERS];
new tobbacco[MAX_PLAYERS];
new extacy[MAX_PLAYERS];
new lsd[MAX_PLAYERS];
new acid[MAX_PLAYERS];
new level[MAX_PLAYERS];
new logged[MAX_PLAYERS];
new serverrank[MAX_PLAYERS];
new muted[MAX_PLAYERS];
new serverpoints[MAX_PLAYERS];
new WeaponSpawn[MAX_PLAYERS];
new Teleport[MAX_PLAYERS];
new JobSpammed[MAX_PLAYERS];
new InJail[MAX_PLAYERS];
new PlayerWantedLevel[MAX_PLAYERS];
new gTeam[MAX_PLAYERS];
new DMZone[MAX_PLAYERS];
You don't need to change this. But you can do this ( to make it more readable )
pawn Код:
enum epInfo{
  weed,
  coke,
  logged <- the last info doesn't take comma (','), you can put as many infos you need (i think).
}
new PlayerInfo[MAX_PLAYERS][epInfo];
So you use it like this:
pawn Код:
PlayerInfo[playerid][logged] = true;
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)