AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   help with my code? (https://forums.alliedmods.net/showthread.php?t=25607)

SweatyBanana 03-16-2006 23:19

help with my code?
 
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     } }

Xanimos 03-16-2006 23:22

#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.

Des12 03-16-2006 23:23

Re: help with my code?
 
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     }

SweatyBanana 03-16-2006 23:27

ty both

Xanimos 03-16-2006 23:33

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.

SweatyBanana 03-16-2006 23:34

This was a request from a person...

SweatyBanana 03-16-2006 23:39

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     }

Des12 03-16-2006 23:41

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     }

Xanimos 03-16-2006 23:50

That poses the same situation. And it will also show that he was warned twice and kicked at the same time.

SweatyBanana 03-16-2006 23:52

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     }


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

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