Raised This Month: $ Target: $400
 0% 

A spectator plugin with a TIME LIMIT


Post New Thread Reply   
 
Thread Tools Display Modes
BigBaller
Veteran Member
Join Date: Mar 2004
Location: Everett, WA
Old 04-14-2005 , 14:48  
Reply With Quote #11

Ok

Code:
#include <amxmodx> #include <amxmisc> #include <cstrike> public plugin_init() {     register_plugin("Timed Kick Specs","1.0","Slurpy [COF]")     register_cvar("spec_time","5")     set_task(60.0,"check_specs",777,"",0,"b") //Do spectator check every minute } new specTime[33] new userName[33] new authID[33] public check_specs(){     new curr_players = get_playersnum(1)     new maxspectime = get_cvar_num("spec_time")     for(new i = 1; i <= curr_players; ++i){         if (!is_user_connected(i) && !is_user_connecting(i)) continue         if (is_user_admin(i)) continue         new CsTeams:team = cs_get_user_team(i)         get_user_name(i,userName,32)         if(team == CS_TEAM_SPECTATOR) {             specTime[i] = (specTime[i] + 1) //Add one every minute they are spec             // log_amx("%s has been spectating for &s minutes",userName,specTime[i]) // This is for debugging, uncomment if you want to debug.         }else{             specTime[i] = (0) //remove spec minutes if they rejoin a team             }         if(specTime[i] > get_cvar_num("spec_time")){             get_user_authid(i,authID,32)             new userid = get_user_userid(i)             client_print(0,print_chat,"%s has been kicked for spectating longer then %s minutes. Considered AFK.", userName, maxspectime)             log_amx("%s <%s> was kicked for spectating longer then %s minutes. Considered AFK.", userName, authID, maxspectime)             server_cmd("kick #%d ^"Do not spectate longer then %s, Considered AFK.^"", userid, maxspectime)         }     } }

Thats what I did/changed.

Instead of looking for a user flags I just changed it to is_user_admin() soo anyone who has any sort of flags is immune.

Tested and works.

Maybe you should release this in the plugins forum, it works as intended
BigBaller is offline
slurpycof
Senior Member
Join Date: Nov 2004
Old 04-14-2005 , 14:56  
Reply With Quote #12

Are you interested in adding to it? If you are not going to, I will add some things to it like more than x players and stuff. If you want to do it, have fun and release it as yours.
slurpycof is offline
BigBaller
Veteran Member
Join Date: Mar 2004
Location: Everett, WA
Old 04-14-2005 , 15:07  
Reply With Quote #13

Well no, I dont need much more then what I just posted. You wrote most the code anyways, soo I consider it your plugin.

Anyways thanks for the help, I now have exactly what I wanted
BigBaller is offline
Shinzon
Senior Member
Join Date: Feb 2005
Location: Hellfire
Old 04-26-2005 , 18:21  
Reply With Quote #14

Hi,

using this plugin gives the following error:


Code:
L 04/26/2005 - 14:01:04: [AMXX] Native error in "cs_get_user_team" on line 21 (file "amx_spec_kick.sma").
L 04/26/2005 - 14:01:04: [CSTRIKE] Invalid player 3
L 04/26/2005 - 14:03:04: [AMXX] Native error in "cs_get_user_team" on line 21 (file "amx_spec_kick.sma").
L 04/26/2005 - 14:03:04: [CSTRIKE] Invalid player 8
L 04/26/2005 - 14:03:04: [AMXX] Native error in "cs_get_user_team" on line 21 (file "amx_spec_kick.sma").
L 04/26/2005 - 14:03:04: [CSTRIKE] Invalid player 12
L 04/26/2005 - 14:05:04: [AMXX] Native error in "cs_get_user_team" on line 21 (file "amx_spec_kick.sma").
L 04/26/2005 - 14:05:04: [CSTRIKE] Invalid player 3
L 04/26/2005 - 14:07:04: [AMXX] Native error in "cs_get_user_team" on line 21 (file "amx_spec_kick.sma").
L 04/26/2005 - 14:07:04: [CSTRIKE] Invalid player 3
L 04/26/2005 - 14:08:04: [AMXX] Native error in "cs_get_user_team" on line 21 (file "amx_spec_kick.sma").
L 04/26/2005 - 14:08:04: [CSTRIKE] Invalid player 3
L 04/26/2005 - 14:09:04: [AMXX] Native error in "cs_get_user_team" on line 21 (file "amx_spec_kick.sma").
L 04/26/2005 - 14:09:04: [CSTRIKE] Invalid player 13
L 04/26/2005 - 14:12:04: [AMXX] Native error in "cs_get_user_team" on line 21 (file "amx_spec_kick.sma").
L 04/26/2005 - 14:12:04: [CSTRIKE] Invalid player 14
L 04/26/2005 - 14:18:04: [AMXX] Native error in "cs_get_user_team" on line 21 (file "amx_spec_kick.sma").
L 04/26/2005 - 14:18:04: [CSTRIKE] Invalid player 11
L 04/26/2005 - 14:18:04: [AMXX] Native error in "cs_get_user_team" on line 21 (file "amx_spec_kick.sma").
L 04/26/2005 - 14:18:04: [CSTRIKE] Invalid player 13
L 04/26/2005 - 14:19:04: [amx_spec_kick.amxx] oMg it`s sensi has been spectating for  minutes
L 04/26/2005 - 14:19:04: [AMXX] Native error in "cs_get_user_team" on line 21 (file "amx_spec_kick.sma").
L 04/26/2005 - 14:19:04: [CSTRIKE] Invalid player 11
L 04/26/2005 - 14:19:04: [AMXX] Native error in "cs_get_user_team" on line 21 (file "amx_spec_kick.sma").
L 04/26/2005 - 14:19:04: [CSTRIKE] Invalid player 13
L 04/26/2005 - 14:20:04: [amx_spec_kick.amxx] oMg it`s sensi has been spectating for  minutes
L 04/26/2005 - 14:21:04: [amx_spec_kick.amxx] oMg it`s sensi has been spectating for  minutes
L 04/26/2005 - 14:22:04: [amx_spec_kick.amxx] oMg it`s sensi has been spectating for  minutes
L 04/26/2005 - 14:23:04: [amx_spec_kick.amxx] oMg it`s sensi has been spectating for  minutes
L 04/26/2005 - 14:23:04: [AMXX] Native error in "cs_get_user_team" on line 21 (file "amx_spec_kick.sma").
L 04/26/2005 - 14:23:04: [CSTRIKE] Invalid player 8
L 04/26/2005 - 14:24:04: [amx_spec_kick.amxx] oMg it`s sensi has been spectating for  minutes
L 04/26/2005 - 14:24:04: [amx_spec_kick.amxx] oMg it`s sensi <STEAM_0:0:xxxxxxx> was kicked for spectating longer then  minutes. Considered AFK.
But, seems to work.

Any hints about the errors and the missing time display ?
__________________
Shinzon

CS:1.6 [max-torgau.de] Fun Server 83.142.83.26:27016
CS:1.6 [max-torgau.de] DeathMatch 83.142.83.26:27017
CS:1.6 [max-torgau.de] .::N!CkYs fUn sErVeR wC3::. XP-SAVE 83.142.83.26:27035
nihil aliud est ebrietas quam voluntaria insania
Shinzon is offline
slurpycof
Senior Member
Join Date: Nov 2004
Old 04-26-2005 , 19:38  
Reply With Quote #15

what part of the code are you running? Since it is not a released sma, I need to see the code you used.
slurpycof is offline
Shinzon
Senior Member
Join Date: Feb 2005
Location: Hellfire
Old 04-27-2005 , 07:41  
Reply With Quote #16

Hi,

this is the code i use:

Code:
#include <amxmodx> #include <amxmisc> #include <cstrike> public plugin_init() {     register_plugin("Timed Kick Specs","1.0","Slurpy [COF]")     register_cvar("spec_time","5")     set_task(60.0,"check_specs",777,"",0,"b") //Do spectator check every minute } new specTime[33] new userName[33] new authID[33] public check_specs(){     new curr_players = get_playersnum(1)     new maxspectime = get_cvar_num("spec_time")     for(new i = 1; i <= curr_players; ++i){         if (!is_user_connected(i) && !is_user_connecting(i)) continue         if (is_user_admin(i)) continue         new CsTeams:team = cs_get_user_team(i)         get_user_name(i,userName,32)         if(team == CS_TEAM_SPECTATOR) {             specTime[i] = (specTime[i] + 1)    //Add one every minute they are spec             log_amx("%s has been spectating for %s minutes",userName,specTime[i]) // This is for debugging, uncomment if you want to debug.         }else{             specTime[i] = (0) //remove spec minutes if they rejoin a team             }         if(specTime[i] > get_cvar_num("spec_time")){             get_user_authid(i,authID,32)             new userid = get_user_userid(i)             client_print(0,print_chat,"%s has been kicked for spectating longer then %s minutes. Considered AFK.", userName, maxspectime)             log_amx("%s <%s> was kicked for spectating longer then %s minutes. Considered AFK.", userName, authID, maxspectime)             server_cmd("kick #%d ^"Do not spectate longer then %s, Considered AFK.^"", userid, maxspectime)         }     } }

Thx in advance.
__________________
Shinzon

CS:1.6 [max-torgau.de] Fun Server 83.142.83.26:27016
CS:1.6 [max-torgau.de] DeathMatch 83.142.83.26:27017
CS:1.6 [max-torgau.de] .::N!CkYs fUn sErVeR wC3::. XP-SAVE 83.142.83.26:27035
nihil aliud est ebrietas quam voluntaria insania
Shinzon is offline
slurpycof
Senior Member
Join Date: Nov 2004
Old 04-27-2005 , 11:19  
Reply With Quote #17

I will look at this some more, I got the same error about team when I tested.
slurpycof is offline
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 17:55.


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