AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Set Health Command Help (https://forums.alliedmods.net/showthread.php?t=29831)

Minimum 06-13-2006 17:33

Set Health Command Help
 
Ok, when I compile this I get an error stating argument type mismatch. It says its on the line where I have set_user_health. I tried to fix this in many different ways but it keeps showing this error. This is one problem I can't seem to figure out. I only included the public part of the code just so you know. This is part of a bigger plugin. Thanks in advance for any help.

Code:
public minisethealth(id) {     new entid, entbody, health[32]     read_argv(1,health,31)     remove_quotes(health)         // "You don't know who you messing with fool!"     if(!(get_user_flags(id) & ADMIN_SLAY)) {         client_print(id, print_console, "***Access Denied***^n")         return PLUGIN_HANDLED     }     if(equali(health,"")) {         client_print(id,print_console,"Usage: amx_sethealth <health>^n")         return PLUGIN_HANDLED     }     get_user_aiming(id,entid,entbody,9999)     // Are you looking at someone?     if(!is_user_connected(entid)) {         client_print(id,print_chat,"What are you looking at?  A wall?^n")         return PLUGIN_HANDLED     }         // Setting the health     set_user_health(entid, health)     return PLUGIN_HANDLED }

Brad 06-13-2006 18:12

Your "health" variable is a string. It needs to be an integer.

lunarwolfx 06-13-2006 23:35

Code:
new sethealth = str_to_num(health) set_user_health(entid,sethealth)


All times are GMT -4. The time now is 08:07.

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