Raised This Month: $51 Target: $400
 12% 

Solved KeyValues ? ?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
DazhLarsson
Junior Member
Join Date: Dec 2012
Location: Denmark
Old 01-27-2020 , 08:49   KeyValues ? ?
Reply With Quote #1

Hello! x1 got the value 240 in the data base, i want it to print the value the value from MyFile in chat based on what x1 is in the database, so if its 240 in the database it would say Shows value from 240, and if 250, Shows value from 250.

What wrong with my code :s ?

Hope u guys understand me.

PHP Code:
    char x1[128];
    
char list[128];
    
char buffer[256];
    while (
SQL_FetchRow(hndl)) {

        
SQL_FetchString(hndl7x1sizeof(x1));
    
        
        
    
KeyValues kv = new KeyValues("MyFile");
    
kv.ImportFromFile("MyFile.txt");
    
kv.JumpToKey(list);
    
kv.GetString(x1buffersizeof(buffer));
        
        
        
        
        
PrintToChatAll("%s"buffer); 
MyFile
PHP Code:
"MyFile"
{
    
"list"
    
{
        
"240"        "Shows value from 240"
        "250"        "Shows value from 250
    }


Last edited by DazhLarsson; 01-27-2020 at 12:02.
DazhLarsson is offline
Ilusion9
Veteran Member
Join Date: Jun 2018
Location: Romania
Old 01-27-2020 , 09:32   Re: KeyValues ? ?
Reply With Quote #2

PHP Code:
char x1[128];
char buffer[256];

while (
SQL_FetchRow(hndl))
{
        
SQL_FetchString(hndl7x1sizeof(x1));
        
KeyValues kv = new KeyValues("MyFile");
        if (
kv.ImportFromFile("MyFile.txt"))
        {
                if (
kv.JumpToKey("list"))
                {
                        
kv.GetString(x1buffersizeof(buffer));
                }
        }
        
delete kv;

        
PrintToChatAll("%s"buffer); 

__________________

Last edited by Ilusion9; 01-27-2020 at 09:34.
Ilusion9 is offline
DazhLarsson
Junior Member
Join Date: Dec 2012
Location: Denmark
Old 01-27-2020 , 11:22   Re: KeyValues ? ?
Reply With Quote #3

Thx! )

Last edited by DazhLarsson; 01-27-2020 at 12:02.
DazhLarsson is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


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


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