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

What is wrong with my code?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
_COLOURFUL
Member
Join Date: May 2017
Location: Hong Kong
Old 08-07-2017 , 08:53   What is wrong with my code?
Reply With Quote #1

PHP Code:
#include <sourcemod>

static String:KVPath[PLATFORM_MAX_PATH];

public 
OnPluginStart() 
{
    
CreateDirectory("addons/sourcemod/configs",3);
    
BuildPath(Path_SMKVPathsizeof(KVPath), "configs/speech.cfg");
}

public 
OnClientPutInServer(client)
{
    
SavePlayerInfo(client);
}

public 
SavePlayerInfo(client)
{
    new 
Handle:DB CreateKeyValues("PlayerInfo");
    
FileToKeyValues(DBKVPath);
    
    new 
String:SID[32];
    
GetClientAuthId(clientAuthId_Steam2SIDsizeof(SID));
    
    if(
KvJumpToKey(DBSIDtrue))
    {
        new 
String:name[MAX_NAME_LENGTH], String:temp_name[MAX_NAME_LENGTH];
        
GetClientName(clientnamesizeof(name));
        
        
KvGetString(DB"name"temp_namesizeof(temp_name), "NULL")
        
        new 
connections KvGetNum(DB"connections"0);
        
        if(
StrEqual(temp_name"NULL") && connections == 0)
        {
            
PrintToChatAll("%s is new to the server!"name);
        }else {
            
PrintToChatAll("%s last connect as %s.And he has %d connections"nametemp_nameconnections);
        }
        
connections connections 1;
        
KvGetNum(DB"connections"connections);
        
KvSetString(DB"name"name);
        
        
KvRewind(DB);
        
KeyValuesToFile(DBKVPath);
        
CloseHandle(DB);
    }

PHP Code:
"PlayerInfo"
{
    
"STEAM_0:0:135383138"
    
{
        
"name"        "NAMO <3"
    
}

As you can see the plugins never count the connection times.
Where is wrong of this code?
__________________
Love Dodgeball
_COLOURFUL is offline
Peace-Maker
SourceMod Plugin Approver
Join Date: Aug 2008
Location: Germany
Old 08-07-2017 , 09:08   Re: What is wrong with my code?
Reply With Quote #2

You need to use KvSetNum.
__________________
Peace-Maker is offline
_COLOURFUL
Member
Join Date: May 2017
Location: Hong Kong
Old 08-07-2017 , 09:19   Re: What is wrong with my code?
Reply With Quote #3

AHHHHHHHHHHHHHHHHHHHHHHHHHHH I'm such a retarded.
Btw, Thank you your answer <3
__________________
Love Dodgeball
_COLOURFUL 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 21:06.


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