AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Adding two arrays (https://forums.alliedmods.net/showthread.php?t=75150)

Salin 07-31-2008 10:03

Adding two arrays
 
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.

Arkshine 07-31-2008 10:13

Re: Adding two arrays
 
You can use str_to_num().

str_to_num( MyArray1 ) + str_to_num( MyArray2 )


But provide a full exemple which cause you some problems.

Salin 07-31-2008 11:28

Re: Adding two arrays
 
Ah yeah, works. Thnx for the info.


All times are GMT -4. The time now is 05:30.

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