Raised This Month: $ Target: $400
 0% 

Event on player count


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
L0neW0lf
Member
Join Date: Mar 2006
Location: Denmark
Old 05-30-2006 , 16:13   Event on player count
Reply With Quote #1

Hi i made a plugin that turns alltalk on and off, reacting on how many players on the server.

I made it with a cvar put in amxx.cfg, so users of the plugin can put in the number of users they want to.

In my code it is set to 4, and it works nicely when player number 5 joins, it turns off all talk, but when player 5 disconnects alltalk dont come back on.

Here is my code:
Code:
#include <amxmodx> #include <amxmisc> #define PLUGIN "AutoAllTalk" #define VERSION "1.1" #define AUTHOR "Lone Wolf" public plugin_init() {     register_plugin(PLUGIN, VERSION, AUTHOR)     register_logevent("roundstart", 2, "0=World triggered", "1=Round_Start") } public roundstart() {     set_task(1.0, "set_NewAlltalk") } public client_connect(id) {     set_task(1.0, "set_NewAlltalk") } public client_disconnect(id) {     set_task(1.0, "set_NewAlltalk") } public set_NewAlltalk(taskId) {     new tmpPlayer     new tmpCount     tmpPlayer = get_cvar_num("amx_nrPlayer")     tmpCount = get_playersnum(1)     if (tmpCount==tmpPlayer) {         set_cvar_num("sv_alltalk",1)     }     else if (tmpCount==(tmpPlayer+1)) {         set_cvar_num("sv_alltalk",0)     } }

I also tried using plugin_init() instead of roundstart, but that didnt seem to work either, i removed that because i wasnt sure if plugin_init is run on reload or mapchange......

Hope someone can se the error

/Lone Wolf
L0neW0lf is offline
Send a message via ICQ to L0neW0lf Send a message via MSN to L0neW0lf Send a message via Skype™ to L0neW0lf
 



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 16:18.


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