View Single Post
Author Message
sukodaime
Junior Member
Join Date: May 2021
Old 06-19-2021 , 17:50   Saying "Welcome" To player who said "Hi" or "Hello"
Reply With Quote #1

I made this plugin
Code:
#pragma semicolon 1
#define DEBUG
#define PLUGIN_AUTHOR ""
#define PLUGIN_VERSION ""
#include <sourcemod>
#include <sdktools>
public OnPluginStart()
{
	AddCommandListener(OnSay, "say");
	AddCommandListener(OnSay, "say_team");
}

public Action:OnSay(client, const String:command[], args)
{
	char list[][] =  { "Hi","Hello" };
    char text[4096];
    GetCmdArgString(text, sizeof(text));
    StripQuotes(text);
    char name[128]; 
    GetClientName(client,name,sizeof(name));
	for (int i = 0; i < sizeof(list); i++) {
    	if (StrEqual(text, list[i])){
    		PrintToChat(client," \x10 %s \x07 Welcome!",name);
    	}
	}
}
but when i say Hi, command says "Welcome!" before my text goes to chat
how can i fix it?it becomes
(gamechat)
Welcome!
player : Hi
-------------
i made one with CreateTimer 0.2 second delay it worked but i wondered if there is better way and is my solution good?

Last edited by sukodaime; 06-19-2021 at 17:50.
sukodaime is offline