String combination in code
#1

Hello everyone again,

I need this at a lot of things so it's a regular question:

Is it possible to put a combination of strings inside a code rule?

Example:
Код:
GivePlayerWeapon(playerid, (**), 500);
**= A combination of 2 strings.

I've got now this:

Код:
      new wep0 = 1, wep1, wep2, wep3, wep4, wep5, wep6, wep7, wep8, wep9, wep10, wep11, wep12, wep13, wep14, wep15, wep16, wep17, wep18, wep19, wep20,
      wep21, wep22, wep23, wep24, wep25, wep26, wep27, wep28, wep29, wep30, wep31, wep32, wep33, wep34, wep35, wep36, wep37, wep38, wep39, wep40, wep41,
      wep42, wep43;
      
      GivePlayerWeapon(playerid, (**), 500);
And when a player types: "/weapon [a number], a number is saved in a variable.

Now I want that ** a combination is of "wep" and then the variable so it reads this combination as 1 string and read then the string out.

Example:

I type: "/weapon 0"

The variable contains 0. The string wep0 contains 1. So, GivePlayerWeapon's weaponid is (wep0) and I get weapon with ID 1 and 500 ammo.


You can also see it like this in Vb.net:

Код:
Dim thevariable as Integer = 1
Msgbox("wep" & thevariable)
Reply


Messages In This Thread
String combination in code - by pascallj - 27.06.2009, 20:49
Re: String combination in code - by dice7 - 27.06.2009, 20:54
Re: String combination in code - by pascallj - 27.06.2009, 20:57
Re: String combination in code - by dice7 - 27.06.2009, 21:24
Re: String combination in code - by pascallj - 28.06.2009, 13:31
Re: String combination in code - by pascallj - 28.06.2009, 18:02

Forum Jump:


Users browsing this thread: 5 Guest(s)