Half-Life и Adrenaline Gamer форум
http://aghl.ru/forum/

check value ?
http://aghl.ru/forum/viewtopic.php?f=12&t=2478
Страница 1 из 1

Автор:  abdobiskra [ 14 июн 2016, 17:48 ]
Заголовок сообщения:  check value ?

Hi how i can check value

For example, I want to pick up Msg in the screen and this Msg have value (ex: 1 or 2 ... ) It is changing from time to time

i try :
Код:
if (equali(szValue, "1")) 
Did not succeed !
my general idea i want change value text to other text ex ( value = 1 change to value = On) (value = 0 change to value = Off)

Изображение
my code ?

Код:
    new stra[32], szValue[ 30 ]
                    if (equali(szValue, "1"))
                    copy(stra, charsmax(stra), "On");
                    else
                    format(stra, 2, "%s", szValue);

Автор:  Lev [ 14 июн 2016, 22:38 ]
Заголовок сообщения:  Re: check value ?

You should split the whole string first, then find needed string at correct position, replace and concatenate the strings back into single string.

Автор:  abdobiskra [ 18 июн 2016, 21:36 ]
Заголовок сообщения:  Re: check value ?

Цитата:
You should split the whole string first
its long string contains lines under each (^n)
starting with
Код:
if( equal(szMessage, "TL", 2) )
Цитата:
replace and concatenate the strings back into single string.
like what i do Up ? (its correct way ?)

Автор:  Lev [ 18 июн 2016, 23:14 ]
Заголовок сообщения:  Re: check value ?

string.inc:
Код:
/* Replaces given string to another in given text. */
native replace(text[], len, const what[], const with[]);
Try this one:
Код:
replace(text, charsmax(text), "= 0^r", "= Off^r");

Автор:  abdobiskra [ 19 июн 2016, 03:54 ]
Заголовок сообщения:  Re: check value ?

Yeah! Work
but without (^r)
I have some questions
1) i want to know what you mean about this ? (^r)
2) replace native its work like (return PLUGIN_HANDLED;) ?
i mean this tow function its work to remove orginal Msg ?

Автор:  Lev [ 19 июн 2016, 12:17 ]
Заголовок сообщения:  Re: check value ?

abdobiskra писал(а):
1) i want to know what you mean about this ? (^r)
Match with the end of the line. So it doesn't match "= 10" for example. Try "^n" instead of "^r".
abdobiskra писал(а):
2) replace native its work like (return PLUGIN_HANDLED;) ?
i mean this tow function its work to remove orginal Msg ?
Didn't got what you are asking. May be if this function will change string in the message. No, it will change text in the string you are giving to it.

Автор:  abdobiskra [ 19 июн 2016, 13:04 ]
Заголовок сообщения:  Re: check value ?

Цитата:
May be if this function will change string in the message. No, it will change text in the string you are giving to it.
yes this what i want know :)

Страница 1 из 1 Часовой пояс: UTC + 5 часов [ Летнее время ]
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/