AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Give Health and Armor (https://forums.alliedmods.net/showthread.php?t=22553)

MOBOB 12-29-2005 23:27

Give Health and Armor
 
i am trying to write another plugin that is similar to my freegun plugin (http://forums.alliedmods.net/showthread.php?t=22492) except it works with health and armor. If a player says "give armor" they get 100 armor and if a player says "give health" it gives them 200 health. And this can only be done once per map. I compiled and loaded the plugin and it loads fine but the commands do not work. Can someone take a look at my code and tell me what i am doing wrong?

Code:
#include <amxmodx>   #include <amxmisc>   #include <cstrike>   #include <fun>   #define PLUGIN "Health/Armor"   #define VERSION "1.0"   #define AUTHOR "|sXe| Mr. Foster"   new bool:user_tookhealth[33] public plugin_init() {       register_plugin(PLUGIN, VERSION, AUTHOR)       register_clcmd("give", "cmd_weapon", ADMIN_LEVEL_H, "<weapon(health, armor)>")             set_task(300.0, "sayplugin", _,_,_, "b") }   public client_putinserver(id) {     user_tookhealth[id] = false } public cmd_weapon(id, level, cid) {       if(!cmd_access(id, level, cid, 2))         return PLUGIN_HANDLED     if(user_tookhealth[id])         return PLUGIN_HANDLED             new whatwassaid[32]       read_argv(1, whatwassaid, 31)           new name[32]     get_user_name(id, name, 31)         if(equali(whatwassaid,"health", 5))     {       set_user_health(id, 200)         client_print(0,print_chat, "%s used his Health/Armor power to give himself an 200 health", name)     client_print(0,print_chat, "Please visit <a href="http://www.sXeGaming.cjb.net" target="_blank" rel="nofollow noopener">www.sXeGaming.cjb.net</a> to learn about donating to our server and receiving Freegun and Health/Armor access.", name)           user_tookhealth[id] = true     }     else if(equali(whatwassaid,"armor", 5))     {       set_user_armor(id, 100)         client_print(0,print_chat, "%s used his Health/Armor power to give himself an 100 armor.", name)     client_print(0,print_chat, "Please visit <a href="http://www.sXeGaming.cjb.net" target="_blank" rel="nofollow noopener">www.sXeGaming.cjb.net</a> to learn about donating to our server and receiving Freegun and Health/Armor access.", name)           user_tookhealth[id] = true     }     return PLUGIN_HANDLED }   public sayplugin() {     for(new id = 1; id <= get_maxplayers(); id++)     {         client_print(id, print_chat, "<|sXe| Clan Pub Server> If you have Health/Armor access type <give health> or <give armor> in console to receive health or armor.")         set_hudmessage(0, 0, 0, 0.57, 0.93, 0, 6.0, 12.0)           show_hudmessage(id, "If you have Health/Armor access type <give health> or <give armor> in console to receive health or armor.")     } }

v3x 12-29-2005 23:57

Try taking the '5' out.
Code:
if(equali(whatwassaid,"health"))
And the other one as well.

MOBOB 12-30-2005 00:46

alright ill try it now... dont ask me why it was there in teh first place i took that section of code from a different plugin.

thanks


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

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