AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   My second script. Need some help (https://forums.alliedmods.net/showthread.php?t=9940)

XunTric 02-04-2005 11:43

My second script. Need some help
 
Hey i was making my second script. Im really noob at this just as you know. I got a name changer plugin, llama plugin and chicken plugin. And i tryed to make a command called amx_mess which makes you llama, chicken and changes your name too "DONT MESS WITH THE ADMINS". And another command that removes the stuff... I know i forgot some lines to indentify the user so amxx knows who to "mess" up. So i need some help.
Here it is:
Code:
#include <amxmodx> #include <amxmisc> public plugin_init() { register_plugin("amx_mess", "1.0", "XunTric") register_concmd("amx_mess", "cmdmess", ADMIN_KICK, "<name or #userid>") register_concmd("amx_unmess", "cmdunmess", ADMIN_KICK, "<name or #userid>") } public cmdmess(id,level,cid) {     if (!cmd_access(id,level,cid,2))          return PLUGIN_HANDLED     server_cmd("amx_chicken %s")     server_cmd("amx_llama %s")     server_cmd("amx_name %s DONT MESS WITH THE ADMINS")          return PLUGIN_HANDLED } public cmdunmess(id,level,cid) {     if (!cmd_acces(id,level,cid,2))          return PLUGIN_HANDLED     server_cmd("amx_unchicken %s")     server_cmd("amx_unllama %s")     server_cmd("amx_name %s I CAN CHANGE MY NAME BACK NOW")          return PLUGIN_HANDLED     }

knekter 02-04-2005 12:20

some work
 
You need to read the argument of the player name. The command gets called but the input <name> you want to 'mess' is not called. Try this:

Code:
#include <amxmodx> #include <amxmisc> public plugin_init() { register_plugin("amx_mess", "1.0", "XunTric") register_concmd("amx_mess", "cmdmess", ADMIN_KICK, "<name or #userid>") register_concmd("amx_unmess", "cmdunmess", ADMIN_KICK, "<name or #userid>") } public cmdmess(id,level,cid) {     if (!cmd_access(id,level,cid,2))          return PLUGIN_HANDLED     new arg[32]     read_argv(1,arg,31)     new player = cmd_target(id,arg,31)     server_cmd("amx_chicken %s", player)     server_cmd("amx_llama %s", player)     server_cmd("amx_name %s DONT MESS WITH THE ADMINS", player)          return PLUGIN_HANDLED }

Do the same for unmess and im not sure if the server_cmd with the %s will work, just test with it for a bit

XxAvalanchexX 02-04-2005 16:01

I believe he is trying to run the commands via player name, so you need to get the name, too. Try this.

Code:
#include <amxmodx> #include <amxmisc> public plugin_init() { register_plugin("amx_mess", "1.0", "XunTric") register_concmd("amx_mess", "cmdmess", ADMIN_KICK, "<name or #userid>") register_concmd("amx_unmess", "cmdunmess", ADMIN_KICK, "<name or #userid>") } public cmdmess(id,level,cid) {     if (!cmd_access(id,level,cid,2))          return PLUGIN_HANDLED     new arg[32]     read_argv(1,arg,31)     new player = cmd_target(id,arg,1)     if(!player)          return PLUGIN_HANDLED     new name[64];     get_user_name(player,name,63);     server_cmd("amx_chicken ^"%s^"", name)     server_cmd("amx_llama ^"%s^"", name)     server_cmd("amx_name ^"%s^" ^"DONT MESS WITH THE ADMINS^"", name)          return PLUGIN_HANDLED }

I also made sure to check that the player was found (the "!player" check) and fixed the flags for cmd_target.

XunTric 02-04-2005 18:00

Thanks guys it almost works! It compiles and the command work. But the command only make you llama and changes your name. It doesnt make you to a chicken. Any ideas how to fix it? Just as you know i used what XxAvalanchexX said. Its maybe because i get those warnings when i compile? When i compile i get this:

//// amx_mess.sma
// D:Spill/Steam/SteamApps/My@Mail(Secret :lol:)/detiacted server/cstrike/addons/amxmodx/scripting/amx_mess.sma <30> : warning 217: loose indentation
// D:Spill/Steam/SteamApps/My@Mail(Secret :lol:)/detiacted server/cstrike/addons/amxmodx/scripting/amx_mess.sma <52> : warning 217: loose indentation
//
// 2 warnings.
// Done.

And can somebody help me to make amx write "*Player* has been messed up by the admins. Have fun!" on the screen when the command is used?
Well, this is what i got now:
Code:
#include <amxmodx> #include <amxmisc> public plugin_init() { register_plugin("amx_mess", "1.0", "XunTric") register_concmd("amx_mess", "cmdmess", ADMIN_KICK, "<name or #userid>") register_concmd("amx_unmess", "cmdunmess", ADMIN_KICK, "<name or #userid>") } public cmdmess(id,level,cid) {     if (!cmd_access(id,level,cid,2))          return PLUGIN_HANDLED     new arg[32]     read_argv(1,arg,31)     new player = cmd_target(id,arg,1)     if(!player)          return PLUGIN_HANDLED     new name[64];     get_user_name(player,name,63);     server_cmd("amx_llama ^"%s^"", name)     server_cmd("amx_chicken ^"%s^"", name)     server_cmd("amx_name ^"%s^" ^"DONT MESS WITH THE ADMINS^"", name)          return PLUGIN_HANDLED } public cmdunmess(id,level,cid) {         if (!cmd_access(id,level,cid,2))          return PLUGIN_HANDLED     new arg[32]     read_argv(1,arg,31)     new player = cmd_target(id,arg,1)     if(!player)          return PLUGIN_HANDLED     new name[64];     get_user_name(player,name,63);     server_cmd("amx_unllama ^"%s^"", name)     server_cmd("amx_unchicken ^"%s^"", name)     server_cmd("amx_name ^"%s^" ^"I CAN CHANGE MY NAME BACK NOW^"", name)          return PLUGIN_HANDLED }

XxAvalanchexX 02-04-2005 20:41

Loose indentations don't affect the plugin at all. Anyway, are you sure the amx_chicken function exists? Do you have chickenmod on your server?

XunTric 02-05-2005 04:15

Yes im 100% sure that chicken mod exist. I dont got the original on metamod though. I just downloaded that chickenmod: rebirth thing to amxx. Do you have any idea of whats wrong?
-----------------------------------------------------------------------------
EDIT:
I made it! =) I just read thru the chicken mod readme file and found a command called c_chicken instead of amx_chicken. And that one worked =)

Silverice146 04-06-2005 00:11

lol gj sounds pretty tight :lol:

XxAvalanchexX 04-06-2005 14:28

http://forums.joe.to/images/smiles/pic_lastweek.jpg

Silverice, you revived a thread 2 months old for no reaosn whatsoever... nice.


All times are GMT -4. The time now is 19:21.

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