| Blockland Forums > Modification Help |
| Need help scripting. |
| << < (15/31) > >> |
| Port:
--- Quote from: zefoo on June 27, 2012, 05:56:29 PM ---Thanks now how can you check if a say String1 is in String2? --- End quote --- You know how to compare numeric values. You can find the position of String1 in String2 with strPos(String2, String1) (striPos for case insensitivity). Figure out the rest. |
| zefoo:
--- Quote from: Port on June 27, 2012, 05:57:41 PM ---You know how to compare numeric values. You can find the position of String1 in String2 with strPos(String2, String1) (striPos for case insensitivity). Figure out the rest. --- End quote --- Thanks Now for the other question... How do you get a list of everyone on the server? Could you do something like --- Code: ---for each player in server { Echo(%playername); } --- End code --- ? |
| Port:
--- Quote from: zefoo on June 27, 2012, 05:58:52 PM ---Thanks --- End quote --- Oh, I forgot to mention that they return -1 if it isn't found. --- Quote from: zefoo on June 27, 2012, 05:58:52 PM ---How do you get a list of everyone on the server? --- End quote --- There's a group of gameConnection objects called clientGroup which (as all groups do) has the functions getCount() and getObject(index), which returns the amount of clients and a specific client, respectively. IIRC for loops have been demonstrated before in this topic. |
| zefoo:
--- Quote from: Port on June 27, 2012, 06:09:32 PM ---Oh, I forgot to mention that they return -1 if it isn't found. There's a group of gameConnection objects called clientGroup which (as all groups do) has the functions getCount() and getObject(index), which returns the amount of clients and a specific client, respectively. IIRC for loops have been demonstrated before in this topic. --- End quote --- Sorry but could you please just show me an example of code that could echo the list one name at a time until its done? |
| Port:
--- Quote from: zefoo on June 27, 2012, 06:13:54 PM ---Sorry but could you please just show me an example of code that could echo the list one name at a time until its done? --- End quote --- --- Code: ---%count = clientGroup.getCount(); for ( %i = 0 ; %i < %count ; %i++ ) { %client = clientGroup.getObject( %i ); echo( %client.getPlayerName() ); } --- End code --- |
| Navigation |
| Message Index |
| Next page |
| Previous page |