Raised This Month: $ Target: $400
 0% 

Plugin works (allmost) but how should i have done?


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
sluggo
Member
Join Date: May 2006
Old 10-12-2006 , 15:23   Plugin works (allmost) but how should i have done?
Reply With Quote #1

Hi,
I have made a script/plugin that works, allmost as I want it to, there is something wrong with how many "last dissconnect players" it shows. It tends to show 1 to many but that doesn't matter really :p
I set out to make the script myselfe, and it works but I need help with tweaking it, my coding is terrible I know but I would like to learn.
So if anyone could give me some pointers to how some of the things I have done SHOULD be done I would greatly appreaschiate (spelling?) it.

What does the plugin do then, well it saves the last 32 players who dissconnect and when you say "/last" it shows you the last amx_showlast "x" players. (max 10 b/c I cant code propperly)
We will use it on our servers when ppl say/do something stupid and drops, especially when several ppl drops at the same time.
Enough, here is the code:
Code:
/* Made by sluggo Admins with "ADMIN_CHAT" can type team_say: /last to see the "amx_showlast" default=3 latest players to dissconnect from server. Good if someone says something nasty and drops. Credits to v3x, i borrowed the structure from his "player disconnect info plugin" */ #include <amxmodx> #include <amxmisc> #define PLUGIN "Last Players" #define VERSION "0.8" #define AUTHOR "sluggo" //comment out to not have the plugin print to all in chat when someone dissconnects // #define DEBUG // Change this to what level you want your admins to be able to issue the command #define ACCESS_LEVEL ADMIN_KICK new g_szLastPlrAuth[33][33] new g_szLastPlrName[33][33] new iCountDiss public plugin_init() {     register_plugin(PLUGIN, VERSION, AUTHOR)     register_clcmd("say /last", "leftserver", ACCESS_LEVEL, "- displays in consol and chat the last players to admins")     register_cvar("amx_showlast","3")   //default 3 last players should show. Max 10     register_cvar("amx_showdissconnects", "0") //show when someone dissconnects 0 = off 1=on } public client_disconnect(id) {     if(is_user_bot(id) || (is_user_hltv(id))) {         return PLUGIN_CONTINUE     }     iCountDiss = iCountDiss + 1     if (iCountDiss == 0) {         iCountDiss = 1     }     if (iCountDiss > 32) {                 new i = get_cvar_num("amx_showlast")         if(i>10) {             i=10         }         iCountDiss = i + 1         new c, iMaxUser //just a counter...         iMaxUser = 32         for(c = 1;c <= i; c++) {             copy(g_szLastPlrName[iMaxUser - i + c],32,g_szLastPlrName[c])         }     }     get_user_name(id, g_szLastPlrName[iCountDiss], 32);     get_user_authid(id, g_szLastPlrAuth[iCountDiss], 32);     if(get_cvar_num("amx_showdissconnects") == 1) {         client_print(0,print_chat, "Nick: %s SteamID: %s dissconnected", g_szLastPlrName[id], g_szLastPlrAuth[id]);     }     return PLUGIN_CONTINUE } public leftserver(id) //id of the one who issued the command {     new i, k // counters     if(iCountDiss <= get_cvar_num("amx_showlast")){         k = 1 // make sure at least 1 is going to show     }     else{           k = iCountDiss - get_cvar_num("amx_showlast")     }     for(i = k; i <= iCountDiss; i++) {         client_print(id,print_chat, "[Nick] %s - [SteamID] %s", g_szLastPlrName[i], g_szLastPlrAuth[i]);         console_print(id,"[Nick] %s - [SteamID] %s", g_szLastPlrName[i], g_szLastPlrAuth[i]); #if defined DEBUG     server_print(g_szLastPlrName[i])     server_print(g_szLastPlrName[i])     server_print("%i", i) #endif     }     return PLUGIN_CONTINUE }
sluggo is offline
 



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 04:52.


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