View Single Post
KyleS
SourceMod Plugin Approver
Join Date: Jul 2009
Location: Segmentation Fault.
Old 12-03-2011 , 21:13   Re: [ANY] Web Shortcuts (Redux)
Reply With Quote #2

Reserved for documentation

Each section name works as a hook. So if you have a section that looks like the following:
PHP Code:
"rules"
{
    
"Url" "http://websitehere.com/rules/"
    "Title" "Rules and Regulations"

If you typed 'rules' in chat, the Url, along with the Title would be displayed to the client using a VGUI panel.

Now this is where things can get complicated, you can have the following
PHP Code:
"rules"
{
    
"Title"        "{NAME}"
    "Silent"    "Nope"
    "Url"        "http://SiteHere.com/index.php?id={FRIEND_ID}&Pickles={CURPLAYERS}"
}

"Rules2"
{
    
"Pointer"    "rules"
    "Title"     "{NAME}|{STEAM_ID}"
    "URL"        "http://SiteHerev2.com/index.php?IP={IP_ADDRESS}"
    "Big"        "Sure"

Rules2 overwrites rules with it's information and adds a hook named Rules2. rules has a Silent field though, this field remains untouched in the above example with a valid value of "Nope". The two functioning chat hooks calling this same block are rules and Rules2. At the moment, there's no real purpose to do this. Just modify the rules block and add a rules hook (explained below), you should be solid.

Here's a simple example of what you can do:
PHP Code:
"rules"
{
    
"Url" "http://websitehere.com/rules/"
    "Title" "Rules and Regulations"
    "Hook" "!rules"
    "Hook" "/rules"
}

"rulez"
{
    
"Pointer"    "rules"
    "Url"        "http://ADifferentWebsiteHere.com/Rules/
    "
Title"        "Different Title"
}

"
#RespectMahAuthoritahh"
{
    
"Silent"     "Yes"
    "Url"        "http://www.youtube.com/watch?v=D81vBcKfqpo"
}

"Authoriteh"
{
    
"Big"        "Yup"
    "Silent"    "Nope"
    "Url"        "http://www.youtube.com/watch?v=QDd07jhGcL0"
}

"%LoseIt"
{
    
"Big"        "Yup"
    "Title"        "Potato"
    "Url"        "http://www.youtube.com/watch?v=jI8gEU8-i8A"
    "Hook"        "LoseIt"
}

"GameMonitor"
{
    
"Title"        "Game Monitor Stats for {SERVER_NAME}"
    "Url"        "http://www.game-monitor.com/GameServer/{SERVER_IP}:{SERVER_PORT}/"
    "Big"        "Sure"
}

"!GameMonitor"
{
    
"Pointer"    "GameMonitor"
    "Hook"        "!Meh"
    "Hook"        "!Eggs"

In this block, we introduce the Hook key. When someone types !Meh, or !Eggs in chat, they're pointed to the GameMonitor block from the Pointer. Again, at this time, using a Pointer in the same file is just wrong. As well to this, Pointing to yourself is a syntax violation, it's unknown what will happen at this time.

You're more then welcome to not define keys, as a matter of fact, I suggest doing so. Nothing is required except for a URL and a Section name. Don't break the syntax!

Anything starting with a 1, y, Y, T, t, s, S means the key is true.
Anything starting with a 0, n, N, f, F means the key is false.

Last edited by KyleS; 12-03-2011 at 21:32.
KyleS is offline