AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting (https://forums.alliedmods.net/forumdisplay.php?f=107)
-   -   Saying "Welcome" To player who said "Hi" or "Hello" (https://forums.alliedmods.net/showthread.php?t=333112)

sukodaime 06-19-2021 17:50

Saying "Welcome" To player who said "Hi" or "Hello"
 
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?

dustinandband 06-19-2021 21:47

Re: Saying "Welcome" To player who said "Hi" or "Hello"
 
You can use RequestFrame. Also should return Plugin_Continue at the end of your callback action.


All times are GMT -4. The time now is 08:34.

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