Raised This Month: $ Target: $400
 0% 

Plugin disabling regular chat


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
havok
Junior Member
Join Date: Oct 2004
Location: Fairfield, CA
Old 01-04-2005 , 22:54   Plugin disabling regular chat
Reply With Quote #1

Ive edited this plugin a lot. I just tried to make it so that it would be disabled for the first round. Its works just fine except it disables regular says. Team chats work fine just not say commands.
I've commented the stuff thats new and could be causing problems.
I'm new to programming small. I havent written my own plugins just changed other ones to my liking =] cus i know a few other languages.... basic, c++, j++ and some assembly


Code:
  /************************************************* * Bank Deposit (c) Copyright 2003, Phreak * This file is provided as is (no warranties). ************************************************** * Ported by Burnzy *  Visit <a href="http://www.burnsdesign.org" target="_blank" rel="nofollow noopener">www.burnsdesign.org</a> ************************************************** * * You can save money to a bank account and retrieve it after mapchange. * * Usage: *  say savecash <amount>   : put <amount>on your account *  say checkcash           : check how many you have on your account *  say getcash <amount>    : retrieve <amount> from your account * * Settings: * There are two CVARs to control the plugin. *  - "amx_bank_maplimit"    controls how many you can retrieve in one map *                           (default 5000) *  - "amx_bank_minplayer"   controls how many player must be playing on *                           the server to be able to use the bank (default 2) * line 23*************************************************/ #include <amxmodx> #include <cstrike> new paylimit new paid[33] new roundnum  //This is new. Stores the round number public deposit(id) {      new args[32],first[16],samount[16],amount=0,key[64],deposited = 0,data[32],authid[32],name[64]        read_argv(1,args,31)        parse(args,first,15,samount,15)        amount = str_to_num(samount)        paylimit = get_cvar_num("amx_bank_maplimit");      get_user_name(id,name,31)      if (roundnum < 2)  //New if statement... checks if its first round      {         client_print(id,print_chat,"[AMX] The bank has been disabled to allow for a pistol round.")         return PLUGIN_HANDLED      }          if ((equali(first,"savecash",9) || equali(first,"getcash",9) || equali(first,"checkcash",9) || equali(first,"depositall",9) || equali(first,"getmaxcash",9)) && get_playersnum()<get_cvar_num("amx_bank_minplayer")) {         client_print(id,print_chat,"[AMX] There are not enough players on the server to use the bank account.")         return PLUGIN_HANDLED      }      get_user_authid(id,authid,31)      format(key,63,"FinalBank/%s",authid)      get_vaultdata(key, data, 31)      deposited = str_to_num(data)      new amount2, amount3      if (amount > 0){         amount2 = cs_get_user_money(id);         if (equali(first,"savecash",9)) {         client_print(id,print_chat,"[AMX] Saving %d$ to your bank account",amount)         log_amx("%s [BANK:SAVE] %d", name, amount)             if (cs_get_user_money(id) < amount)             {                 deposited += amount2;                 cs_set_user_money(id,max(cs_get_user_money(id) - cs_get_user_money(id),0));             }               if (cs_get_user_money(id) >= amount)             {                 deposited += amount;                 cs_set_user_money(id,max(cs_get_user_money(id)-amount,0));             }         format(data,31,"%d",deposited)         set_vaultdata(key,data);                 return PLUGIN_HANDLED         }     }         if (equali(first,"checkcash",9)) {         client_print(id,print_chat,"[AMX] Your current amount is %d$",deposited)                 return PLUGIN_HANDLED          }         if (equali(first,"getcash",9)) {             if (deposited<amount) {                 client_print(id,print_chat,"[AMX] You have only %d$ on your account",deposited)                 return PLUGIN_HANDLED             }             paid[id] += amount         cs_set_user_money(id,max(cs_get_user_money(id)+amount,0))             log_amx("%s [BANK:GET$] %d", name, amount)         deposited -= amount         format(data,31,"%d",deposited)         set_vaultdata(key,data);                 return PLUGIN_HANDLED     }     if (equali(first,"depositall",9))     {         client_print(id,print_chat,"[AMX] You have saved all your cash to your account.")         amount3 = cs_get_user_money(id);         deposited += amount3;         cs_set_user_money(id,max(cs_get_user_money(id) - cs_get_user_money(id),0));         format(data,31,"%d",deposited)         set_vaultdata(key,data);                 return PLUGIN_HANDLED     }     if (equali(first,"getmaxcash",9))     {         new mlimit         mlimit = (16000 - cs_get_user_money(id,0));         if(mlimit >= deposited)         {             client_print(id,print_chat,"[AMX] You have only %d$ on your account",deposited)             return PLUGIN_HANDLED         }         client_print(id,print_chat,"[AMX] You have withdrawn %d from your account", mlimit)         deposited -= mlimit;         cs_set_user_money(id,max(cs_get_user_money(id) + mlimit,0));         format(data,31,"%d",deposited)         set_vaultdata(key,data);             return PLUGIN_HANDLED     }     return PLUGIN_CONTINUE  }   public rounds()    //New function to change the round number each round {     roundnum++;     return PLUGIN_CONTINUE } public plugin_init()   {     register_plugin("Bank Deposit","1.0","Phreak")     register_clcmd("say","deposit")     register_cvar("amx_bank_maplimit","9999999");     register_cvar("amx_bank_minplayer","1");     roundnum = 0;    // New initialization.... i know it works but is it proper programming?     register_event("round_start","rounds","a");   // New.... this is where i had the most trouble.... got a warning saying not enough parameters.... i thought the last one was optional     return PLUGIN_CONTINUE }
havok is offline
Send a message via AIM to havok
havok
Junior Member
Join Date: Oct 2004
Location: Fairfield, CA
Old 01-04-2005 , 22:58  
Reply With Quote #2

err sorry about that being really really hard to read.... i didnt code it like that.
not sure how to get it into that little white small box..... i tried this
Code:
didnt work
and this
Code:
didnt work either
edit: just kidding figured it out.
havok is offline
Send a message via AIM to havok
XxAvalanchexX
Veteran Member
Join Date: Oct 2004
Location: abort73.com
Old 01-04-2005 , 23:05  
Reply With Quote #3

Change your roundnum < 2 condition to this:

Code:
if ((equali(first,"savecash",9) || equali(first,"getcash",9) || equali(first,"checkcash",9) || equali(first,"depositall",9) || equali(first,"getmaxcash",9)) && roundnum < 2) {
__________________
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:28.


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