AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   What is wrong ???? (https://forums.alliedmods.net/showthread.php?t=156693)

.Dare Devil. 05-10-2011 14:03

What is wrong ????
 
PHP Code:

 
public ShowHUD(taskid)
{
 static 
id
 id 
ID_SHOWHUD;
 
 
// Player died?
 
if (!g_isalive[id])
 {
  
// Get spectating target
  
id pev(idPEV_SPEC_TARGET)
 
  
// Target not alive
  
if (!g_isalive[id]) return;
 }
 
 
// Format classname
 
static class[32], redgreenbluehudxhudy
 
 
if (g_zombie[id]) // zombies
 
{
  
red 171
  green 
16
  blue 
16
  hudx 
get_pcvar_float(cvar_zombie_hud_x)
  
hudy get_pcvar_float(cvar_zombie_hud_y)
 
  if (
g_nemesis[id])
   
formatex(class, charsmax(class), "%L"ID_SHOWHUD"CLASS_NEMESIS")
  else if (
g_assassin[id])
   
formatex(class, charsmax(class), "%L"ID_SHOWHUD"CLASS_ASSASSIN")
  else
   
copy(class, charsmax(class), g_zombie_classname[id])
 }
 else 
// humans
 
{
  
red 2
  green 
105
  blue 
189
  hudx 
get_pcvar_float(cvar_human_hud_x)
  
hudy get_pcvar_float(cvar_human_hud_y)
 
  if (
g_survivor[id])
   
formatex(class, charsmax(class), "%L"ID_SHOWHUD"CLASS_SURVIVOR")
  else if (
g_sniper[id])
   
formatex(class, charsmax(class), "%L"ID_SHOWHUD"CLASS_SNIPER")
  else if (
g_wesker[id])
   
formatex(class, charsmax(class), "%L"ID_SHOWHUD"CLASS_WESKER")
  else
   
formatex(class, charsmax(class), "%L"ID_SHOWHUD"CLASS_HUMAN")
 }
 
 
// Spectating someone else?
 
if (id != ID_SHOWHUD)
 {
  
// Show name, health, class, and ammo packs and armor
  
set_hudmessage(106106106HUD_SPECT_XHUD_SPECT_Y16.01.10.00.0, -1)
  
ShowSyncHudMsg(ID_SHOWHUDg_MsgSync2"%L %L %s^nHP: %d | %L %s | %L %d %L"ID_SHOWHUD"BAR_CODE1"ID_SHOWHUD"SPECTATING"g_playername[id],
  
pev(idpev_health), ID_SHOWHUD"CLASS_CLASS", class, ID_SHOWHUD"AMMO_PACKS1"g_ammopacks[id], ID_SHOWHUD"BAR_CODE2")
 }
 else
 {
  
// Show health, class and ammo packs and armor
  
set_hudmessage(redgreenbluehudxhudy06.01.10.00.0, -1)
  
ShowSyncHudMsg(ID_SHOWHUDg_MsgSync2"%L %L: %d | %L %s | %L %d %L"ID_SHOWHUD"BAR_CODE1"id"ZOMBIE_ATTRIB1"pev(ID_SHOWHUDpev_health), ID_SHOWHUD"CLASS_CLASS",
  class, 
ID_SHOWHUD"AMMO_PACKS1"g_ammopacks[ID_SHOWHUD], ID_SHOWHUD"BAR_CODE2")
 }


Something is wrong. I cant compile , get error : tag mismatch 12151 line.

bibu 05-10-2011 14:22

Re: What is wrong ????
 
Tell us the line 12151 then?

.Dare Devil. 05-10-2011 14:50

Re: What is wrong ????
 
PHP Code:

 
public ShowHUD(taskid)
{
 static 
id
 id 
ID_SHOWHUD;
 
 
// Player died?
 
if (!g_isalive[id])
 {
  
// Get spectating target
  
id pev(idPEV_SPEC_TARGET)
 
  
// Target not alive
  
if (!g_isalive[id]) return;
 }
 
 
// Format classname
 
static class[32], redgreenbluehudxhudy
 
 
if (g_zombie[id]) // zombies
 
{
  
red 171
  green 
16
  blue 
16
  hudx 
get_pcvar_float(cvar_zombie_hud_x)
  
hudy get_pcvar_float(cvar_zombie_hud_y)
 
  if (
g_nemesis[id])
   
formatex(class, charsmax(class), "%L"ID_SHOWHUD"CLASS_NEMESIS")
  else if (
g_assassin[id])
   
formatex(class, charsmax(class), "%L"ID_SHOWHUD"CLASS_ASSASSIN")
  else
   
copy(class, charsmax(class), g_zombie_classname[id])
 }
 else 
// humans
 
{
  
red 2
  green 
105
  blue 
189
  hudx 
get_pcvar_float(cvar_human_hud_x)
  
hudy get_pcvar_float(cvar_human_hud_y)
 
  if (
g_survivor[id])
   
formatex(class, charsmax(class), "%L"ID_SHOWHUD"CLASS_SURVIVOR")
  else if (
g_sniper[id])
   
formatex(class, charsmax(class), "%L"ID_SHOWHUD"CLASS_SNIPER")
  else if (
g_wesker[id])
   
formatex(class, charsmax(class), "%L"ID_SHOWHUD"CLASS_WESKER")
  else
   
formatex(class, charsmax(class), "%L"ID_SHOWHUD"CLASS_HUMAN")
 }
 
 
// Spectating someone else?
 
if (id != ID_SHOWHUD)
 {
  
// Show name, health, class, and ammo packs and armor
  
set_hudmessage(106106106HUD_SPECT_XHUD_SPECT_Y16.01.10.00.0, -1)
  
ShowSyncHudMsg(ID_SHOWHUDg_MsgSync2"%L %L %s^nHP: %d | %L %s | %L %d %L"ID_SHOWHUD"BAR_CODE1"ID_SHOWHUD"SPECTATING"g_playername[id],
  
pev(idpev_health), ID_SHOWHUD"CLASS_CLASS", class, ID_SHOWHUD"AMMO_PACKS1"g_ammopacks[id], ID_SHOWHUD"BAR_CODE2")
 }
 else
 {
  
// Show health, class and ammo packs and armor
 
here  --- » set_hudmessage(redgreenbluehudxhudy06.01.10.00.0, -1)
  
ShowSyncHudMsg(ID_SHOWHUDg_MsgSync2"%L %L: %d | %L %s | %L %d %L"ID_SHOWHUD"BAR_CODE1"id"ZOMBIE_ATTRIB1"pev(ID_SHOWHUDpev_health), ID_SHOWHUD"CLASS_CLASS",
  class, 
ID_SHOWHUD"AMMO_PACKS1"g_ammopacks[ID_SHOWHUD], ID_SHOWHUD"BAR_CODE2")
 }



.Dare Devil. 05-10-2011 15:04

Re: What is wrong ????
 
Yeah, i got this working.
I just make other way.

SonicSonedit 05-10-2011 15:07

Re: What is wrong ????
 
.Dare Devil.
I can't find any problem. What is tag mismatch line?

Edited:
Okay. Oh, btw: don't use get_pcvar_float on every function call. Cache this cvar into float variable and use this variable instead.

fysiks 05-10-2011 19:35

Re: What is wrong ????
 
IIRC, tag mismatch is not an 'error' and does not prevent a plugin from compiling.

.Dare Devil. 05-11-2011 06:14

Re: What is wrong ????
 
I use ohter way and this way what i use now, working fine.

but thanks .

Hunter-Digital 05-11-2011 09:59

Re: What is wrong ????
 
Your hudx and hudy aren't stated as floats, you're assigning floats to them but that doesn't make them float.
Quote:

Originally Posted by .Dare Devil. (Post 1466973)
static class[32], red, green, blue, hudx, hudy

->
Code:

static class[32], red, green, blue, Float:hudx, Float:hudy

.Dare Devil. 05-11-2011 10:50

Re: What is wrong ????
 
Quote:

Originally Posted by Hunter-Digital (Post 1467454)
Your hudx and hudy aren't stated as floats, you're assigning floats to them but that doesn't make them float.

->
Code:

static class[32], red, green, blue, Float:hudx, Float:hudy

Thanks again :)

but i really use this way now :)


All times are GMT -4. The time now is 04:30.

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