AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   My first plugin, yay (https://forums.alliedmods.net/showthread.php?t=29049)

TnP | Ass Master 05-28-2006 15:54

My first plugin, yay
 
Ok, i made a plugin to control the meta mod fake full plugin.

I'v seen all the fake full plugins got trashed, so dont trash mine plz :oops:

What this plugin does is tells meta mods fake full to add XX fake clients, then as people come in it keeps adding so that there are XX still there.

I just wanted to post, since i think some of it could be simplified or maybe some bugs in teh code. I just wanted a couple of scripters to take a look at the code and see if it seems ok before i post it.
:o

Code:
#include <amxmodx> #include <amxmisc> #define PLUGIN "Empty Server Control" #define VERSION "0.1" #define AUTHOR "TnP | Ass Master" //   This plugin will keep fake clients and czbots in the server until the max is reached, then remove them //   //   amx_ff_max   (default:19)    When the min fake clients + real players = this, it will remove all fake clients //               A good value for this is your server size minus 1 //   amx_ff_min   (default:4)   The min fake clients to have in your server //   //   amx_ff_minbots   (default:4)   The min number of bots to have //               When this number = the same ammount of people (default 4) it then uses maxbots //   amx_ff_maxbots   (default:8)   This number = players+bots Example: //               Set it to 12, you have 6 people then it adds 6 bots until 12 ppl, then the bots are removed //   //   //   //    new botquota public plugin_init()  {     register_plugin(PLUGIN, VERSION, AUTHOR)         register_cvar("amx_ff_max","18")     register_cvar("amx_ff_min","4")     register_cvar("amx_ff_maxbots","8")     register_cvar("amx_ff_minbots","4")  //  set_task(15.0, "setffplayers", 20, "", 0, "ab")  //  set_task(15.0, "botkill", 20, "", 0, "ab")     set_task(25.0, "restartround", 20, "", 0, "")     return PLUGIN_CONTINUE } public client_connect() {     new rp[32]     new realplayers, i, player     get_players(rp, realplayers, "c")     for (i=0; i<realplayers; i++)     player = rp[i]     new botquota         new fakeplayers = (realplayers + botquota + (get_cvar_num("amx_ff_min")))     new maxplayers = (get_cvar_num("amx_ff_max"))         new maxbots = (get_cvar_num("amx_ff_maxbots"))     new minbots = (get_cvar_num("amx_ff_minbots"))                     //      Bot Math         if(realplayers > minbots)     {     botquota = maxbots - realplayers     }     else {     botquota = minbots       }             //      Bots Controls         if(realplayers < maxbots)     {     server_cmd("bot_quota %d", botquota) //      server_cmd("say %d realbots", czbots) //      server_cmd("say %d botquota", botquota)     }           else {     server_cmd("bot_quota 0") //      server_cmd("say %d realbots", czbots) //      server_cmd("say %d botquota", botquota)     server_cmd("say doing nothing")     } //      Fake Full Controls         if((realplayers + (botquota + (get_cvar_num("amx_ff_min")))) < maxplayers)     {     server_cmd("ff_players %d", (fakeplayers)) //  server_cmd("say %d fakeplayers", (fakeplayers)) //  server_cmd("say %d botquota", botquota) //      server_cmd("say %d max players", maxplayers) //  server_cmd("say %d realplayers", realplayers) //  server_cmd("say %d player", player) //  server_cmd("say %d i", i)     }           else {     server_cmd("ff_players 0") //      server_cmd("say %d fake players", fakeplayers) //      server_cmd("say %d max players", maxplayers) //      server_cmd("say %d real players", realplayers) //      server_cmd("say doing nothing")     }                 return PLUGIN_CONTINUE } public botkill() {     new realplayers     get_players("",realplayers, "c")         new aliveplayers     get_players("",aliveplayers, "ac")         new maxbots = (get_cvar_num("amx_ff_maxbots"))     new minbots = (get_cvar_num("amx_ff_minbots"))     //      Bot Math         if(realplayers > minbots)     {     botquota = maxbots - realplayers     }     else {     botquota = minbots       }                   if(aliveplayers == 0 && realplayers >= 1 && botquota >0)       {       server_cmd("bot_kill")         set_hudmessage(254, 50, 0, 0.02, -0.27, 0, 5.0, 5.04, 0.0, 0.5, 8)       show_hudmessage(0,"No more alive players, Slaying Bots") }     return PLUGIN_CONTINUE } public restartround() {     server_cmd("sv_restartround 1")         return PLUGIN_CONTINUE }

TnP | Ass Master 05-28-2006 21:06

I cant get the code right for getting a list of human players, any body know how to do it?

SweatyBanana 05-28-2006 21:10

Code:
new Players[32] new playerCount, i, player get_players(Players, playerCount, "ch") for (i=0; i<playerCount; i++)    player = Players[i]


Use the functions list...


http://www.amxmodx.org/funcwiki.php

TnP | Ass Master 05-28-2006 22:31

Updated the code, i think i got it close to work right.
Now out of that, i should use playerCount right?

Also, why wont it run uless i set a task to the publics? am i a nub or what :?


All times are GMT -4. The time now is 16:20.

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