Question About How Ns Handles Players
Jackson_Dane
Join Date: 2002-11-01 Member: 2354Members
<div class="IPBDescription">Wheeeeeeee@!!!</div> I don't know if this is the right forum, but I suspect it's the best place to post this.
I was wondering how NS handles players. Is it different than CS?
Here's why I ask. I am attempting to use a script for AMX called spectating_admin. Basically you just point at a player and you get all kinds of options (like slap, slay, kick, ban) makes it much easier to admin. Anyway, it works fine in CS. You point and click, and they die. But for some reason in NS, everytime I try it, it tells me that I'm not pointing at a player.
here's the code:
<!--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-->
/* AMX Mod script.
*
* (c) Copyright 2002, OLO
* This file is provided as is (no warranties).
*
*/
/* admin with flag "m" must point someone (during spectating or when playing)
* and use "say specmenu" (the best way is just binding the command)
*/
#include <amxmod>
new aspec[33]
new agot[33]
public status_changed(id)
aspec[id] = read_data(2)
public do_action(id){
if (!(get_user_flags(id)&ADMIN_LEVEL_A)){
client_print(id,print_chat,"[AMX] You have no access to that command")
return PLUGIN_HANDLED
}
if (aspec[id] == 0){
client_print(id,print_chat,"[AMX] You must point at someone")
return PLUGIN_HANDLED
}
if (get_user_flags(aspec[id])&ADMIN_IMMUNITY){
client_print(id,print_chat,"[AMX] The player has immunity")
return PLUGIN_HANDLED
}
agot[id] = aspec[id]
new bmenu[256], name[32]
get_user_name(agot[id],name,32)
format(bmenu,256,"\ySpec Menu: %s^n\w^n1. Kick^n2. Ban on 5 min.^n3. Slay^n4. Slap^n5. Godmode^n6. Noclip^n7. Store My Origin^n8. Teleport^n^n0. Exit",name)
show_menu(id,(1<<0)|(1<<1)|(1<<2)|(1<<3)|(1<<4)|(1<<5)|(1<<6)|(1<<7)|(1<<9),bmenu)
return PLUGIN_CONTINUE
}
public action_menu(id,key){
if (!is_user_connected(agot[id])){
client_print(id,print_chat,"[AMX] This client has already exit the server")
return PLUGIN_CONTINUE
}
switch(key){
case 0: server_cmd("kick # %d",get_user_userid(agot[id]))
case 1: {
new temp[32]
get_user_authid(agot[id],temp,32)
server_cmd("banid 5.0 %s kick",temp)
}
case 2: user_kill(agot[id])
case 3: user_slap(id,5)
case 4: {
if(get_user_godmode(agot[id]))
set_user_godmode(agot[id],0)
else
set_user_godmode(agot[id],1)
}
case 5: {
if(get_user_noclip(agot[id]))
set_user_noclip(agot[id],0)
else
set_user_noclip(agot[id],1)
}
case 6: {
client_cmd(id,"amx_myorigin")
client_print(0,print_chat,"[AMX] Storing your origin....")
}
case 7: {
new name[32+1]
get_user_name(agot[id],name,32)
client_cmd(id,"amx_teleport %s",name)
}
}
return PLUGIN_CONTINUE
}
public amx_point(id) {
if (!(get_user_flags(id)&ADMIN_LEVEL_A)){
client_print(id,print_chat,"[AMX] You have no access to that command")
return PLUGIN_HANDLED
}
if (aspec[id] == 0){
client_print(id,print_chat,"[AMX] You must point at someone")
return PLUGIN_HANDLED
}
if (get_user_flags(aspec[id])&ADMIN_IMMUNITY){
client_print(id,print_chat,"[AMX] The player has immunity")
return PLUGIN_HANDLED
}
new name[32+1]
get_user_name(aspec[id],name,32)
new cmd[128]
read_args(cmd,128)
client_cmd(id,cmd,name)
return PLUGIN_HANDLED
}
public plugin_init() {
register_plugin("Spectating Admin","0.61","default")
register_event("StatusValue","status_changed","b","1=2")
register_menucmd(register_menuid("\ySpec Menu: "),1023,"action_menu")
register_clcmd("say specmenu","do_action",ADMIN_LEVEL_A,"say specmenu")
register_clcmd("amx_point","amx_point",ADMIN_LEVEL_A,"amx_point < %s > < command >")
return PLUGIN_CONTINUE
}
<!--c2--></td></tr></table><span class='postcolor'><!--ec2-->
I was wondering how NS handles players. Is it different than CS?
Here's why I ask. I am attempting to use a script for AMX called spectating_admin. Basically you just point at a player and you get all kinds of options (like slap, slay, kick, ban) makes it much easier to admin. Anyway, it works fine in CS. You point and click, and they die. But for some reason in NS, everytime I try it, it tells me that I'm not pointing at a player.
here's the code:
<!--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-->
/* AMX Mod script.
*
* (c) Copyright 2002, OLO
* This file is provided as is (no warranties).
*
*/
/* admin with flag "m" must point someone (during spectating or when playing)
* and use "say specmenu" (the best way is just binding the command)
*/
#include <amxmod>
new aspec[33]
new agot[33]
public status_changed(id)
aspec[id] = read_data(2)
public do_action(id){
if (!(get_user_flags(id)&ADMIN_LEVEL_A)){
client_print(id,print_chat,"[AMX] You have no access to that command")
return PLUGIN_HANDLED
}
if (aspec[id] == 0){
client_print(id,print_chat,"[AMX] You must point at someone")
return PLUGIN_HANDLED
}
if (get_user_flags(aspec[id])&ADMIN_IMMUNITY){
client_print(id,print_chat,"[AMX] The player has immunity")
return PLUGIN_HANDLED
}
agot[id] = aspec[id]
new bmenu[256], name[32]
get_user_name(agot[id],name,32)
format(bmenu,256,"\ySpec Menu: %s^n\w^n1. Kick^n2. Ban on 5 min.^n3. Slay^n4. Slap^n5. Godmode^n6. Noclip^n7. Store My Origin^n8. Teleport^n^n0. Exit",name)
show_menu(id,(1<<0)|(1<<1)|(1<<2)|(1<<3)|(1<<4)|(1<<5)|(1<<6)|(1<<7)|(1<<9),bmenu)
return PLUGIN_CONTINUE
}
public action_menu(id,key){
if (!is_user_connected(agot[id])){
client_print(id,print_chat,"[AMX] This client has already exit the server")
return PLUGIN_CONTINUE
}
switch(key){
case 0: server_cmd("kick # %d",get_user_userid(agot[id]))
case 1: {
new temp[32]
get_user_authid(agot[id],temp,32)
server_cmd("banid 5.0 %s kick",temp)
}
case 2: user_kill(agot[id])
case 3: user_slap(id,5)
case 4: {
if(get_user_godmode(agot[id]))
set_user_godmode(agot[id],0)
else
set_user_godmode(agot[id],1)
}
case 5: {
if(get_user_noclip(agot[id]))
set_user_noclip(agot[id],0)
else
set_user_noclip(agot[id],1)
}
case 6: {
client_cmd(id,"amx_myorigin")
client_print(0,print_chat,"[AMX] Storing your origin....")
}
case 7: {
new name[32+1]
get_user_name(agot[id],name,32)
client_cmd(id,"amx_teleport %s",name)
}
}
return PLUGIN_CONTINUE
}
public amx_point(id) {
if (!(get_user_flags(id)&ADMIN_LEVEL_A)){
client_print(id,print_chat,"[AMX] You have no access to that command")
return PLUGIN_HANDLED
}
if (aspec[id] == 0){
client_print(id,print_chat,"[AMX] You must point at someone")
return PLUGIN_HANDLED
}
if (get_user_flags(aspec[id])&ADMIN_IMMUNITY){
client_print(id,print_chat,"[AMX] The player has immunity")
return PLUGIN_HANDLED
}
new name[32+1]
get_user_name(aspec[id],name,32)
new cmd[128]
read_args(cmd,128)
client_cmd(id,cmd,name)
return PLUGIN_HANDLED
}
public plugin_init() {
register_plugin("Spectating Admin","0.61","default")
register_event("StatusValue","status_changed","b","1=2")
register_menucmd(register_menuid("\ySpec Menu: "),1023,"action_menu")
register_clcmd("say specmenu","do_action",ADMIN_LEVEL_A,"say specmenu")
register_clcmd("amx_point","amx_point",ADMIN_LEVEL_A,"amx_point < %s > < command >")
return PLUGIN_CONTINUE
}
<!--c2--></td></tr></table><span class='postcolor'><!--ec2-->
Comments
i know! i think they will ahve less overheard too. i'm working on AMX w/metasmall on my server now.....soon i will have it working.
Mellonpopr: I seriously don't think it has anything to do with Flayra and NS. AMX and Clanmod seem to work fine with NS. Adminmod is the only one that has trouble. I think it's just the way AM tries to handle rounds. It was built for CS, and it tends to still be CS specific. While AM and CM were built to work with all HL mods. Plus anything that you can do with AM you can do (better) with AMX. Give AMX a try, I know you'll like it <!--emo&:)--><img src='http://www.unknownworlds.com/forums/html/emoticons/smile.gif' border='0' valign='absmiddle' alt='smile.gif'><!--endemo-->
------
Oh, and back to the original post <!--emo&;)--><img src='http://www.unknownworlds.com/forums/html/emoticons/wink.gif' border='0' valign='absmiddle' alt='wink.gif'><!--endemo--> <!--emo&:p--><img src='http://www.unknownworlds.com/forums/html/emoticons/tounge.gif' border='0' valign='absmiddle' alt='tounge.gif'><!--endemo--> <!--emo&:D--><img src='http://www.unknownworlds.com/forums/html/emoticons/biggrin.gif' border='0' valign='absmiddle' alt='biggrin.gif'><!--endemo-->
Anyone have any clues? (I'm sure I'll just have to wait till Flayra looks at this post. <!--emo&:)--><img src='http://www.unknownworlds.com/forums/html/emoticons/smile.gif' border='0' valign='absmiddle' alt='smile.gif'><!--endemo-->)
<a href='http://www.ozforums.com/forumdisplay.php?forumid=143' target='_blank'>http://www.ozforums.com/forumdisplay.php?forumid=143</a>
Second of all, if it was about adminmod, the guys at adminmod would most likely get "upset" at me for asking a dumb question that has nothing to do with AM, because it's all Flayra's fault, and NS needs to be fixed.
The biggest reason why it belongs here (not necessarily in this topic, but here in the NS forums) is because I am asking how NS handles players, not how AM or even AMX (which is the admin program I am talking about) deals with players.
Not trying to be an **obscenity**, but I've had no luck with the AM team and your post to go there annoyed me.
My 2cents
As an aside, NS is so radical that I really wasn't expecting any 3rd party stuff to work with it. Chill out and be greatful for what you have got <!--emo&:p--><img src='http://www.unknownworlds.com/forums/html/emoticons/tounge.gif' border='0' valign='absmiddle' alt='tounge.gif'><!--endemo-->
<b>I know</b> it's not Flayra's or NS fault, but thats what the AM guys keep telling everyone. I've already tried to have the Adminmod guys look at their code to see what could be causing an issue. The only response I got back was "It's a problem with NS, not AM'.
-- EDIT --
Here's the post where I brought AM incompatablities with NS to the AM guys' attention :
<a href='http://www.ozforums.com/showthread.php?s=&postid=484576#post484576' target='_blank'>http://www.ozforums.com/showthread.php?s=&...4576#post484576</a>
-- END EDIT --
On the other hand, AMX <b>DOES</b> work with AMX (both linux and windows), which was one of my earlier points.
And anyway, I originally started this topic to see if I had to modify the above script to make it work with NS.
How this topic turned from "how should I change this" to "I think NS should change to fit AM" is beyond me.
Yes, I could hack admin mod to work with NS, indeed RBB has (a AM guy). Unfortuatly if you do that, guess what, it doesn't work with any other mod. CS admins can shout a lot louder than you lot (Theres more of them <!--emo&:p--><img src='http://www.unknownworlds.com/forums/html/emoticons/tounge.gif' border='0' valign='absmiddle' alt='tounge.gif'><!--endemo-->)
I'm not trying to hack adminmod. I no longer even want to use adminmod, I am using AMX. I'm not even trying to hack AMX.
What I am trying to do is modify an AMX plugin (code show above) so that it will work properly with NS.
My question was, does NS handle player entities different than CS, IE: when you point your mouse at a player in NS, does the NS send the player information different than CS does? The reason I am asking is because I have tried the above AMX plugin in CS and it works fine, but when I try and use it in NS, it tells me that I am not pointing at something. I'm <b>NOT</b> trying to bash NS (I play NS WAY more than I play CS) and say "Flayra coded things all screwed up and so now I have to fix this!" I realize fully and completely that NS is different than CS and things were coded different <b>NOT WRONG</b>. I just want to make the plugin work. <b>SO</b> to state my intent again simply: When you point your mouse at a person, how does it return the player info?
I appologize if my post sounds a little pissy, but I am annoyed that somehow my post has been totally missinterpreted by just about EVERYONE who has read it. Plus it's almost 3AM and I'm still at work. <!--emo&:p--><img src='http://www.unknownworlds.com/forums/html/emoticons/tounge.gif' border='0' valign='absmiddle' alt='tounge.gif'><!--endemo-->
The stuff that stops admin mod working is the exact same stuff thats screwing you and AMX over.
This is how I grab the player ID, maybe it will help:
<!--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-->
void AvHHud::TraceEntityID(int& outEntityID)
{
pmtrace_t tr;
vec3_t up, right, forward;
// Trace forward to see if we see a player
gEngfuncs.pEventAPI->EV_PushPMStates();
// Now add in all of the players.
gEngfuncs.pEventAPI->EV_SetSolidPlayers (-1);
gEngfuncs.pEventAPI->EV_SetTraceHull(2);
cl_entity_s* theLocalPlayer = gEngfuncs.GetLocalPlayer();
int theLocalPlayerIndex = theLocalPlayer->index;
//AngleVectors(theLocalPlayer->curstate.angles, forward, right, up);
pVector theRealView;
gEngfuncs.pfnAngleVectors(pmove->angles, forward, right, up);
Vector theStartTrace;
//VectorMA(gPredictedPlayerOrigin, kMaxPlayerHullWidth, forward, theStartTrace);
VectorCopy(gPredictedPlayerOrigin, theStartTrace);
Vector theEndTrace;
VectorMA(gPredictedPlayerOrigin, 8192, forward, theEndTrace);
bool theDone = false;
do
{
gEngfuncs.pEventAPI->EV_PlayerTrace(theStartTrace, theEndTrace, PM_NORMAL, theLocalPlayerIndex, &tr);
// Ignore local player
int theHit = gEngfuncs.pEventAPI->EV_IndexFromTrace(&tr);
if(theHit == theLocalPlayerIndex)
{
VectorMA(tr.endpos, kHitOffsetAmount, forward, theStartTrace);
}
// We hit something
else if(tr.fraction < 1.0)
{
physent_t* pe = gEngfuncs.pEventAPI->EV_GetPhysent( tr.ent );
if(pe)
{
int thePotentialEntity = pe->info;
//if((thePotentialEntity >= 1) && (thePotentialEntity < gEngfuncs.GetMaxClients()))
//{
outEntityID = pe->info;
//}
}
theDone = true;
}
} while(!theDone);
gEngfuncs.pEventAPI->EV_PopPMStates();
}
<!--c2--></td></tr></table><span class='postcolor'><!--ec2-->
But's that's neither here nor there.
Flayra : THANK YOU SIR! Thats what I was looking for. <!--emo&:)--><img src='http://www.unknownworlds.com/forums/html/emoticons/smile.gif' border='0' valign='absmiddle' alt='smile.gif'><!--endemo--> (I think, I'll have to look at it)