quick question - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: quick question (
/showthread.php?tid=128780)
quick question -
[SF]RobMob - 19.02.2010
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 ?
Re: quick question -
wafffllesss - 19.02.2010
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.
Re: quick question -
[SF]RobMob - 19.02.2010
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];
Re: quick question -
wafffllesss - 19.02.2010
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;