What I'm looking to do is create a command that activates when a player says a certain thing in chat. But I want it to consist of one single command that can be triggered through several different chat command options, and I also want to have each different chat command option do something different.
I used to know how to do this, but it's been awhile since I've done any major coding and I've completely forgotten how to do what I'm trying to do.
Here's the command I have so far
(not shown: the DisplayPage function)
PHP Code:
public Action:CommandInfo(client, args)
{
decl String:strUrl[1024];
Format(strUrl, sizeof(strUrl), "%s1.html", INFO_URL);
DisplayPage(client, strUrl);
return Plugin_Handled;
}
I've already got the INFO_URL define set up, I've got the DisplayPage function set up as well.
From here, I want this command to be triggered by the following (example) triggers:
- !info 1
- !info 2
- !info 3
And based on which of the 3 triggers a player says, the function of the command will change, as such:
!info 1
PHP Code:
decl String:strUrl[1024];
Format(strUrl, sizeof(strUrl), "%s1.html", INFO_URL);
DisplayPage(client, strUrl);
!info 2
PHP Code:
decl String:strUrl[1024];
Format(strUrl, sizeof(strUrl), "%s2.html", INFO_URL);
DisplayPage(client, strUrl);
!info 3
PHP Code:
decl String:strUrl[1024];
Format(strUrl, sizeof(strUrl), "%s3.html", INFO_URL);
DisplayPage(client, strUrl);
As you can see, the "Format(strUrl, sizeof(strUrl), "%s1.html", INFO_URL);" line changes for each trigger. "!info 1" would load up the 1.html page of the defined INFO_URL site. "!info 2" would load up the 2.html page, and so forth.
How would I go about accomplishing this? I can't quite remember and it's bugging the hell out of me.