AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   [ZP] Human and Zombie Remaining (https://forums.alliedmods.net/showthread.php?t=230337)

serjaka 11-23-2013 13:59

[ZP] Human and Zombie Remaining
 
Hello AlliedModders i have a problem with scripting! i want too add sniper and assassin round check! So i have this plugin:
PHP Code:

 #include <amxmodx>
#include <fakemeta>
#include <hamsandwich>
#include <zombieplague2>

/*================================================================================
 [Constants, Offsets, Macros]
=================================================================================*/

// Plugin Version
new const PLUGIN_VERSION[] = "1.0.0"

/*================================================================================
 [Global Variables]
=================================================================================*/

// Game vars
new g_iMaxPlayers // max player counter
new g_HudSync
new g_bNemesis // Nemesis round
new g_bSurvivor // Survivor round
new g_bAssassin // Nemesis round
new g_bSniper // Survivor round

/*================================================================================
 [Init]
=================================================================================*/

public plugin_init()
{
    
register_plugin("Zombie Plague Stats"PLUGIN_VERSION"Serjaka")
    
    
RegisterHam(Ham_Killed"player""Ham_Killed_Post"1)
    
    
g_iMaxPlayers get_maxplayers()
    
    
g_HudSync CreateHudSyncObj()
}

/*================================================================================
 [Main Forwards]
=================================================================================*/

public zp_round_started(modeplayer)
{
    switch (
mode)
    {
        case 
MODE_NEMESISg_bNemesis true;
        case 
MODE_SURVIVORg_bSurvivor true;
        case 
MODE_ASSASSINg_bAssassin true;
        case 
MODE_SNIPERg_bSniper true;
    }
}


public 
Ham_Killed_Post(victimattackergib)
{
    
display_enemy_remaining()
}

public 
zp_user_humanized_post(idsurvivor)
{
    
display_enemy_remaining()
}

public 
zp_user_infected_post(idinfectornemesis)
{
    
display_enemy_remaining()


I want to add assassin and sniper round check too, i write this in code but it doesnt work (Error : you alredy difine...)
PHP Code:

 public zp_user_humanized_post(idsniper)
{
    
display_enemy_remaining()


PHP Code:

public zp_user_infected_post(idinfectorassassin)
{
    
display_enemy_remaining()


i got error too If i add
PHP Code:

 public zp_user_infected_post(idinfectorassassinnemesis

and
PHP Code:

 public zp_user_humanized_post(idsnipersurvivor

help me please to fix this ! i need for sniper and assassin round too ! THX! Sorry for my bad English!

bat 11-23-2013 14:29

Re: [ZP] Human and Zombie Remaining
 
Test it

Code:

public display_enemy_remaining()
{
    if (g_bNemesis || g_bSurvivor || g_bAssassin || g_bSniper) return
   
    for (new i = 1; i <= g_iMaxPlayers; i++)
    {
        if (!is_user_connected(i)) continue
        if (!is_user_alive(i)) continue
       
        static message[128], zombie_count, human_count
        human_count = zp_get_human_count()
        zombie_count = zp_get_zombie_count()
       
        if (!zp_get_user_zombie(i) || !zp_get_user_nemesis(i) || !zp_get_user_assassin(i) && zombie_count)
        {
            set_hudmessage(175, 175, 175, 0.05, 0.625, 2, 0.02, 3.0, 0.01, 0.3, 2)

            format(message, 127, "%d Zombie%s Remaining...", zombie_count, (zombie_count == 1) ? "" : "s")
            ShowSyncHudMsg(i, g_HudSync, "%s", message)
        }
        else if (zp_get_user_zombie(i) || zp_get_user_survivor(i) || zp_get_user_sniper(i) && human_count)
        {
            set_hudmessage(175, 175, 175, 0.05, 0.625, 2, 0.02, 3.0, 0.01, 0.3, 2)

            format(message, 127, "%d Human%s Remaining...", human_count, (human_count == 1) ? "" : "s")
            ShowSyncHudMsg(i, g_HudSync, "%s", message)
        }
    }
}


serjaka 11-23-2013 14:35

Re: [ZP] Human and Zombie Remaining
 
Dont work , i need to add this but i got error on copile
PHP Code:

  public zp_user_humanized_post(idsniper)
{
    
display_enemy_remaining()


and for assasin to

bat 11-23-2013 14:52

Re: [ZP] Human and Zombie Remaining
 
Code:

public zp_user_humanized_post(id)
{
  if (!zp_get_user_zombie(id) || zp_get_user_survivor(id) || zp_get_user_sniper(id))
  {
      display_enemy_remaining()
  }
}

public zp_user_infected_post(id, infector)
{
  if (zp_get_user_zombie(id) || zp_get_user_assassin(id) || zp_get_user_nemesis(id))
  {
      display_enemy_remaining()
  }
}


serjaka 11-23-2013 16:07

Re: [ZP] Human and Zombie Remaining
 
This code in both code?
PHP Code:

 zp_get_user_zombie(id


bat 11-23-2013 16:36

Re: [ZP] Human and Zombie Remaining
 
Code:

zp_get_user_zombie
It is Zombie

Code:

!zp_get_user_zombie
It is Human

serjaka 11-23-2013 18:16

Re: [ZP] Human and Zombie Remaining
 
thx works perfect :)


All times are GMT -4. The time now is 23:19.

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