Raised This Month: $ Target: $400
 0% 

help with my code?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
SweatyBanana
BANNED
Join Date: Sep 2005
Location: LOL
Old 03-16-2006 , 23:19   help with my code?
Reply With Quote #1

Hey guys..need a little bit of help with this..It is suposed to check if the players kills are 3 times more than their deaths and if so, kick them...can u all help me?

Code:
/* Plugin generated by AMXX-Studio */ #include <amxmodx> #include <amxmisc> #define PLUGIN "ktd" #define VERSION "0.1" #define AUTHOR "SweatyBanana" #define Frags = get_user_frags(id) #define Deaths = get_user_deaths(id) #define MAXFRAGDEATH = 3 * Deaths public plugin_init() {     register_plugin(PLUGIN, VERSION, AUTHOR)     register_event("ResetHUD", "ktd", "b") } public ktd(id) {         new player[32]       read_argv(1,player,31)       new holder[200]           if(Frags >= MAXFRAGDEATH)     {         format(holder,199,"amx_kick %s",player)           get_user_name(target,player,31)         client_print(0,print_chat,"[KTD] %s has been kicked due to too high of a Kill/Death ratio.",player)                 }         else     {         return PLUGIN_CONTINUED     } }
SweatyBanana is offline
Send a message via AIM to SweatyBanana Send a message via Yahoo to SweatyBanana
Xanimos
Veteran Member
Join Date: Apr 2005
Location: Florida
Old 03-16-2006 , 23:22  
Reply With Quote #2

#define Frags = get_user_frags(id)
#define Deaths = get_user_deaths(id)
#define MAXFRAGDEATH = 3 * Deaths
cant have that because "id" isnt defined and it cannot be called like that.
Xanimos is offline
Send a message via AIM to Xanimos Send a message via MSN to Xanimos
Des12
Senior Member
Join Date: Jan 2005
Old 03-16-2006 , 23:23   Re: help with my code?
Reply With Quote #3

Code:
/* Plugin generated by AMXX-Studio */ #include <amxmodx> #include <amxmisc> #define PLUGIN "ktd" #define VERSION "0.1" #define AUTHOR "SweatyBanana" public plugin_init() {     register_plugin(PLUGIN, VERSION, AUTHOR)     register_event("ResetHUD", "ktd", "b") } public ktd(id) {     new Frags = get_user_frags(id)         new Deaths = get_user_deaths(id)         new MAXFRAGDEATH = 3 * Deaths     new name[32]               if(Frags >= MAXFRAGDEATH)     {         get_user_name(id,name,31)         client_print(0,print_chat,"[KTD] %s has been kicked due to too high of a Kill/Death ratio.",name)         server_cmd("kick ^"%s^" ^" too high of a Kill/Death ratio^"",name);     }         return PLUGIN_CONTINUED     }
__________________
-Dest Romano

www.JustRP.com
A TSRP Server

Quote:
Originally Posted by Brad
Don't you go be bringing reality into this.
Des12 is offline
SweatyBanana
BANNED
Join Date: Sep 2005
Location: LOL
Old 03-16-2006 , 23:27  
Reply With Quote #4

ty both
SweatyBanana is offline
Send a message via AIM to SweatyBanana Send a message via Yahoo to SweatyBanana
Xanimos
Veteran Member
Join Date: Apr 2005
Location: Florida
Old 03-16-2006 , 23:33  
Reply With Quote #5

I would use the DeathMsg event to get the attackers kills/deaths so he would be kicked the moment he killed too many. But this will suck as a plugin. Because if you just start and your first round you get 1 kill you will be kicked. Because 3*0 = 0 and 1 > 0. Also I tend to go 8-0 when I start.
Xanimos is offline
Send a message via AIM to Xanimos Send a message via MSN to Xanimos
SweatyBanana
BANNED
Join Date: Sep 2005
Location: LOL
Old 03-16-2006 , 23:34  
Reply With Quote #6

This was a request from a person...
SweatyBanana is offline
Send a message via AIM to SweatyBanana Send a message via Yahoo to SweatyBanana
SweatyBanana
BANNED
Join Date: Sep 2005
Location: LOL
Old 03-16-2006 , 23:39  
Reply With Quote #7

Not if I do something like this right?...but it gives me a tag mismatch on "if(!Frags > 3)" and apparently "return PLUGIN_CONTINUED" it doesnt like.

Code:
#include <amxmodx> #include <amxmisc> #define PLUGIN "ktd" #define VERSION "0.1" #define AUTHOR "SweatyBanana" public plugin_init() {     register_plugin(PLUGIN, VERSION, AUTHOR)     register_event("ResetHUD", "ktd", "b") } public ktd(id) {     new Frags = get_user_frags(id)     new Deaths = get_user_deaths(id)     new MAXFRAGDEATH = 3 * Deaths     new LIMITWARN = 2 * Deaths     new name[32]               if(!Frags > 3)     {         get_user_name(id,name,31)         client_print(0,print_chat,"[KTD] Anyone with a kill/death ratio will be kicked.",name)     }         if(Frags >= LIMITWARN)     {         get_user_name(id,name,31)         client_print(0,print_chat,"WARNING: %s will be kicked soon for too high of a Kill/Death ratio.",name)     }     if(Frags >= MAXFRAGDEATH)     {         get_user_name(id,name,31)         client_print(0,print_chat,"[KTD] %s has been kicked due to too high of a Kill/Death ratio.",name)         server_cmd("kick ^"%s^" ^" too high of a Kill/Death ratio^"",name);     }     return PLUGIN_CONTINUED     }
SweatyBanana is offline
Send a message via AIM to SweatyBanana Send a message via Yahoo to SweatyBanana
Des12
Senior Member
Join Date: Jan 2005
Old 03-16-2006 , 23:41  
Reply With Quote #8

Code:
#include <amxmodx> #include <amxmisc> #define PLUGIN "ktd" #define VERSION "0.1" #define AUTHOR "SweatyBanana" public plugin_init() {     register_plugin(PLUGIN, VERSION, AUTHOR)     register_event("ResetHUD", "ktd", "b") } public ktd(id) {     new Frags = get_user_frags(id)     new Deaths = get_user_deaths(id)     new MAXFRAGDEATH = 3 * Deaths     new LIMITWARN = 2 * Deaths     new name[32]               if(Frags > 3)     {         get_user_name(id,name,31)         client_print(0,print_chat,"[KTD] Anyone with a kill/death ratio will be kicked.",name)     }         if(Frags >= LIMITWARN)     {         get_user_name(id,name,31)         client_print(0,print_chat,"WARNING: %s will be kicked soon for too high of a Kill/Death ratio.",name)     }     if(Frags >= MAXFRAGDEATH)     {         get_user_name(id,name,31)         client_print(0,print_chat,"[KTD] %s has been kicked due to too high of a Kill/Death ratio.",name)         server_cmd("kick ^"%s^" ^" too high of a Kill/Death ratio^"",name);     }     return PLUGIN_CONTINUE     }
__________________
-Dest Romano

www.JustRP.com
A TSRP Server

Quote:
Originally Posted by Brad
Don't you go be bringing reality into this.
Des12 is offline
Xanimos
Veteran Member
Join Date: Apr 2005
Location: Florida
Old 03-16-2006 , 23:50  
Reply With Quote #9

That poses the same situation. And it will also show that he was warned twice and kicked at the same time.
Xanimos is offline
Send a message via AIM to Xanimos Send a message via MSN to Xanimos
SweatyBanana
BANNED
Join Date: Sep 2005
Location: LOL
Old 03-16-2006 , 23:52  
Reply With Quote #10

Code:
#include <amxmodx> #include <amxmisc> #define PLUGIN "ktd" #define VERSION "0.1" #define AUTHOR "SweatyBanana" public plugin_init()     {     register_plugin(PLUGIN, VERSION, AUTHOR)     register_cvar("KTD_PUNISH","kick")     register_event("ResetHUD", "ktd", "b") } public ktd(id)     {     new Frags = get_user_frags(id)     new Deaths = get_user_deaths(id)     new MAXFRAGDEATH = 3 * Deaths     new LIMITWARN = 2 * Deaths     new name[32]           if(Frags > 3)         {         if(Frags >= LIMITWARN)             {             get_user_name(id,name,31)             client_print(0,print_chat,"WARNING: %s will be kicked soon for too high of a Kill/Death ratio.",name)         }     }             if(Frags >= MAXFRAGDEATH)         {         get_user_name(id,name,31)         client_print(0,print_chat,"[KTD] %s has been kicked due to too high of a Kill/Death ratio.",name)         new Cvar[12]         get_cvar_string("KTDPUNISH" , Cvar, 11)         server_cmd("%s ^"%s^" ^" too high of a Kill/Death ratio^"", Cvar, name);     }         return PLUGIN_CONTINUE     }
SweatyBanana is offline
Send a message via AIM to SweatyBanana Send a message via Yahoo to SweatyBanana
Reply


Thread Tools
Display Modes

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:35.


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