SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help > Help Archive

 
 
Thread Tools Display Modes
Old 04/02/2010, 05:51 PM   #1
nesty
Big Clucker
 
Join Date: Sep 2008
Posts: 95
Reputation: 0
Default Need economic assistance

hi there!
My script is almost done but I have a fundamental very Big Problem!
Because my script is beautiful designed in my opinion and I've a lot of thinks inside it.
But It is very slowly so the multiplayer synchronization is almost 2 seconds delayed. It's really a problem! (3791 Lines)
I need help! Maybe with some tipps to change my script in a economically way.
My scripting knowledges are ending here so i hope some good scripters will help me and give me tipps.

nesty is offline  
Old 04/02/2010, 05:56 PM   #2
Goobiiify
Huge Clucker
 
Goobiiify's Avatar
 
Join Date: Dec 2008
Posts: 221
Reputation: 17
Default Re: Need economic assistance

Don't use OnPlayerUpdate to much + Timers delay may not be to low.. Good luck!
__________________
www.argonathrpg.eu | 145.239.183.130:7777
Goobiiify is offline  
Old 04/02/2010, 06:11 PM   #3
nesty
Big Clucker
 
Join Date: Sep 2008
Posts: 95
Reputation: 0
Default Re: Need economic assistance

thanks but i've only about 5 timers and I never used onplayerupdate lol
but I've about 30 "if instruction" in one function.
Is there a way to reduce this or anything like this?
nesty is offline  
Old 04/02/2010, 06:14 PM   #4
MadeMan
High-roller
 
MadeMan's Avatar
 
Join Date: Jun 2007
Posts: 3,488
Reputation: 256
Default Re: Need economic assistance

Are you sure it's not server lag?
MadeMan is offline  
Old 04/02/2010, 06:23 PM   #5
nesty
Big Clucker
 
Join Date: Sep 2008
Posts: 95
Reputation: 0
Default Re: Need economic assistance

no because first I scripted at a base system like battlefield2 and with one base or two there weren't any lags or something like this but when I added my 6 Bases the game gets slowly (and lol my "second timer" just is a "3 second timer" now ) and this all happens because I've added 4 bases more.
(my many if instruction (=the encapsulation)) hope for solutions or more tipps.
nesty is offline  
Old 04/02/2010, 06:34 PM   #6
Calgon
Banned
 
Join Date: Jan 2009
Posts: 6,129
Reputation: 1127
Default Re: Need economic assistance

I think you mean algorithmic efficiency.
Calgon is offline  
Old 04/02/2010, 07:05 PM   #7
nesty
Big Clucker
 
Join Date: Sep 2008
Posts: 95
Reputation: 0
Default Re: Need economic assistance

First thanks for the webside
I have to find out more about the effeciency way of optimize my script.
Code:
Header size:      3796 bytes
Code size:      143416 bytes
Data size:      159888 bytes
Stack/heap size:   16384 bytes; estimated max. usage=4707 cells (18828 bytes)
Total requirements: 323484 bytes
thats my code size! lol
1. Question.
What's the lowest bytes I can use here:
pawn Code:
new string[64]; // <= I mean this array
new string2[64]; // <= I mean this array
format(string,sizeof(string),"~w~Base HOSPITAL ~b~%i ~w~Percent",PERCENTAGE_HOSPITAL);
GameTextForPlayer(i, string, 3000, 4);
format(string2,sizeof(string2),"%i Percent",PERCENTAGE_HOSPITAL);
Update3DTextLabelText(TEXTLABEL_HOSPITAL2,COLOR_YELLOW, string2);

2. Question Is there a effeciency differance between a variable called
pawn Code:
new var;
and
pawn Code:
new variable_base_hospital;
3. Question
Is there a effeciency differance between this
pawn Code:
if(a==1)
else if (b==1)
else if (c==1)
else if (d==1)
or
pawn Code:
if(a==1)
if (b==1)
if (c==1)
if (d==1)
hope for anwers (Interesting Topic in my opinion)
nesty is offline  
Old 04/02/2010, 07:41 PM   #8
nesty
Big Clucker
 
Join Date: Sep 2008
Posts: 95
Reputation: 0
Default Re: Need economic assistance

(i've forgotten)
4. Question
I use over 225 global variables! Is that too much? thanks for replies
nesty is offline  
Old 04/02/2010, 08:36 PM   #9
CrucixTM
Huge Clucker
 
CrucixTM's Avatar
 
Join Date: Jan 2010
Location: Denmark
Posts: 293
Reputation: 7
Default Re: Need economic assistance

I might be Captain Obvious now, but are there like a ton of vehicles spawned, in the same area?
__________________
Experienced mapper - Mapping anything for as low as 1 Euro(€)! - PM me if you need something mapped properly!
CrucixTM is offline  
Old 04/02/2010, 08:48 PM   #10
nesty
Big Clucker
 
Join Date: Sep 2008
Posts: 95
Reputation: 0
Default Re: Need economic assistance

no I didn't add really much cars
nesty is offline  
 

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
I need assistance with moving objects, plizz turky Help Archive 1 10/12/2009 10:36 PM
Keyboard commands assistance please. Paladin Help Archive 1 25/07/2009 09:52 PM
May i have some assistance CrimescenesCapo General 3 05/12/2008 09:14 PM


All times are GMT. The time now is 07:40 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.