AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   [SOLVED] ZP surv/neme healt. (https://forums.alliedmods.net/showthread.php?t=140271)

Garrey 10-10-2010 09:03

[SOLVED] ZP surv/neme healt.
 
1 Attachment(s)
PHP Code:

#include <amxmodx>
#include <hamsandwich>
#include <zombieplague>
#include <cstrike>

#define PLUGIN_NAME "[ZP] Show HP"
#define PLUGIN_VERS "2.0"
#define PLUGIN_AUTH "ASSOM\HLDS"

#define TASK_HEALTH 1234554321

new name[32]

public 
plugin_init()
{
   
register_plugin(PLUGIN_NAMEPLUGIN_VERSPLUGIN_AUTH)
   
register_dictionary("zombie_plague.txt")

   
// Fwd's
   
RegisterHam(Ham_Spawn"player""Fwd_PlayerSpawn_Post"1)
   
RegisterHam(Ham_Killed"player""Fwd_PlayerKilled_Pre"0)
   
register_event("HLTV""event_round_start""a""1=0""2=0")
}

public 
Fwd_PlayerSpawn_Post(id)
{
   if (
task_exists(id+TASK_HEALTH))
      
remove_task(id+TASK_HEALTH)
}

public 
Fwd_PlayerKilled_Pre(victimattackershouldgib)
{
   if (
task_exists(victim+TASK_HEALTH))
      
remove_task(victim+TASK_HEALTH)
}

public 
event_round_start(modeid)
//public zp_round_started(mode, id)
{
   if (
zp_has_round_started())
   {

      if (
mode == MODE_NEMESIS)
      {
      
set_task(1.0"Health_Nemisis"id+TASK_HEALTH__"b")
      return
      }

      if (
mode == MODE_SURVIVOR)
      {
      
set_task(1.0"Health_Survivor"id+TASK_HEALTH__"b")
      return
      }

   }
}

public 
Health_Nemisis(id)
{
   
id -= TASK_HEALTH
   
   
if (zp_get_user_nemesis(id))
      
      
remove_task(id+TASK_HEALTH)
      
get_user_name(id,name,31)
      
set_hudmessage(250000.050.4501.01.00.10.2, -1)
      
show_hudmessage(0"%s - %L: %d %L"nameLANG_PLAYER"CLASS_NEMESIS"get_user_health(id), LANG_PLAYER"ZOMBIE_ATTRIB1")
}

public 
Health_Survivor(id)
{
   
id -= TASK_HEALTH
   
   
if (zp_get_user_survivor(id))
   
    
remove_task(id+TASK_HEALTH)
    
get_user_name(id,name,31)
    
set_hudmessage(002500.050.4501.01.00.10.2, -1)
    
show_hudmessage(0"%s - %L: %d %L"nameLANG_PLAYER"CLASS_SURVIVOR"get_user_health(id), LANG_PLAYER"ZOMBIE_ATTRIB1")




public 
zp_round_ended()
{
   
remove_task(TASK_HEALTH)
}

/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1049\\ f0\\ fs16 \n\\ par }
*/ 

I found this, but it wont compile :(
On line 77, 79 is loose identitation.

Could someone help to fix it?

SaM.ThE.MaN 10-10-2010 09:33

Re: ZP surv/neme healt.
 
Ok ... First of all , Ignore loose indentations , they are nothing , by nothing i mean its not a big deal and wont give you any errors...

I just fixed it for you , So you would be happy -.- :
PHP Code:

#include <amxmodx>
#include <hamsandwich>
#include <zombieplague>
#include <cstrike>

#define PLUGIN_NAME "[ZP] Show HP"
#define PLUGIN_VERS "2.0"
#define PLUGIN_AUTH "ASSOM\HLDS"

#define TASK_HEALTH 1234554321

new name[32]

public 
plugin_init()
{
   
register_plugin(PLUGIN_NAMEPLUGIN_VERSPLUGIN_AUTH)
   
register_dictionary("zombie_plague.txt")

   
// Fwd's
   
RegisterHam(Ham_Spawn"player""Fwd_PlayerSpawn_Post"1)
   
RegisterHam(Ham_Killed"player""Fwd_PlayerKilled_Pre"0)
   
register_event("HLTV""event_round_start""a""1=0""2=0")
}

public 
Fwd_PlayerSpawn_Post(id)
{
   if (
task_exists(id+TASK_HEALTH))
      
remove_task(id+TASK_HEALTH)
}

public 
Fwd_PlayerKilled_Pre(victimattackershouldgib)
{
   if (
task_exists(victim+TASK_HEALTH))
      
remove_task(victim+TASK_HEALTH)
}

public 
event_round_start(modeid)
//public zp_round_started(mode, id)
{
   if (
zp_has_round_started())
   {

      if (
mode == MODE_NEMESIS)
      {
      
set_task(1.0"Health_Nemisis"id+TASK_HEALTH__"b")
      return
      }

      if (
mode == MODE_SURVIVOR)
      {
      
set_task(1.0"Health_Survivor"id+TASK_HEALTH__"b")
      return
      }

   }
}

public 
Health_Nemisis(id)
{
   
id -= TASK_HEALTH
   
   
if (zp_get_user_nemesis(id))
      
      
remove_task(id+TASK_HEALTH)
   
get_user_name(id,name,31)
   
set_hudmessage(250000.050.4501.01.00.10.2, -1)
   
show_hudmessage(0"%s - %L: %d %L"nameLANG_PLAYER"CLASS_NEMESIS"get_user_health(id), LANG_PLAYER"ZOMBIE_ATTRIB1")
}

public 
Health_Survivor(id)
{
   
id -= TASK_HEALTH
   
   
if (zp_get_user_survivor(id))
   
    
remove_task(id+TASK_HEALTH)
   
get_user_name(id,name,31)
   
set_hudmessage(002500.050.4501.01.00.10.2, -1)
   
show_hudmessage(0"%s - %L: %d %L"nameLANG_PLAYER"CLASS_SURVIVOR"get_user_health(id), LANG_PLAYER"ZOMBIE_ATTRIB1")




public 
zp_round_ended()
{
   
remove_task(TASK_HEALTH)
}

/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1049\\ f0\\ fs16 \n\\ par }
*/ 


Garrey 10-10-2010 10:10

Re: ZP surv/neme healt.
 
Thank you! :)

lucas_7_94 10-10-2010 11:21

Re: [SOLVED] ZP surv/neme healt.
 
in event_round_start can use switch() funcion

abdul-rehman 10-10-2010 13:16

Re: [SOLVED] ZP surv/neme healt.
 
Code:
event_round_start(mode, id)
WTF event round start is called with no parameters so you must use zp_round_started


All times are GMT -4. The time now is 10:24.

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