Raised This Month: $ Target: $400
 0% 

need some easy help..


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
haimmaik
Senior Member
Join Date: Jul 2005
Old 10-29-2005 , 16:10   need some easy help..
Reply With Quote #1

im a noob that started learning AMXX and i made a new plugin (yes i aslo used info from the tutorial and stuff) and i got a problem..
here is the script:

Code:
#include <amxmodx>
#include <amxmisc>
#include <fun>

new plugin[]="Health Plugin"
new autor[]="Haim"
new version[]="1.00"

public plugin_init()
{
	register_plugin(plugin,version,autor)
	register_concmd("addhp", "func_hp", ADMIN_LEVEL_A, "<target> <hp>")
	register_cvar("togglehp", "1")
}

public func_hp(id, level, cid)
//--------------------------------------------------------[GENERAL STUFF]
{
	if (!get_cvar_num("togglehp"))
	{
		console_print(id, "this function is off.. plz change togglehp to 1")
		return PLUGIN_HANDLED
	}
	if (!cmd_access(id, level, cid, 3))
	{
		console_print(id, "sorry, ur too noob to use that command")
		return PLUGIN_HANDLED
	}
	
	new arg[32]
	new hp[3]
	read_argv(1, arg, 31)
	read_argv(2, hp, 2)
	new hpf = str_to_num(hp)
//------------------------------------------------------[TEAM]
	if (equali(arg[0],"@"))
	{
		new team = 0
		if (equali(arg[1], "T"))
		{
			team = 1
		} else
		if (equali(arg[1], "C"))
		{
			team = 2
		} else
		if (equali(arg[1], "A"))
		{
			team = 3
		} else
		{
			console_print(id, "No such team")
			return PLUGIN_HANDLED
		}
		new team_players[32], nb, i
		get_players(team_players, nb, "a")
		for(i=0;i<nb;i++)
		{
			if(get_user_team(team_players[i])== team)
			{
				set_user_health(team_players[i], get_user_health(team_players[i])+hpf)	
			}
			if(team == 3)
			{
				set_user_health(team_players[i], get_user_health(team_players[i])+hpf)
			}
		}
	}


//------------------------------------------------------[SINGLE PLAYER]
	if(!equali(arg[0], "@"))
	{
		new player = cmd_target(id, arg, 4)
		if (!player)
		{
			console_print(id, "no such player")
			return PLUGIN_HANDLED
		} else {
			set_user_health(player, get_user_health(player)+hpf)
		}
	}
	return PLUGIN_HANDLED
}
everything is beeing compiled well.. but ingame when i try to add HP to a spacifc team the console says says:
"
-Client with that name or userid not found
-no such play
"
haimmaik is offline
XxAvalanchexX
Veteran Member
Join Date: Oct 2004
Location: abort73.com
Old 10-29-2005 , 16:23  
Reply With Quote #2

Code:
if (equali(arg[0],"@"))
This will compare the arg variable, starting at character 0, to the string "@". If you want to check only the first character, use this:
Code:
if(arg[0] == '@')
__________________
No longer around. Thanks your support, everyone! As always:
THIS ONES FOR YOU
3000 PTS
XxAvalanchexX is offline
haimmaik
Senior Member
Join Date: Jul 2005
Old 10-29-2005 , 16:32  
Reply With Quote #3

thanks

now i have another problem :\
i wanted to make my script abit more usefull so i added a speed function:

Code:
public func_spd(id, level, cid) {     if (!get_cvar_num("togglehm"))     {         console_print(id, "this function is off.. plz change togglehp to 1")         return PLUGIN_HANDLED     }     if (!cmd_access(id, level, cid, 3))     {         console_print(id, "sorry, ur too noob to use that command")         return PLUGIN_HANDLED     }         new arg[32]     new float:spd[5]     read_argv(1,arg,31)     read_argv(2,spd,4)     new float:spdf = str_to_float(spd)     new player = cmd_target(id, arg, 4)     if (!player)     {         console_print(id, "no such player")         return PLUGIN_HANDLED     } else {         set_user_maxspeed(player,spdf)     }     return PLUGIN_HANDLED

when i compile it i get 2 warnings:

in line 105 - warning 213 tag mismatch
in line 111 - warning 213 tag mismatch

line 105 = "new player = cmd_target(id, arg, 4)"
line 111 = "set_user_maxspeed(player,spdf)"

plz help ^^

oh and.. can u plz tell me how to do that the speed wont reset every time i change weapon? :\
haimmaik is offline
XxAvalanchexX
Veteran Member
Join Date: Oct 2004
Location: abort73.com
Old 10-29-2005 , 18:03  
Reply With Quote #4

Change new float:spd[5] to new spd[5]. Change new float:spdf to new Float:spdf.

As for the speed thing, you'll have to register the CurWeapon event and reset their speed each time it comes up, which means you'll have to store somewhere what their speed should be.
__________________
No longer around. Thanks your support, everyone! As always:
THIS ONES FOR YOU
3000 PTS
XxAvalanchexX is offline
haimmaik
Senior Member
Join Date: Jul 2005
Old 10-29-2005 , 18:59  
Reply With Quote #5

can u suggest a way? :\
haimmaik is offline
Reply



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 23:43.


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