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

Contact, Regular CMD, Config?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Remilia Scarlet
SourceMod Donor
Join Date: Jun 2012
Location: Scarlet Devil Mansion
Old 11-29-2015 , 23:44   Contact, Regular CMD, Config?
Reply With Quote #1

I've got a few questions. as i've just started to look into sourcepawn in general (seeing as what i used to do before, kinda went to worse - not on my part).

For the whole :
Code:
public Plugin myinfo =
{
    name = "KebabOnAStick",
    description = "Something new and sticky.",
    author = "Remilia Scarlet",
    version = "0.0.1",
    url = "www.sourcemod.net"
};
is it possible to do something like this :
Code:
public Plugin myinfo =
{
    name = "KebabOnAStick",
    description = "Something new and sticky.",
    author = "Remilia Scarlet",
    version = "0.0.1",
    url = "www.sourcemod.net",
    steam = "http://steamcommunity.com/"
};
it gave me a error, when i did indeed try it. so it's more a question as to what my limits are in that area.

Quote:
error 096: could not find member "steam" in struct "myinfo"
That's the error it gave.

on another note. i saw that the sourcepawn tutorial shows how the admincmd thing works, but my question is. for instance, i want a ingame command like !poke and it would say like "Name poked everyone, with a pointy stick" (just an example). what command / function would i need to use, if it's a free to use - non admin command thing.

Something i might have missed in the tutorial is how to do configs. for instance a cfg in cfg/sourcemod/KebabOnAStick/KebabOnAStick.cfg

Hopefully this didn't sound all to stupid.

Thank you for your help and time on this (wasn't sure as to where, to ask. including the search function kinda confused me more than helping. might just be a thing i have to get used to before, it wont o_o)

EDIT : Forgot to add errors.
EDIT2 : should probably read what i post, before posting it <.<.

Last edited by Remilia Scarlet; 11-30-2015 at 00:30.
Remilia Scarlet is offline
Send a message via Skype™ to Remilia Scarlet
Sillium
AlliedModders Donor
Join Date: Sep 2008
Location: Germany
Old 11-30-2015 , 01:51   Re: Contact, Regular CMD, Config?
Reply With Quote #2

You can't just add stuff the to struct. myInfo has no field "steam":
https://sm.alliedmods.net/doxygen/st...s.html#details

You can register a command with: https://sm.alliedmods.net/new-api/console/RegConsoleCmd

You can auto create configs with: https://sm.alliedmods.net/new-api/so...AutoExecConfig


Did you read the through the examples in the Wiki?
https://wiki.alliedmods.net/Introduc...rcemod_plugins
https://wiki.alliedmods.net/Category...emod_scripting
__________________
brb, dishes have developed their own language and are talking to the garbage about overthrowing me... i must correct this

www.unterwasserpyromanen.de

Last edited by Sillium; 11-30-2015 at 01:52.
Sillium is offline
Remilia Scarlet
SourceMod Donor
Join Date: Jun 2012
Location: Scarlet Devil Mansion
Old 11-30-2015 , 08:08   Re: Contact, Regular CMD, Config?
Reply With Quote #3

Quote:
Originally Posted by Sillium View Post
You can't just add stuff the to struct. myInfo has no field "steam":
https://sm.alliedmods.net/doxygen/st...s.html#details
I see.. wasn't sure as to weither i could or not, so this really helps alot. thank you !

Quote:
Originally Posted by Sillium View Post
so this would work :
Code:
#include <sourcemod>
#include <sdktools>

public Plugin myinfo =
{
    name = "asdasd",
    description = "Tortouise",
    author = "Remilia Scarlet",
    version = "0.0.1",
    url = "None as of Yet"
};

public void OnPluginStart()
{    
    RegConsoleCmd("sm_diary", Command_diary);
}

public Action:Command_diary(client, args)
{
    PrintToChat(client, "[\x03Peanut\x01]", "My diary was stolen D:");
}
Quote:
Originally Posted by Sillium View Post
will have to look at that. thank you !

Quote:
Originally Posted by Sillium View Post
i may or may not have been slightly confused when reading that thing. but seeing the first links you posted, it made more sense for me o_O. not sure how or why. but it just did. will have to look a little deeper. Thank you !

Last edited by Remilia Scarlet; 11-30-2015 at 08:08.
Remilia Scarlet is offline
Send a message via Skype™ to Remilia Scarlet
Chdata
Veteran Member
Join Date: Aug 2012
Location: Computer Chair, Illinois
Old 11-30-2015 , 09:15   Re: Contact, Regular CMD, Config?
Reply With Quote #4

Small tip for colored chat:

https://forums.alliedmods.net/showthread.php?t=185016

Lets you define your own colors and use things like {green} instead of /x03.

#include <morecolors>

It pretty much copies the names of PrintToChat, PrintToChatAll, etc, with a C in front (if you look in the file you can see that), so to change over to morecolors you just replace it with CPrintToChat / CPrintToChatAll / etc.
__________________

Last edited by Chdata; 11-30-2015 at 09:16.
Chdata is offline
Remilia Scarlet
SourceMod Donor
Join Date: Jun 2012
Location: Scarlet Devil Mansion
Old 11-30-2015 , 09:59   Re: Contact, Regular CMD, Config?
Reply With Quote #5

Quote:
Originally Posted by Chdata View Post
Small tip for colored chat:

https://forums.alliedmods.net/showthread.php?t=185016

Lets you define your own colors and use things like {green} instead of /x03.

#include <morecolors>

It pretty much copies the names of PrintToChat, PrintToChatAll, etc, with a C in front (if you look in the file you can see that), so to change over to morecolors you just replace it with CPrintToChat / CPrintToChatAll / etc.
I SEE.. thank you.. was just playing with some colors to see how it turned out. Was curious as to getting a different color at some point, as i'd love to get something like pink / purple'ish colors. so will definitely have to look at this ..

as for the link, i'd assume that i'd need to have the inc in my scripting folder, but upon releasing a plugin, would i need to add that file aswell or would it work just fine whitout it?

EDIT: actually. i just played with it and it explained itself. i don't need it on the server. it does just fine whitout the include there.. on another note. the command executes and everything. but the console says something like "unknown command sm_diary". but the !diary did work. so not sure if this is something i need to ignore or if i did something wrong on that side..

Last edited by Remilia Scarlet; 11-30-2015 at 11:44.
Remilia Scarlet is offline
Send a message via Skype™ to Remilia Scarlet
Chdata
Veteran Member
Join Date: Aug 2012
Location: Computer Chair, Illinois
Old 11-30-2015 , 15:04   Re: Contact, Regular CMD, Config?
Reply With Quote #6

.inc files generally go in scripting/include (cause it's an include file)

#include <filename>

literally means it's including the file into your source code .sp - pretend the contents of the .inc got copy pasted where you have that #include <filename>

It gets compiled into your .smx, which is what the game actually runs. your game otherwise doesn't run raw source code (which a .sp and .inc are).

If you release it, just link to the same thread saying that your plugin uses morecolors. It's only important for other developers who want to edit your .sp, as they need the same .inc files as you to compile it.

You can add new hex colors at the bottom. Follow the syntax you see already there.




If you register a /command, you have to always

return Plugin_Handled;

That blocks the unknown command stuff with custom sm_commands.
__________________

Last edited by Chdata; 11-30-2015 at 15:06.
Chdata is offline
Remilia Scarlet
SourceMod Donor
Join Date: Jun 2012
Location: Scarlet Devil Mansion
Old 11-30-2015 , 15:31   Re: Contact, Regular CMD, Config?
Reply With Quote #7

Quote:
Originally Posted by Chdata View Post
.inc files generally go in scripting/include (cause it's an include file)

#include <filename>

literally means it's including the file into your source code .sp - pretend the contents of the .inc got copy pasted where you have that #include <filename>

It gets compiled into your .smx, which is what the game actually runs. your game otherwise doesn't run raw source code (which a .sp and .inc are).

If you release it, just link to the same thread saying that your plugin uses morecolors. It's only important for other developers who want to edit your .sp, as they need the same .inc files as you to compile it.

You can add new hex colors at the bottom. Follow the syntax you see already there.
Lovely!. that was exactly what i wanted to know. thank you

Quote:
Originally Posted by Chdata View Post
If you register a /command, you have to always

return Plugin_Handled;

That blocks the unknown command stuff with custom sm_commands.
so this :
Code:
#include <sourcemod>
#include <morecolors>

public Plugin myinfo =
{
    name = "Bacon Snickers",
    description = "Bacon is love, bacon is life.",
    author = "Remilia Scarlet",
    version = "0.0.1",
    url = "www.sourcemod.net"
};

public void OnPluginStart()
{
    RegConsoleCmd("sm_bs", Command_BaconSnickers);
}

public Action:Command_BaconSnickers(client, args)
{
    CPrintToChatAll("{deeppink}BaconSnickers{violet} Taste nasty whitout caramel.")
    return Plugin_Handled;
}
should work. or would i need to place it somewhere else. to make it function properly.. i did notice that this actually removed the unknown command part, but just wanted to be sure. that it was actually here to add

Last edited by Remilia Scarlet; 11-30-2015 at 15:32.
Remilia Scarlet is offline
Send a message via Skype™ to Remilia Scarlet
Chdata
Veteran Member
Join Date: Aug 2012
Location: Computer Chair, Illinois
Old 11-30-2015 , 22:51   Re: Contact, Regular CMD, Config?
Reply With Quote #8

You could answer that one yourself by testing the code you just made.

Actually it looks like you answered your own question by doing so.
__________________
Chdata is offline
Remilia Scarlet
SourceMod Donor
Join Date: Jun 2012
Location: Scarlet Devil Mansion
Old 11-30-2015 , 23:11   Re: Contact, Regular CMD, Config?
Reply With Quote #9

Quote:
Originally Posted by Chdata View Post
You could answer that one yourself by testing the code you just made.

Actually it looks like you answered your own question by doing so.
i'll assume i did place it the right place then :b .. thank you tho, just wasn't completely sure as to if this was the way to use it or not. but guess it is..

Thank you for the help so far
Remilia Scarlet is offline
Send a message via Skype™ to Remilia Scarlet
Reply



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 00:50.


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