AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Return inside ``'s (https://forums.alliedmods.net/showthread.php?t=174778)

Xalus 12-25-2011 07:11

Return inside ``'s
 
For example:

`Kill_1` = '5', `Kill_2` = '6'
or
`Kill_1` = '5', `Kill_2` = '8', `Kill_3` = '9'


How to return all strings inside ``'s

ConnorMcLeod 12-25-2011 07:14

Re: Return inside ``'s
 
Explain better from what you start and what you want as result please.

Xalus 12-25-2011 07:23

Re: Return inside ``'s
 
Its for achievement api,

so I save with a stringt,

for example:

Ach_Save("`Kill_1` = '5', `Kill_2` = '8', `Kill_3` = '9'", steamid)

Then main achievement handler,

needs to get all inside ``'s
->
So: `Kill_1` `Kill_2` `Kill_3`

& then I can check if player earned an achievement.

I hope u understand it a little more now :p

ConnorMcLeod 12-25-2011 07:40

Re: Return inside ``'s
 
And what is the problem ?
If a char is not passed or make the string to be cut, then use the ctrl char \ before that char.

fysiks 12-25-2011 18:32

Re: Return inside ``'s
 
I don't entirely understand what you are actually doing but it sounds like you need to rethink your method of storing that info and how you store it in memory when you read it from where you permanently store it.

How are you storing this info in permanent storage? Nvault? txt? etc.

nikhilgupta345 12-25-2011 23:52

Re: Return inside ``'s
 
I'm guessing that he's using SQL, and he's using the single quotations to signify a string in mysql.

You could use the escape character '^' in order to use the single quotations without the compiler thinking that it is a start of a char. Then, you could use strtok or strbreak in order to get the individual parameters within it.

For example: Ach_Save("^'Kill_1^' = ^'5^', ^'Kill_2^' = ^'8^', ^'Kill_3^' = ^'9^'", steamid );

fysiks 12-26-2011 00:20

Re: Return inside ``'s
 
Quote:

Originally Posted by nikhilgupta345 (Post 1619694)
I'm guessing that he's using SQL, and he's using the single quotations to signify a string in mysql.

You could use the escape character '^' in order to use the single quotations without the compiler thinking that it is a start of a char. Then, you could use strtok or strbreak in order to get the individual parameters within it.

For example: Ach_Save("^'Kill_1^' = ^'5^', ^'Kill_2^' = ^'8^', ^'Kill_3^' = ^'9^'", steamid );

You don't need to escape a non-control character.

nikhilgupta345 12-26-2011 10:07

Re: Return inside ``'s
 
Quote:

Originally Posted by fysiks (Post 1619706)
You don't need to escape a non-control character.

:O Just realized that.

No idea what he's asking for then.


All times are GMT -4. The time now is 11:50.

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