Raised This Month: $ Target: $400
 0% 

Adding two arrays


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Salin
Member
Join Date: Nov 2007
Old 07-31-2008 , 10:03   Adding two arrays
Reply With Quote #1

How is it possible to add two arrays and to compare the result in an "if" clause, without getting the "array must be indexed" error?


Example:

A command that stores a score into an array (with read_argv) then the sum of two arrays must be compare with an integer.
Salin is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 07-31-2008 , 10:13   Re: Adding two arrays
Reply With Quote #2

You can use str_to_num().

str_to_num( MyArray1 ) + str_to_num( MyArray2 )


But provide a full exemple which cause you some problems.
__________________
Arkshine is offline
Salin
Member
Join Date: Nov 2007
Old 07-31-2008 , 11:28   Re: Adding two arrays
Reply With Quote #3

Ah yeah, works. Thnx for the info.
Salin 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 05:30.


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