Plugin Request
devicenull
Join Date: 2003-04-30 Member: 15967Members, NS2 Playtester, Squad Five Blue
<div class="IPBDescription">Edit entities ingame</div> Simply put, I would like a plugin that would allow admins to delete/create entities, in game.
Also, maybe allow admins to remove buildings, without refunding money
I'd prefer AMX or metamod, but I guess I could use adminmod..
Also, maybe allow admins to remove buildings, without refunding money
I'd prefer AMX or metamod, but I guess I could use adminmod..
Comments
Look back in 5 minutes. <!--emo&:D--><img src='http://www.unknownworlds.com/forums/html/emoticons/biggrin.gif' border='0' style='vertical-align:middle' alt='biggrin.gif'><!--endemo-->
EDIT: Oh dunno about creating entities, that might take a bit more work, but removting is easy.
Needs the NS2AMX module. Hopefully this points out why the ns2amx module is such a big deal. It means pretty much any plugin you can think of can be created in a very short period of time for amxmod.
<li>There's no list of which buildings correspond to which number. I'm planning on including a nice menu to allow you to choose what you want to spawn.
<li>Some buildings are at funny angles (e.g. mines). This will be fixed in the final release.
<li>Some buildings crash the server when they are build (e.g. alien res nodes).
<li>Anyone can build. I plan to include the option of only allowing admins to use this in the final version.
</ul>
I really didn't think it would be done this fast, thanks a lot <!--emo&:)--><img src='http://www.unknownworlds.com/forums/html/emoticons/smile.gif' border='0' style='vertical-align:middle' alt='smile.gif'><!--endemo-->
Looking at the source for one of them, I may just try a little bith of stuff with AMX and plugins <!--emo&:)--><img src='http://www.unknownworlds.com/forums/html/emoticons/smile.gif' border='0' style='vertical-align:middle' alt='smile.gif'><!--endemo-->
Needs the NS2AMX module. Hopefully this points out why the ns2amx module is such a big deal. It means pretty much any plugin you can think of can be created in a very short period of time for amxmod. <!--QuoteEnd--> </td></tr></table><span class='postcolor'> <!--QuoteEEnd-->
n00b
<!--emo&::nerdy::--><img src='http://www.unknownworlds.com/forums/html/emoticons/nerd.gif' border='0' style='vertical-align:middle' alt='nerd.gif'><!--endemo-->
For the benefit of the builder, could you be a little more specific ??
Not to stray off topic, but did a final version ever come out on this that works?
kwikloader: the latest version of ChamberSeeding is 3.5 and is available from www.modns.org. I've had conflicting reports about it's stability; some people are having problems with it, but most arn't. I'll likely release an update to fix a few issues that have cropped up once NS2.1 is released.
<b>EDIT: </b>Okay, the plugin is available <a href='http://www.modns.org/forums/index.php?act=ST&f=4&t=138' target='_blank'>here</a>. Electrifying and upgrading buildings didn't make it in, but the admin restrict/menu system did. Some buildings will cause crashes; these are clearly marked.
Or a metamod plugin which just removes entities? I'm very interested in using this plugin so I can give other co-admins the ability to deal with buildings that are built in 'exploitable' places, but on the other hand I do not wish to give the ability to add entities.
You can do some funky things that screw things over till map changes(such as removing a ComChair?), or cause crashes.
Even send players into there own funky domain by removing there player entity. Its juse wacky and something that you should only allow yourself as the server admin to use if any.
Bottom line, there is just no reason to have a ingame entity remover except for fun, but even then its not that much fun...
But GL and watch what you remove <!--emo&:p--><img src='http://www.unknownworlds.com/forums/html/emoticons/tounge.gif' border='0' style='vertical-align:middle' alt='tounge.gif'><!--endemo-->
I removed a hive and it was gone completely, even next round.
Its good for removing an oc blocking an resource nozzle though. Or if your server doesn't allow people to build outside on hera.
It does nothing it all, no prints, no tooltips, no nothing..
It does show up when I do amx plugins
<!--c1--></span><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td><b>CODE</b> </td></tr><tr><td id='CODE'><!--ec1-->#include <amxmod>
#include "ns2amx.inc"
/*
By Devicenull
darkmage@snet.net
Version 0.1
Limit Onos Res
CVars:
mp_limitonosres <n> limit onos res to that number, defualt 6
Less then 6 is not reccommended, otherwise the onos cannot get any upgrades
Todo:
*Distribute Removed Res to Gorges on the same team
*Possibly add giveres functions as well
*/
public plugin_init() { //Sets info about the plugin
register_plugin("Limit Onos Res","0.1","Devicenull") //Give the plugin a name, version, and author
register_cvar("mp_limitonosres","6") //Limit the amount of res an onos can have, defualt 6
//register_cvar("mp_giveres","1") //Enable giving of res to a player
//register_clcmd("say giveres","giveres") //Register the giveres command, so we can use it
//register_clcmd("team_say giveres","giveres") //Register the giverres command, so we can use it
set_task(1.0,"removeonosres") //Check the onoses res every second
}
public client_putinserver(id) { //Occurs when someone enters the server
onosresmsg(id) //Display the onos res tooltip
}
public removeonosres() {
new maxonosres //Read from cvar, mp_limitonosres.. the max res an onos can have
maxonosres = get_cvar_num("mp_limitonosres") //Get the value of mp_limitonosres
if (maxonosres > 0) { //If the plugin is enabled (anything higher then 0)
new pnum //Number of Players in game
new pcount //Loop counter, checking which players are onos
pnum = get_playersnum(0) //Set the number of players
if (pnum > 0) {
for(pcount=0; pcount==pnum; pcount = pcount+1) { //Start the loop
client_print(pcount,print_center,"We are looping")
if ( get_class(pcount) == 5) { //If the player is onos
if ( get_res(pcount) > maxonosres) { //And they have more then maxonosres res
ns2amx_setres(pcount,maxonosres) //Set their res back to maxonosres
}
}
}
}
}
}
public onosresmsg(id) { //Display the message about limiting onos res
new maxonosres //Max res an onos can have
maxonosres= get_cvar_num("mp_limitonosres") //Get the max onos res
if ( maxonosres ) { //If the plugin is enabled
//new onoscheckstring //Max res, converted to a string
//new msgstring[189] //The tooltip msg
//ns2amx_string(onoscheck,onoscheckstring) //Convert the number of res to a string
//copy(msgstring,189,"This server disallows gathering res as onos, you are allowed") //& maxonosres & " res as onos, more then that will be removed.")
ns2amx_nspopup(id,"Onosteststring") //Display the tooltip
}
}
<!--c2--></td></tr></table><span class='postcolor'><!--ec2-->
<span style='font-size:19pt;line-height:100%'>DON'T EVEN START ARGUING ABOUT IF I SHOULD BE DOING THIS, I REALLY DONT CARE WHAT YOU THINK</span>
<!--c1--></span><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td><b>CODE</b> </td></tr><tr><td id='CODE'><!--ec1--> for(pcount=0; pcount==pnum; pcount = pcount+1) { //Start the loop
<!--c2--></td></tr></table><span class='postcolor'><!--ec2-->
The first parameter is run when loop first starts, so pcount=0. The second one means keep doing this loop while this parameter is true pcount==pnum. That should be pcount<=pnum. Also for the last parameter you can just do pcount ++ and it will do the same thing.
Its generally accepted to use the letter i in loops and to initalize the variable in the loop. I dunno why they picked i, but they did and everyone does it so it makes things easier to read if you follow what everyone else does. It would look like this:
<!--c1--></span><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td><b>CODE</b> </td></tr><tr><td id='CODE'><!--ec1-->for(new i = 0; i <= pnum; i++)<!--c2--></td></tr></table><span class='postcolor'><!--ec2-->
ns2amx_nspopup(id,"Onosteststring") //Display the tooltip
<b>Edit:</b> Looking at it now, btw. From an early guess it looks like a problem with the cvar.
Here's the problems you had:
Your cvar only had a string value. cvar_get_num returns the floatround() of it's float value, I believe.
Your set_task was only set to be issued one time. It wouldn't loop like it was supposed to.
Your loop was ... awkward (what cheesy said earlier)
I don't think put in server was the best spot for that popup, I moved it to when the player evolves into onos.
I couldn't get copy() to work properly, so it displays a general message. Maybe a consgreet would be more appropriate.
Also, you were using ns2amx_string() improperly. HL Stores it's strings in PEV data as integers, and string will take that integer and convert it to string format. It's not likely you'll need it outside of PEV strings.
<b>Edit:</b> By the way, I think this plugin would have great potential. Especially if you made the extra resources overflow into the other teammates. Make that res hoarder first onos actually do the team some good in an indirect way.
Seems to work fine now, I can't test it..
I'm gonna start a <a href='http://www.unknownworlds.com/forums/index.php?act=ST&f=8&t=52275' target='_blank'>new thread</a> about this, but i have a question first.. after a "return", does the sub halt?
I have <!--c1--></span><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td><b>CODE</b> </td></tr><tr><td id='CODE'><!--ec1-->get_teams(ateam)
{
new pnum = get_playersnum() -1
new palien = 0
new pmarine = 0
for (new i=0; i<=pnum; i++) {
if (get_entdat_i(i,eni_team) == 2) {
palien++
}
if (get_entdat_i(i,eni_team) == 1) {
pmarine++
}
}
if (ateam == 1) {
return pmarine
}
if (ateam == 2) {
return palien
}
return 0
}<!--c2--></td></tr></table><span class='postcolor'><!--ec2-->
That should return the number of players to a team, correct? but will it then return 0 too?
And, I have a bunch of stuff like this, can I put this into an include, and have the server not be required to run another dll? And what would the format be for the include?
Also, with get_type, is there any way I could code something that allowed me to use onos, skulk, gorge, etc instead of numbers? The only way I see is making another get_type2 that substitues the correct number I see the enums in the ns2amx.inc file, can I use this for the different classes?
return will cause it to exit and not carry on. So if it returns 0 then it means they are not alien or marine. Which is fine.
As for get_type2, I don't think it is possible. I tried to do the same thing myself. But after lots of searching the AMX forums I came to the conclusion you cannot return strings. You would have to make some global strings and change them. If you look at my teamres plugin you can see how I handled getting their class.
I don't know what you mean about not having to run another dll?
You should use else if below as it can only be one or the other. Plus why get_playersnum()-1? If anything I'd add 1 to it as I have a feeling its not always accurate.
<!--c1--></span><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td><b>CODE</b> </td></tr><tr><td id='CODE'><!--ec1--> if (get_entdat_i(i,eni_team) == 2) {
palien++
} else if (get_entdat_i(i,eni_team) == 1) {
pmarine++
}<!--c2--></td></tr></table><span class='postcolor'><!--ec2-->
The way half-life handles strings in PEV data is by converting it to an integer. The ns2amx module allows you to convert strings->integers and vice versa. You could try something like:
<!--c1--></span><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td><b>CODE</b> </td></tr><tr><td id='CODE'><!--ec1-->
public get_class2(id)
{
if (get_class(id) == 1)
{
return ns2amx_make_string("Skulk")
}
else if (get_class(id) == 2)
{
return ns2amx_make_string("Gorge")
}
}
<!--c2--></td></tr></table><span class='postcolor'><!--ec2-->
And then in the script you would do something such as this:
<!--c1--></span><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td><b>CODE</b> </td></tr><tr><td id='CODE'><!--ec1-->
public show_class(id)
{
new svClass[32]
ns2amx_string(get_class2(id),svClass)
client_print(id,print_console,"Your class is: %s",svClass)
}
<!--c2--></td></tr></table><span class='postcolor'><!--ec2-->
Like I've said, I haven't tested it, but in theory, this method should work.
<b>Edit:</b> btw, this is some pretty big hijacking of your own thread. If you have any more ns2amx questions, please PM me on the modns forums, IRC, or on these forums. If you have general AMX questions, ask cheesy or post on the amx forums, please.