Thread: [Solved] What wrong is my array?
View Single Post
_COLOURFUL
Member
Join Date: May 2017
Location: Hong Kong
Old 08-08-2017 , 08:52   Re: What wrong is my array?
Reply With Quote #7

This is my latest code, i can't output any result pls help me ;c
PHP Code:
#include <sourcemod>

static String:KVPath[PLATFORM_MAX_PATH];
new 
String:Words[100][4];


public 
Plugin:myinfo 
{
name "Key Values",
author "Hoursplayed.net",
description "",
url "http://hoursplayed.net"
}

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

public 
Action:Command_Say(clientargs)
{
    
decl String:arg1[200];
    
    
GetCmdArg(1arg1sizeof(arg1));
    
    for(new 
0;100;i++)
    {
        if(!
StrEqual(Words[i][0], "") && !StrEqual(Words[i][1], ""))
        {
            if(
StrContains(arg1Words[i][0], false) != -1)
            {
                
PrintToChatAll("%s"Words[i][1]);
                
ServerCommand("sm_slap @all");
            } else continue;
        } else continue;
    }
    return 
Plugin_Continue;
}

public 
LoadWord()
{
    new 
Handle:DB CreateKeyValues("Speech");
    
FileToKeyValues(DBKVPath);
    
KvGotoFirstSubKey(DB); // Start
    
new 1String:iInt[32];
    
IntToString(iiIntsizeof(iInt));
    while(
KvJumpToKey(DBiInt))
    {
        new 
String:match[32], String:answer[32];
        
KvGetString(DB"match"match[1], 32);
        
KvGetString(DB"answer"answer[1], 32);
        
Words[1][0] = match[1];
        
Words[1][1] = answer[1];
        
i++
        
IntToString(iiIntsizeof(iInt));
        
CloseHandle(DB);
    }

PHP Code:
"Speech"
{
    
"0"
    
{
        
"match"        "fml"
        "answer"    "okay"
    
}
    
"1"
    
{
        
"match"        "diu"
        "answer"    "on9"
    
}

__________________
Love Dodgeball

Last edited by _COLOURFUL; 08-08-2017 at 09:26.
_COLOURFUL is offline