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

Saying "Welcome" To player who said "Hi" or "Hello"


Post New Thread Reply   
 
Thread Tools Display Modes
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
dustinandband
Senior Member
Join Date: May 2015
Old 06-19-2021 , 21:47   Re: Saying "Welcome" To player who said "Hi" or "Hello"
Reply With Quote #2

You can use RequestFrame. Also should return Plugin_Continue at the end of your callback action.
dustinandband is offline
Reply


Thread Tools
Display Modes

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 17:05.


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