Raised This Month: $ Target: $400
 0% 

I'm clueless...


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
xMalcusx
Junior Member
Join Date: Mar 2006
Old 11-10-2007 , 11:24   I'm clueless...
Reply With Quote #1

I'm new to this, completely.. so I followed the tutorial on the amxmodx.org .doc section.. and apparently I did something wrong.. can anyone point it out? I'm clueless..
Quote:
#include <amxmodx>
#include <amxmisc>
#include <fun>

new PLUGIN[] ="Change HP"
new VERSION[] ="1.0"
new AUTHOR[] ="Marlon"


public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)
register_concmd("amx_hp", "cmd_hp", ADMIN_SLAY, "<target> <hp> ")
}
public cmd_hp(id, level, cid)
{
if (!cmd_acess(id, level, cid, 3))
return PLUGIN_HANDLED
new Arg1[24]
new Arg2[4]

read_argv(1, Arg1, 23)
read_argv(2, Arg2, 3)

new Health = str_to_num(Arg2)

if (Arg1[0] == '@')
}
{
new Team = 0
if (equali(Arg1[1], "CT"))
{
Team = 2
} else if (equali(Arg1[1], "T")) {
Team = 1
}
new player[32], num
get_players(players, num)
new i
for (i=0 i<num; i++)
{
if (!Team)
{

set_user_health(players[i], Health)
} else {
if (get_user_team(players[i]) == Team)
{
set_user_health(players[i], Health)
}
}
}
} else {
new player = cmd_target(id, Arg1, 1)
if (!player)
{
console_print(id, "Sorry, player %s was not found!", Arg1)
return PLUGIN_HANDLED
} else {
set_user_health(player, Health)
}
}
{
return PLUGIN_HANDLED
}
xMalcusx is offline
[ --<-@ ] Black Rose
ANNIHILATED
Join Date: Sep 2005
Location: Stockholm, Sweden.
Old 11-10-2007 , 11:43   Re: I'm clueless...
Reply With Quote #2

line 17: cmd_acess(), should be cmd_access()
line 28: remove '}'
line 64(or 63 if you removed line 28): remove '{'
[ --<-@ ] Black Rose is offline
xMalcusx
Junior Member
Join Date: Mar 2006
Old 11-10-2007 , 11:48   Re: I'm clueless...
Reply With Quote #3

Thanks alot.

A new error: undefined symbol "players"

Last edited by xMalcusx; 11-10-2007 at 11:51.
xMalcusx is offline
Alka
AMX Mod X Plugin Approver
Join Date: Dec 2006
Location: malloc(null)
Old 11-10-2007 , 11:48   Re: I'm clueless...
Reply With Quote #4

Look, like this should look you'r code .

Code:
#include <amxmodx>
#include <amxmisc>
#include <fun>
 
new const PLUGIN[] = "Change HP";
new const VERSION[] = "1.0";
new const AUTHOR[] = "Marlon";
 
public plugin_init()
{
 register_plugin(PLUGIN, VERSION, AUTHOR);
 
 register_concmd("amx_hp", "CmdHp", ADMIN_SLAY, "<Target/@CT/@T> <hp>");
 
}
 
public CmdHp(id, level, cid)
{
 if (!cmd_access(id, level, cid, 2))
  return PLUGIN_HANDLED;
 
 new Arg1[10], Arg2[3];
 new Team;
 
 read_argv(1, Arg1, sizeof Arg1 - 1);
 read_argv(2, Arg2, sizeof Arg2 - 1);
 
 new Health = str_to_num(Arg2);
 
 if(Arg1[0] == '@')
 {
  if(equali(Arg1[1], "CT"))
   Team = 2;
  else if(equali(Arg1[1], "T"))
   Team = 1;
  else 
   Team = 0;
  
  new Players[32], Num, Player;
  get_players(Players, Num);
  
  for(new i = 0 ; i < Num ; i++)
  {
   Player = Players[i];
   
   if(!Team)
    set_user_health(Player, Health);
   
   else
   {
    if(get_user_team(Player) == Team)
     set_user_health(Player, Health);
   }
  }
 } 
 else
 {
  new Target = cmd_target(id, Arg1, 1);
  
  if(!Target)
   return PLUGIN_HANDLED;
  
  set_user_health(Target, Health);
 }
 return PLUGIN_HANDLED;
}
__________________
Still...lovin' . Connor noob! Hello
Alka 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 01:21.


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