Raised This Month: $ Target: $400
 0% 

Can someone tell me wat i am doing wrong in this plugin??


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Crazywelder1
Member
Join Date: Mar 2004
Location: CA
Old 02-11-2005 , 17:10   Can someone tell me wat i am doing wrong in this plugin??
Reply With Quote #1

okay this is for my submitted plugin {UPDATED VERSION}

My Question:
Can someone tell me wat might be or is wrong in this plugin.. becuase i don't think it is working??

Code:
#include <amxmodx> #include <amxmisc> #include <fun> #include <engine> #define CHECK 5 #define WARNINGTIME 15 new sprLight new sprSmoke new szsndthunder[] = "ambience/thunder_clap.wav" new oldmove[33][3] new afkplayer[33] new bool:spawned[33] = {true} public plugin_init() {     register_plugin("AFK", "0.06", "Garrett")     register_cvar("amx_afk", "1", FCVAR_SERVER|FCVAR_EXTDLL|FCVAR_UNLOGGED|FCVAR_SPONLY)     register_cvar("mp_afktime", "60")     register_clcmd("say afk", "sayafk", 0, "- Says theres a afk")     register_concmd("amx_afkhim", "cmd_afk", ADMIN_ALL, "type something after this")     set_task(float(CHECK),"checkplayers",_,_,_,"b") } public plugin_precache() {    sprLight  = precache_model( "sprites/lgtning.spr" )    sprSmoke  = precache_model( "sprites/steam1.spr" )        precache_sound ( szsndthunder )        return PLUGIN_CONTINUE }   public checkplayers() {     for (new a = 1; a <= get_maxplayers(); a++) {     if (is_user_alive(a) && is_user_connected(a) && !is_user_bot(a) && !is_user_hltv(a) && spawned[a]) {     new newmove[3]     get_user_origin(a, newmove)     if ( newmove[0] == oldmove[a][0] && newmove[1] == oldmove[a][1] && newmove[2] == oldmove[a][2] ) {     afkplayer[a] += CHECK     check_afkplayer(a)     } else {     oldmove[a][0] = newmove[0]     oldmove[a][1] = newmove[1]     oldmove[a][1] = newmove[2]     afkplayer[a] = 0             }         }     }     return PLUGIN_HANDLED } check_afkplayer(id) {     new getafktime = get_cvar_num("mp_afktime")     if (getafktime-WARNINGTIME <= afkplayer[id] < getafktime) {     new timeleft = getafktime - afkplayer[id]     client_print(id, print_chat, "[AFK] You have %i seconds to move or you will be slayed by the BOLT OF DEATH.", timeleft)     } else if (afkplayer[id] > getafktime) {     new name[32]     get_user_name(id, name, 31)     client_print(0, print_chat, "[AFK] %s was slayed by the BOLT OF DEATH for being Afk longer %i seconds", name, getafktime)     new vec1[3], vec2[3]         get_user_origin( id, vec1 )           vec1[2] -= 26     vec2[0] = vec1[0] + 150         vec2[1] = vec1[1] + 150         vec2[2] = vec1[2] + 400     emit_sound( id, CHAN_ITEM, szsndthunder, 1.0, ATTN_NORM, 0, PITCH_NORM )     message_begin( MSG_BROADCAST, SVC_TEMPENTITY )         write_byte( 0 )         write_coord( vec2[0] )         write_coord( vec2[1] )         write_coord( vec2[2] )         write_coord( vec1[0] )         write_coord( vec1[1] )         write_coord( vec1[2] )         write_short( sprLight )         write_byte( 1 )             // framestart         write_byte( 5 )             // framerate         write_byte( 10 )             // life         write_byte( 175 )            // width         write_byte( 30 )            // noise         write_byte( 200 )           // r, g, b         write_byte( 200 )           // r, g, b         write_byte( 200 )           // r, g, b         write_byte( 500 )           // brightness         write_byte( 175 )           // speed         message_end()     message_begin( MSG_PVS, SVC_TEMPENTITY, vec1 )         write_byte( 9 )         write_coord( vec1[0] )         write_coord( vec1[1] )         write_coord( vec1[2] )         message_end()     message_begin( MSG_BROADCAST, SVC_TEMPENTITY, vec1 )         write_byte( 5 )         write_coord( vec1[0] )         write_coord( vec1[1] )         write_coord( vec1[2] )         write_short( sprSmoke )         write_byte( 10 )         write_byte( 10 )         message_end()     user_silentkill( id )               } } public sayafk(id) {     if (get_cvar_float("amx_afk"))     client_print(0,print_center,"AFK!!! Go Get Him")        return PLUGIN_HANDLED }   public cmd_afk(id, level, cid) {     if (cmd_access(id, level, cid, 2))     client_print(0,print_center,"AFK!!! Go Get Him")     return PLUGIN_HANDLED }
Crazywelder1 is offline
Send a message via MSN to Crazywelder1
XxAvalanchexX
Veteran Member
Join Date: Oct 2004
Location: abort73.com
Old 02-11-2005 , 22:43  
Reply With Quote #2

Try setting the set_task flags to a, or ab instead of b. Maybe set the last parameter ("repeat") to 1. Also, this line of code looks awfully peculiar:

Code:
    if (getafktime-WARNINGTIME <= afkplayer[id] < getafktime) {

if max time allowed to be AFK minus the warning time is smaller than or equal to how long the player has been afk is smaller than the max time allowed to be AFK?

It's the <= and then the < which is weird.
__________________
No longer around. Thanks your support, everyone! As always:
THIS ONES FOR YOU
3000 PTS
XxAvalanchexX is offline
Crazywelder1
Member
Join Date: Mar 2004
Location: CA
Old 02-11-2005 , 23:06  
Reply With Quote #3

Quote:
Originally Posted by XxAvalanchexX
Try setting the set_task flags to a, or ab instead of b. Maybe set the last parameter ("repeat") to 1. Also, this line of code looks awfully peculiar:

Code:
    if (getafktime-WARNINGTIME <= afkplayer[id] < getafktime) {

if max time allowed to be AFK minus the warning time is smaller than or equal to how long the player has been afk is smaller than the max time allowed to be AFK?

It's the <= and then the < which is weird.
ok ill try the first part but the second i think it might not make sense and i might just get rid of warning the person>>... One more question how do u make it check everyone not just humans but bots too because i wasn't sure how i would do that should i just take out !is_user_bot or do i have to put something for that..
__________________
AKA = oM`|Garrett
oM CLAN
Soon to have a server in Soon
Crazywelder1 is offline
Send a message via MSN to Crazywelder1
XxAvalanchexX
Veteran Member
Join Date: Oct 2004
Location: abort73.com
Old 02-12-2005 , 00:41  
Reply With Quote #4

Taking out the "!is_user_bot" part should do it.
__________________
No longer around. Thanks your support, everyone! As always:
THIS ONES FOR YOU
3000 PTS
XxAvalanchexX 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 19:19.


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