SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Filterscripts

Reply
 
Thread Tools Display Modes
Old 20/12/2017, 04:14 PM   #11
Kaperstone
Banned
 
Join Date: May 2011
Location: Russia
Posts: 3,025
Reputation: 824
Default Re: Dynamic Update System

If you already use sscanf, you can make
/update [add, edit, etc.] rather than /editupdate /addupdate


Why are you using PVars?
What if I use "UID" PVar in my gamemode, that'd mean that your filterscript would overwrite my PVars

Code:
new str[256];
Max. length of a message that you can send in a SendClientMessage is 144, so the array must be 145 with one for terminal.

Code:
format(tmp4, sizeof(tmp4), "Updates\tDate Of Update\n%s", tmp3);
Code:
format(s, sizeof(s), "update%d", x);
Why are you using format to append string? use strcat
Format would just be slower for such simple task.

Code:
h[256]
The dates are around 10 char, surely not 256 char
Code:
%d/%d/%d
2+2+4+3=11 max.
You have 245 wasted cells


Code:
for(new x=1 ; x<560 ; x++)
            {
                new s[256];
Its better to create the array outside the loop than to create an array for every loop, would just eat up processing time, moreover, if you'd create it outside, empty the string every loop with ``string[0] = EOS;``


I've noticed that you haven't stated max. length of string for an update line to be?
Kaperstone is offline   Reply With Quote
Old 20/12/2017, 04:19 PM   #12
rfr
Banned
 
Join Date: Nov 2017
Posts: 234
Reputation: 43
Default Re: Dynamic Update System

For strcat example:

PHP Code:
new string[144+1];
strcat(string,"\ni have not even read your code yet");
ShowPlayerDialog(playeridDIALOG_UPDATESDIALOG_STYLE_"Server Updates"string"Close"""); 
rfr is offline   Reply With Quote
Old 20/12/2017, 04:30 PM   #13
Kaperstone
Banned
 
Join Date: May 2011
Location: Russia
Posts: 3,025
Reputation: 824
Default Re: Dynamic Update System

Quote:
Originally Posted by rfr View Post
For strcat example:

PHP Code:
new string[144];
strcat(string,"\ni have not even read your code yet");
ShowPlayerDialog(playeridDIALOG_UPDATESDIALOG_STYLE_"Server Updates"string"Close"""); 
Although the max. info length is 4096, don't forget about EOS / '\0' (End Of String)
144 + 1
Kaperstone is offline   Reply With Quote
Old 20/12/2017, 04:41 PM   #14
rfr
Banned
 
Join Date: Nov 2017
Posts: 234
Reputation: 43
Default Re: Dynamic Update System

Quote:
Originally Posted by Kaperstone View Post
Although the max. info length is 4096, don't forget about EOS / '\0' (End Of String)
144 + 1
oh my bad. thank you.
rfr is offline   Reply With Quote
Old 21/12/2017, 02:14 PM   #15
DonaldDuck
Banned
 
Join Date: Jun 2017
Location: Phillipines
Posts: 258
Reputation: 91
Default Re: Dynamic Update System

Nice work, keep it up.
DonaldDuck is offline   Reply With Quote
Old 21/12/2017, 03:05 PM   #16
Usmanmemon
Big Clucker
 
Usmanmemon's Avatar
 
Join Date: May 2017
Posts: 55
Reputation: 13
Default Re: Dynamic Update System

Quote:
Originally Posted by Kaperstone View Post
If you already use sscanf, you can make
/update [add, edit, etc.] rather than /editupdate /addupdate


Why are you using PVars?
What if I use "UID" PVar in my gamemode, that'd mean that your filterscript would overwrite my PVars

Code:
new str[256];
Max. length of a message that you can send in a SendClientMessage is 144, so the array must be 145 with one for terminal.

Code:
format(tmp4, sizeof(tmp4), "Updates\tDate Of Update\n%s", tmp3);
Code:
format(s, sizeof(s), "update%d", x);
Why are you using format to append string? use strcat
Format would just be slower for such simple task.

Code:
h[256]
The dates are around 10 char, surely not 256 char
Code:
%d/%d/%d
2+2+4+3=11 max.
You have 245 wasted cells


Code:
for(new x=1 ; x<560 ; x++)
            {
                new s[256];
Its better to create the array outside the loop than to create an array for every loop, would just eat up processing time, moreover, if you'd create it outside, empty the string every loop with ``string[0] = EOS;``


I've noticed that you haven't stated max. length of string for an update line to be?
Uhh if i say its my second fs then?
Thank you for telling my mistakes i will try to improve it.
Usmanmemon is offline   Reply With Quote
Old 21/12/2017, 03:11 PM   #17
Usmanmemon
Big Clucker
 
Usmanmemon's Avatar
 
Join Date: May 2017
Posts: 55
Reputation: 13
Default Re: Dynamic Update System

Quote:
Originally Posted by DonaldDuck View Post
Nice work, keep it up.
Thanks Bro
Usmanmemon is offline   Reply With Quote
Old 23/12/2017, 12:34 PM   #18
Barnwell
Banned
 
Join Date: May 2014
Location: England
Posts: 556
Reputation: 40
Default Re: Dynamic Update System

Good job
Barnwell is offline   Reply With Quote
Old 23/12/2017, 01:04 PM   #19
xMoBi
Banned
 
Join Date: Jul 2017
Location: Islamic Republic of Pakistan
Posts: 100
Reputation: 26
Default Re: Dynamic Update System

u call this dynamic, i call this shit. i would write my own system for something like that and use anything else than ini.

Last edited by xMoBi; 08/05/2018 at 09:07 AM.
xMoBi is offline   Reply With Quote
Old 23/12/2017, 08:07 PM   #20
Usmanmemon
Big Clucker
 
Usmanmemon's Avatar
 
Join Date: May 2017
Posts: 55
Reputation: 13
Default Re: Dynamic Update System

Quote:
Originally Posted by Zoranzoki21 View Post
No work. When I add update, it can not be seen.
Make sure to make an file in scriptfiles folder, name 'updates.ini'
Usmanmemon is offline   Reply With Quote
Reply

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
Update to Dynamic CP DerickClark Scripting Help 2 06/02/2017 12:09 PM
How to update a dynamic object when it's moved? rangerxxll Scripting Help 3 18/11/2015 04:41 AM
Speed up the update time for dynamic objects? Phil_Cutcliffe Scripting Help 8 27/02/2014 06:11 AM
[FilterScript] Dynamic Apartment System v0.2 (UPDATE 7.3.2012) Maki187 Filterscripts 30 11/12/2012 04:28 PM


All times are GMT. The time now is 03:26 AM.


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