Raised This Month: $32 Target: $400
 8% 

Array Copy Stock


Post New Thread Reply   
 
Thread Tools Display Modes
Tirant
Veteran Member
Join Date: Jul 2008
Location: Los Angeles, California
Old 09-10-2011 , 15:38   Re: Array Copy Stock
Reply With Quote #21

I'm putting together some tests right now. Tell me what it prints when you run this code...

Code:
new Float:a[5]    = { 0.0, 1.0, ... };
server_print("Printing Test Values for Variable 'a'");
for (new i; i < sizeof a; i++) {
    server_print("a[%d] = %.1f", i, a[i]);
}
I always thought using that notation for registering an array would work with floating points.
__________________

PM me if you're interested in buying the Credits addition for Base Builder
Battlefield Rebirth [66% done]
Call of Duty: MW2 [100% done]
Base Builder [100% done]
Tirant is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 09-10-2011 , 15:43   Re: Array Copy Stock
Reply With Quote #22

Wooh, it's tricky. Using macro, indeed, tag is now well got. Good to know.

EDIT :

Code:
Printing Test Values for Variable 'a'
a[0] = 0.0
a[1] = 1.0
a[2] = 170141183460469200000000000000000000000.0
a[3] = -0.2
a[4] = -42535295865117300000000000000000000000.0
So ? Just some garbage. I guess it does't auto-increment with float value ?
__________________

Last edited by Arkshine; 09-10-2011 at 15:48.
Arkshine is offline
Tirant
Veteran Member
Join Date: Jul 2008
Location: Los Angeles, California
Old 09-10-2011 , 16:01   Re: Array Copy Stock
Reply With Quote #23

This is my output from the simple tests... Notice that the tags boolean doesn't do anything when the other parameters are not set properly.

Quote:
L 09/10/2011 - 12:57:41: [test1.amxx] Printing Test Values for Variable 'a'...
L 09/10/2011 - 12:57:41: [test1.amxx] a[0] = 0.0
L 09/10/2011 - 12:57:41: [test1.amxx] a[1] = 1.0
L 09/10/2011 - 12:57:41: [test1.amxx] a[2] = 2.0
L 09/10/2011 - 12:57:41: [test1.amxx] a[3] = 3.0
L 09/10/2011 - 12:57:41: [test1.amxx] a[4] = 4.0
L 09/10/2011 - 12:57:41: [test1.amxx] Printing Test Values for Variable 'b'...
L 09/10/2011 - 12:57:41: [test1.amxx] b[0] = 0
L 09/10/2011 - 12:57:41: [test1.amxx] b[1] = 1
L 09/10/2011 - 12:57:41: [test1.amxx] b[2] = 2
L 09/10/2011 - 12:57:41: [test1.amxx] b[3] = 3
L 09/10/2011 - 12:57:41: [test1.amxx] b[4] = 4
L 09/10/2011 - 12:57:41: [test1.amxx] Printing Test Values for Variable 'c'...
L 09/10/2011 - 12:57:41: [test1.amxx] c[0] = 0.0
L 09/10/2011 - 12:57:41: [test1.amxx] c[1] = 0.0
L 09/10/2011 - 12:57:41: [test1.amxx] c[2] = 0.0
L 09/10/2011 - 12:57:41: [test1.amxx] arraycopy(c, a); Printing resulting into...
L 09/10/2011 - 12:57:41: [test1.amxx] c[0] = 0.0
L 09/10/2011 - 12:57:41: [test1.amxx] c[1] = 1.0
L 09/10/2011 - 12:57:41: [test1.amxx] c[2] = 2.0
L 09/10/2011 - 12:57:41: [test1.amxx] Printing Test Values for Variable 'd'...
L 09/10/2011 - 12:57:41: [test1.amxx] d[0] = 0
L 09/10/2011 - 12:57:41: [test1.amxx] d[1] = 0
L 09/10/2011 - 12:57:41: [test1.amxx] d[2] = 0
L 09/10/2011 - 12:57:41: [test1.amxx] d[3] = 0
L 09/10/2011 - 12:57:41: [test1.amxx] d[4] = 0
L 09/10/2011 - 12:57:41: [test1.amxx] d[5] = 0
L 09/10/2011 - 12:57:41: [test1.amxx] d[6] = 0
L 09/10/2011 - 12:57:41: [test1.amxx] arraycopy(d, b); Printing resulting into...
L 09/10/2011 - 12:57:41: [test1.amxx] d[0] = 0
L 09/10/2011 - 12:57:41: [test1.amxx] d[1] = 1
L 09/10/2011 - 12:57:41: [test1.amxx] d[2] = 2
L 09/10/2011 - 12:57:41: [test1.amxx] d[3] = 3
L 09/10/2011 - 12:57:41: [test1.amxx] d[4] = 4
L 09/10/2011 - 12:57:41: [test1.amxx] d[5] = 0
L 09/10/2011 - 12:57:41: [test1.amxx] d[6] = 0
L 09/10/2011 - 12:57:41: [test1.amxx] arraycopy(d, a, _, true); Printing resulting into...
L 09/10/2011 - 12:57:41: [test1.amxx] d[0] = 0.0
L 09/10/2011 - 12:57:41: [test1.amxx] d[1] = 1.0
L 09/10/2011 - 12:57:41: [test1.amxx] d[2] = 2.0
L 09/10/2011 - 12:57:41: [test1.amxx] d[3] = 3.0
L 09/10/2011 - 12:57:41: [test1.amxx] d[4] = 4.0
L 09/10/2011 - 12:57:41: [test1.amxx] d[5] = 0.0
L 09/10/2011 - 12:57:41: [test1.amxx] d[6] = 0.0
L 09/10/2011 - 12:57:41: [test1.amxx] arraycopy(d, a, _, false); Printing resulting into...
L 09/10/2011 - 12:57:41: [test1.amxx] d[0] = 0.0
L 09/10/2011 - 12:57:41: [test1.amxx] d[1] = 1.0
L 09/10/2011 - 12:57:41: [test1.amxx] d[2] = 2.0
L 09/10/2011 - 12:57:41: [test1.amxx] d[3] = 3.0
L 09/10/2011 - 12:57:41: [test1.amxx] d[4] = 4.0
L 09/10/2011 - 12:57:41: [test1.amxx] d[5] = 0.0
L 09/10/2011 - 12:57:41: [test1.amxx] d[6] = 0.0
L 09/10/2011 - 12:57:41: [test1.amxx] arraycopy(d, a, _, true, tagof d, _, _, tagof a, _, _); Printing resulting into...
L 09/10/2011 - 12:57:41: [test1.amxx] d[0] = 0.0
L 09/10/2011 - 12:57:41: [test1.amxx] d[1] = 1.0
L 09/10/2011 - 12:57:41: [test1.amxx] d[2] = 2.0
L 09/10/2011 - 12:57:41: [test1.amxx] d[3] = 3.0
L 09/10/2011 - 12:57:41: [test1.amxx] d[4] = 4.0
L 09/10/2011 - 12:57:41: [test1.amxx] d[5] = 0.0
L 09/10/2011 - 12:57:41: [test1.amxx] d[6] = 0.0
L 09/10/2011 - 12:57:41: [test1.amxx] arraycopy(d, a, _, false, tagof d, _, _, tagof a, _, _); Printing resulting into...
L 09/10/2011 - 12:57:41: [test1.amxx] d[0] = 0.0
L 09/10/2011 - 12:57:41: [test1.amxx] d[1] = 0.0
L 09/10/2011 - 12:57:41: [test1.amxx] d[2] = 0.0
L 09/10/2011 - 12:57:41: [test1.amxx] d[3] = 0.0
L 09/10/2011 - 12:57:41: [test1.amxx] d[4] = 0.0
L 09/10/2011 - 12:57:41: [test1.amxx] d[5] = 0.0
L 09/10/2011 - 12:57:41: [test1.amxx] d[6] = 0.0
Attached Files
File Type: sma Get Plugin or Get Source (test1.sma - 586 views - 1.9 KB)
__________________

PM me if you're interested in buying the Credits addition for Base Builder
Battlefield Rebirth [66% done]
Call of Duty: MW2 [100% done]
Base Builder [100% done]
Tirant is offline
Emp`
AMX Mod X Plugin Approver
Join Date: Aug 2005
Location: Decapod 10
Old 09-10-2011 , 16:16   Re: Array Copy Stock
Reply With Quote #24

Quote:
Originally Posted by Tirant View Post
Notice that the tags boolean doesn't do anything when the other parameters are not set properly.
Quote:
Originally Posted by Arkshine View Post
Because I'm doing some tests just by curiosity, and by using tagof in the header will result 0 always or using multi-tag (any, or {Float, bool, etc..} ) and the value will be always the same (more the first tag). In others words, and if I don't say bullshits, it works only with mono-tag, and tagof has to used inside the function.
Emp` is offline
Send a message via AIM to Emp` Send a message via MSN to Emp` Send a message via Yahoo to Emp` Send a message via Skype™ to Emp`
abdul-rehman
Veteran Member
Join Date: Jan 2010
Location: Khi, Pakistan
Old 09-11-2011 , 05:42   Re: Array Copy Stock
Reply With Quote #25

Tags are numbers ? I mean the the Float: tag is a specific number ?
__________________

My Plugins For ZP

Inactive due to College and Studies
abdul-rehman is offline
Send a message via Yahoo to abdul-rehman Send a message via Skype™ to abdul-rehman
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 09-11-2011 , 05:43   Re: Array Copy Stock
Reply With Quote #26

You can say that, yes.
__________________
Arkshine is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 09-11-2011 , 10:04   Re: Array Copy Stock
Reply With Quote #27

Quote:
Originally Posted by abdul-rehman View Post
Tags are numbers ? I mean the the Float: tag is a specific number ?
Everything is a number of some sort on a computer.
__________________
Bugsy is offline
abdul-rehman
Veteran Member
Join Date: Jan 2010
Location: Khi, Pakistan
Old 09-11-2011 , 10:19   Re: Array Copy Stock
Reply With Quote #28

Quote:
Originally Posted by Bugsy View Post
Everything is a number of some sort on a computer.
I thought about that, but its confirmed
__________________

My Plugins For ZP

Inactive due to College and Studies
abdul-rehman is offline
Send a message via Yahoo to abdul-rehman Send a message via Skype™ to abdul-rehman
Old 09-14-2011, 01:12
harrymac
This message has been deleted by Emp`. Reason: spam
G[o]Q
Member
Join Date: Jan 2010
Location: Poland (Malopolska)
Old 03-14-2012 , 15:31   Re: Array Copy Stock
Reply With Quote #29

to copy arrays you can use something like this

Code:
new array1[5]={1,2,3,4,5}
new array2[5];
new i=0;

while(array1[i]=array2[i]){i++;}
you can change value of 'i' and copy only from first position
G[o]Q is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 03-14-2012 , 16:04   Re: Array Copy Stock
Reply With Quote #30

Quote:
Originally Posted by G[o]Q View Post
to copy arrays you can use something like this

Code:
new array1[5]={1,2,3,4,5}
new array2[5];
new i=0;

while(array1[i]=array2[i]){i++;}
you can change value of 'i' and copy only from first position
Loop until the plugin breaks at a runtime error of "index out of bounds" ?
Good one.
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
Reply



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

Forum Jump


All times are GMT -4. The time now is 06:51.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode