AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Join a array of strings into one string (https://forums.alliedmods.net/showthread.php?t=6726)

FullThrottle 10-12-2004 12:37

Join a array of strings into one string
 
I would like to take a array of rules I have and join them together to display them on the screen as a hud message. What would be the best way to do this. Here is an example.

amxx.cfg

Code:

amx_addrule "Respect the Admins"
amx_addrule "No Team Killing"

Displayed to the user upon team select in a tsay type message in the top left of the screen.

Code:

Server Rules
1. Respect the Admins
2. No Team Killing

I tried looping through with each line as a new hud message and on a different channel but I think there must be a better way.

I have everything working except the joining of the strings and displaying on the screen part.

Thanks for your help.

EKS 10-12-2004 22:50

Code:
#define ArraySize 10 new MyString[65] new MyArray[ArraySize+1][32] for(new i=0;i<=ArraySize;i++) format(MyString,64,"%s %s",MyString,MyArray[i])

This is how i normaly do it

FullThrottle 10-13-2004 00:07

This is how I ended up doing it in my plugin

Code:

        for (new i=0; i<num_rules; ++i){
                add(str_rules,len,rulelist[i])
        }



All times are GMT -4. The time now is 17:10.

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