Raised This Month: $ Target: $400
 0% 

Zombie Classes A lil help here its almost done!


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Schoolboy
Member
Join Date: Oct 2007
Location: 3rd Rock from the sun.
Old 03-02-2008 , 10:01   Zombie Classes A lil help here its almost done!
Reply With Quote #1

What its SUPPOSED to do:

This plugin shows a menu at the start of each round. This menu is supposed to go with Mini Midget's Zombie Swarm and works only for Ts to select their class. Each class gives separate abilities:

Phantom Zombie:
- Admin only (Flag used is admin immunity)
- 10000 HP
- 200 AP
- 1000 SPD
- No clip (Yeah I know its insane stats but its admin only after all )

The Flash:
- 1500 HP
- 200 AP
- 1000 SPD

Juggernaut:
- 6000 HP
- 200 AP
- 350 SPD

Invisible Zombie:
- 2500 HP
- 200 AP
- 500 SPD
- 5 Alpha (Level of invisibility)

Mother Brood:
- 3000 HP
- 1000 AP
- 650 SPD


Side notes:

- I am running Zombie Swarm 2.4
- Running Dedicated Server
- Yes there is only ONE cvar (sv_classmod 1/0) This plugin is small, so setting the HP, AP, SPD is very easy.
- This is only meant for Ts (Zombies) usage.
- Tested for errors in CS 1.6.
- No errors during compilation, pre-gameplay and post gameplay. (I used the meta list and amx_plugins commands to check for errors.)
- Players CANNOT change classes during gameplay
- Players CANNOT "save" classes. Meaning they have to select their class every round.
- Code is both attached and included in this post.

Errors:


- Speed for The Flash is not working (It might be just me?)
- No other known bugs. Please help me fix if you find any.

Wishlist: (Not errors but more like a good-to-have)

- Make the menu close after X seconds
- Make spaces in between Mother Brood Zombie and Regular Zombie

Eg.

Normal menu:

Choose your class:
1: Phantom Zombie
2: The Flash
3: Juggernaut
4: Invisible Zombie
5: Mother Brood
0: Regular Zombie

New menu with spaces:

Choose your class:
1: Phantom Zombie
2: The Flash
3: Juggernaut
4: Invisible Zombie
5: Mother Brood

( 3 spaces in between )

0: Regular Zombie


Note that even with spaces, the keys are not affect. Means that if I press 1, I should get phantom zombie and if I press 0 I should get normal zombie and if I press 4 I should get invisible zombie.etc.

HERE IS THE CODE:


Code:
/*


Version History:

1.0 - Plugin Created
1.1 - Code Fixed by G-Dog


Errors/Wishlist:

- Add 3 spaces between Regular Zombie and Mother Brood.
- Fix Flash's speed.
- Make Menu close after X seconds.


Credits:

minda/mr.panda/mr.panda.net - Ideas
G-Dog - Fixed Code



*/

#include <amxmodx> 
#include <amxmisc> 
#include <cstrike> 
#include <fun> 
#include <engine>

#define PLUGIN "Streamy's Class Mod"
#define VERSION "1.1" 
#define AUTHOR "Streamy"

#define Keysclassmenu ( 1<<0 | 1<<1 | 1<<2 | 1<<3 | 1<<4 | 1<<9 )

new bool:noflash[33]
new g_nMsgScreenFade

new bool:phantomspeed[33]
new bool:flashspeed[33]
new bool:invisspeed[33]
new bool:motherspeed[33]
new bool:normalspeed[33]

public plugin_init()
{
    register_plugin(PLUGIN, VERSION, AUTHOR)
    register_cvar("sv_classmod", "1")
    
    
    register_logevent("logevent_Round_Start", 2, "1=Round_Start");
    register_logevent("EndRound"  ,2,"0=World triggered", "1=Round_Draw", "1=Round_End")
    
    register_event("CurWeapon", "Event_CurrentWeapon", "be") 
 

    register_event("ScreenFade","FlashedEvent","be","4=255","5=255","6=255","7>199")
    g_nMsgScreenFade = get_user_msgid("ScreenFade")
    register_menucmd(register_menuid("classmenu"), Keysclassmenu, "Pressedclassmenu")
    
}

public Showclassmenu(id) 
{
    if(!is_user_connected(id)) return PLUGIN_HANDLED
    if(!is_user_alive(id)) return PLUGIN_HANDLED 

    else
    {
     new CsTeams:team = cs_get_user_team(id)
     if (team == CS_TEAM_T && get_cvar_num("sv_classmod") == 1)
     {
         show_menu(id, Keysclassmenu, "Choose your class: ^n1: Phantom Zombie ^n2: The Flash ^n3: Juggernaut ^n4: Invisible Zombie ^n5: Mother Brood ^n0: Regular Zombie^n", -1, "classmenu") 
     }
    }
    return PLUGIN_CONTINUE
}

public Pressedclassmenu(id, key) {
    /* Choose your class:
    * Choose your class: 
    * 1: Phantom Zombie
    * 2: The Flash
    * 3: Juggernaut
    * 4: Invisible Zombie
    * 5: Mother Brood
    * 0: Regular Zombie
    */
    
    switch (key) {
        case 0: { // 1
            set_task(1.0,"classphantomzombie",id)
        }
        case 1: { // 2
            set_task(1.0,"classflash",id)
        }
        case 2: { // 3
            set_task(1.0,"classjuggernaut",id)
        }
        case 3: { // 4
            set_task(1.0,"classinviszombie",id)
        }
        case 4: { // 5
            set_task(1.0,"classmotherbrood",id)
        }
        case 9: { // 0
            client_print(id, print_chat, "[STREAMY] You are a Normal Zombie!!!")
            client_print(id, print_chat, "[STREAMY] You have no special abilities. Good luck!!!")
        }
    }
    return PLUGIN_CONTINUE
}

public FlashedEvent(id) 
{
    if(!noflash[id])
    {
        return PLUGIN_CONTINUE
    }
    message_begin( MSG_ONE,g_nMsgScreenFade,{0,0,0},id )
    write_short( read_data( 1 ) )    // Duration
    write_short( read_data( 2 ) )    // Hold time
    write_short( read_data( 3 ) )    // Fade type
    write_byte (0)            // Red
    write_byte (0)            // Green
    write_byte (0)            // Blue
    write_byte (0)            // Alpha
    message_end()
    return PLUGIN_HANDLED
}

public reset_speed(id)
{
    if(!is_user_connected(id)) return PLUGIN_HANDLED

    else 
    {
      new CsTeams:team = cs_get_user_team(id)
      if(team == CS_TEAM_T)
      {
      normalspeed[id] = true
      flashspeed[id] = false
      phantomspeed[id] = false
      invisspeed[id] = false
      motherspeed[id] = false
      }
      if(team == CS_TEAM_CT)
      {
      set_user_maxspeed (id, 250.0);
      }
    }
    return PLUGIN_CONTINUE
}

public Event_CurrentWeapon(id)
{
    if(!is_user_connected(id)) return PLUGIN_HANDLED
    if(!is_user_alive(id)) return PLUGIN_HANDLED

    new CsTeams:team = cs_get_user_team(id)
    if(team == CS_TEAM_T)
    {
        if(normalspeed[id])
        {
            set_user_maxspeed (id, 350.0);
        }
        if(flashspeed[id])
        {
            new Float:speed = get_user_maxspeed(id) + 650.0;
            set_user_maxspeed(id , speed); 
        }
        if(phantomspeed[id])
        {
            new Float:speed = get_user_maxspeed(id) + 650.0;
            set_user_maxspeed(id , speed); 
        }
        if(invisspeed[id])
        {
            new Float:speed = get_user_maxspeed(id) + 150.0;
            set_user_maxspeed(id , speed); 
        }
        if(motherspeed[id])
        {
            new Float:speed = get_user_maxspeed(id) + 300.0;
            set_user_maxspeed(id , speed); 
        }
    }

    return PLUGIN_CONTINUE

}

public logevent_Round_Start()
{
    new players[32], pnum, id
    get_players(players, pnum, "a")

    for (new i = 0; i < pnum; i++) {
        id = players[i]

        if(!is_user_connected(id)) return PLUGIN_HANDLED
        if(!is_user_alive(id))
                {

                 new CsTeams:team = cs_get_user_team(id)
         if(get_cvar_num("sv_classmod") == 1 && team == CS_TEAM_T)
                 {
                 set_task(0.5, "reset_speed", id)
                 set_user_rendering(id,kRenderFxNone,0,0,0,kRenderNormal,0);
                 set_user_noclip(id, 0);
                 }
                 if(team == CS_TEAM_CT)
                 {
                 set_user_maxspeed (id, 250.0);
                 set_user_rendering(id,kRenderFxNone,0,0,0,kRenderNormal,0);
                 set_user_noclip(id, 0);
                 }
                }

        new CsTeams:team = cs_get_user_team(id)
        if (!(get_user_flags(id)&ADMIN_IMMUNITY)) {
            if(get_cvar_num("sv_classmod") == 1 && team == CS_TEAM_T) {
                client_print(id, print_chat, "------------------------------")
                client_print(id, print_chat, "[STREAMY] Choose your class!!!")
                client_print(id, print_chat, "------------------------------")
                set_task(0.5, "reset_speed", id)
                set_task(1.0, "Showclassmenu", id)
                                set_user_noclip(id, 0);
                    set_user_rendering(id,kRenderFxNone,0,0,0,kRenderNormal,0);
            }
            if(team == CS_TEAM_CT) {
                set_user_maxspeed (id, 250.0);
                                set_user_noclip(id, 0);
                                set_user_rendering(id,kRenderFxNone,0,0,0,kRenderNormal,0);
            }
        }

        else {    
                new CsTeams:team = cs_get_user_team(id)
            if(get_cvar_num("sv_classmod") == 1 && team == CS_TEAM_T) {
                client_print(id, print_chat, "---------------------------------")
                client_print(id, print_chat, "[STREAMY] Admin powers enabled!!!")
                client_print(id, print_chat, "---------------------------------")
                set_task(0.5, "reset_speed", id)
                set_task(1.0, "Showclassmenu", id)
                set_user_noclip(id, 0);
                    set_user_rendering(id,kRenderFxNone,0,0,0,kRenderNormal,0);
            }
            if(team == CS_TEAM_CT) {
                set_user_maxspeed (id, 250.0);
                                set_user_noclip(id, 0);
                                set_user_rendering(id,kRenderFxNone,0,0,0,kRenderNormal,0);
            }
            }
            }

    return PLUGIN_HANDLED
}

public EndRound()
{
    new players[32], pnum, id
    get_players(players, pnum, "a")

    for (new i = 0; i < pnum; i++) 
        {
        id = players[i]

                if(!is_user_connected(id)) return PLUGIN_HANDLED
        if(!is_user_alive(id))
                {
                 new CsTeams:team = cs_get_user_team(id)
         if(get_cvar_num("sv_classmod") == 1 && team == CS_TEAM_T)
                 {
                 set_task(0.5, "reset_speed", id)
                 set_user_rendering(id,kRenderFxNone,0,0,0,kRenderNormal,0);
                 set_user_noclip(id, 0);
                 }
                 if(team == CS_TEAM_CT)
                 {
                 set_user_maxspeed (id, 250.0);
                 set_user_rendering(id,kRenderFxNone,0,0,0,kRenderNormal,0);
                 set_user_noclip(id, 0);
                 }

                 return PLUGIN_HANDLED

                }

                if(is_user_connected(id) && is_user_alive(id))
                {
         new CsTeams:team = cs_get_user_team(id)
         if(get_cvar_num("sv_classmod") == 1 && team == CS_TEAM_T)
                  {
            set_task(0.5, "reset_speed", id)
            set_user_rendering(id,kRenderFxNone,0,0,0,kRenderNormal,0);
          }
                 if(team == CS_TEAM_CT)
                  {
            set_user_maxspeed (id, 250.0);
            set_user_rendering(id,kRenderFxNone,0,0,0,kRenderNormal,0);
                  }

                 return PLUGIN_HANDLED

                }

        }
        return PLUGIN_HANDLED

}

public classphantomzombie(id)
{
    if(!is_user_connected(id)) return PLUGIN_HANDLED
    if(!is_user_alive(id)) return PLUGIN_HANDLED 
    if (!(get_user_flags(id)&ADMIN_IMMUNITY))
    {
        client_print(id, print_chat, "[STREAMY] You are not an admin!!!")
    return PLUGIN_HANDLED
    }
    new CsTeams:team = cs_get_user_team(id)
    if(team == CS_TEAM_T)
    {
        set_user_health(id,10000);
        set_user_armor(id,1000);
        set_user_noclip(id, 1);
        phantomspeed[id] = true
        client_print(id, print_chat, "[STREAMY] You are the Phantom Zombie!!!")
        client_print(id, print_chat, "[STREAMY] HIGH HEALTH, HIGH ARMOR, HIGH SPEED AND NO CLIP!!! OMFG 1337 HAXOR!!!")
    }
    if(team == CS_TEAM_CT)
    {
        client_print(id, print_chat, "[STREAMY] You need to be T!!!")
    }
    return PLUGIN_HANDLED
}

public classflash(id)
{
    if(!is_user_connected(id)) return PLUGIN_HANDLED
    if(!is_user_alive(id)) return PLUGIN_HANDLED 
    new CsTeams:team = cs_get_user_team(id)
    if(team == CS_TEAM_T)
    {
    set_user_health(id,1500);
    set_user_armor(id,200);
    flashspeed[id] = true
    client_print(id, print_chat, "[STREAMY] You are The Flash!!!")
    client_print(id, print_chat, "[STREAMY] GODLIKE SPEED!!! RUN LIKE HELL!!!")
    }
    if(team == CS_TEAM_CT)
    {
        client_print(id, print_chat, "[STREAMY] You need to be T!!!")
    }
    return PLUGIN_HANDLED
}

public classjuggernaut(id)
{
    if(!is_user_connected(id)) return PLUGIN_HANDLED
    if(!is_user_alive(id)) return PLUGIN_HANDLED 
    new CsTeams:team = cs_get_user_team(id)
    if(team == CS_TEAM_T)
    {
        set_user_health(id,6000);
        set_user_armor(id,200); 
        normalspeed[id] = true
        client_print(id, print_chat, "[STREAMY] You are the Juggernaut!!!")
        client_print(id, print_chat, "[STREAMY] I'M THE JUGGERNAUT BIATCH!!!")
    }
    if(team == CS_TEAM_CT)
    {
        client_print(id, print_chat, "[STREAMY] You need to be T!!!")
    }
    return PLUGIN_HANDLED
}

public classinviszombie(id)
{
    if(!is_user_connected(id)) return PLUGIN_HANDLED
    if(!is_user_alive(id)) return PLUGIN_HANDLED 
    new CsTeams:team = cs_get_user_team(id)
    if(team == CS_TEAM_T)
    {
    set_user_health(id,2500);
    set_user_armor(id,200);
    set_user_rendering(id, kRenderFxGlowShell, 0, 0, 0, kRenderTransAlpha, 5);
    invisspeed[id] = true
    client_print(id, print_chat, "[STREAMY] You are the Invisible Zombie!!!")
    client_print(id, print_chat, "[STREAMY] OMFG no one can see you!!! BACKSTABBING TIME!!!")
    }
    if(team == CS_TEAM_CT)
    {
        client_print(id, print_chat, "[STREAMY] You need to be T!!!")
    }
    return PLUGIN_HANDLED
}

public classmotherbrood(id)
{
    if(!is_user_connected(id)) return PLUGIN_HANDLED
    if(!is_user_alive(id)) return PLUGIN_HANDLED 
    new CsTeams:team = cs_get_user_team(id)
    if(team == CS_TEAM_T)
    {
    set_user_health(id,3000);
    set_user_armor(id,1000);
    motherspeed[id] = true
    client_print(id, print_chat, "[STREAMY] You are the Mother Brood!!!")
    client_print(id, print_chat, "[STREAMY] Cross Breed Zombie. High Armor, Moderate Health & Pretty fast!!!")
    }
    if(team == CS_TEAM_CT)
    {
        client_print(id, print_chat, "[STREAMY] You need to be T!!!")
    }
    return PLUGIN_HANDLED
}


Thanks.
Attached Files
File Type: sma Get Plugin or Get Source (classmod.sma - 618 views - 11.9 KB)
__________________
Wheee...!
Schoolboy is offline
Schoolboy
Member
Join Date: Oct 2007
Location: 3rd Rock from the sun.
Old 03-02-2008 , 12:21   Re: Zombie Classes A lil help here its almost done!
Reply With Quote #2

Bump.
__________________
Wheee...!
Schoolboy is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 03-02-2008 , 13:41   Re: Zombie Classes A lil help here its almost done!
Reply With Quote #3

wow you bumped after 2 hours...
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
Schoolboy
Member
Join Date: Oct 2007
Location: 3rd Rock from the sun.
Old 03-03-2008 , 04:47   Re: Zombie Classes A lil help here its almost done!
Reply With Quote #4

Sorry its happens when I get too excited ><.

Anyway can help me?
__________________
Wheee...!
Schoolboy is offline
Rolnaaba
Veteran Member
Join Date: May 2006
Old 03-03-2008 , 09:09   Re: Zombie Classes A lil help here its almost done!
Reply With Quote #5

you dont set the speed when they choose the flash zombie, only on curweapon event, be sure to do both.
Instead of this:

Code:
set_user_maxspeed (id, 350.0);
do
Code:
reset_user_maxspeed(id);
I think thats what it is, or somthing similar maybe
Code:
#include <cstrike> cs_reset_user_maxspeed(id);
something like that, anyway:
This is newline char:
Code:
'^n'
so you want to space your menu out with more 'newlines' between items do this:
Code:
show_menu(id, Keysclassmenu, "Choose your class: ^n1: Phantom Zombie ^n2: The Flash ^n3: Juggernaut ^n4: Invisible Zombie ^n5: Mother Brood ^n^n^n^n0: Regular Zombie^n", -1, "classmenu")
__________________
DO NOT PM me about avp mod.
Rolnaaba is offline
Schoolboy
Member
Join Date: Oct 2007
Location: 3rd Rock from the sun.
Old 03-03-2008 , 10:05   Re: Zombie Classes A lil help here its almost done!
Reply With Quote #6

What does cs_reset_user_maxspeed do?

In my server Zombie has 350 SPD while humans have the normal CS 250 SPD.

And strange thing is that speed for phantom works perfect. But flash does not. Everything works except that Flash's speed. I can't see why. o.o
__________________
Wheee...!
Schoolboy is offline
Rolnaaba
Veteran Member
Join Date: May 2006
Old 03-03-2008 , 15:21   Re: Zombie Classes A lil help here its almost done!
Reply With Quote #7

you need to reset the bool you have made for the speed to false whenever you set one of them to true, I would suggest a single int var, with a diff int for each speed. Instead of many diff vars for one thing. infact, you could have a speed addition var and do something like this:
Code:
/*new bool:phantomspeed[33] new bool:flashspeed[33] new bool:invisspeed[33] new bool:motherspeed[33] new bool:normalspeed[33] */ new speedAdd[33];   //...... /*         if(normalspeed[id])         {             set_user_maxspeed (id, 350.0);         }         if(flashspeed[id])         {             new Float:speed = get_user_maxspeed(id) + 650.0;             set_user_maxspeed(id , speed);         }         if(phantomspeed[id])         {             new Float:speed = get_user_maxspeed(id) + 650.0;             set_user_maxspeed(id , speed);         }         if(invisspeed[id])         {             new Float:speed = get_user_maxspeed(id) + 150.0;             set_user_maxspeed(id , speed);         }         if(motherspeed[id])         {             new Float:speed = get_user_maxspeed(id) + 300.0;             set_user_maxspeed(id , speed);         } */ set_user_maxspeed (id, 350.0 + speedAdd[id]);
then instead of setting true on each class choosing, just set that varr to whatever number you want. see what I mean?
__________________
DO NOT PM me about avp mod.
Rolnaaba is offline
Schoolboy
Member
Join Date: Oct 2007
Location: 3rd Rock from the sun.
Old 03-04-2008 , 04:37   Re: Zombie Classes A lil help here its almost done!
Reply With Quote #8

Crap still doesnt work. The thing is that other commands like HP setting etc. all work. Seems like the only problem here is the speed.

I've canceled all the bools and used set_user_maxspeed command directly and removed the bools from reset_speed function. I now use ONLy set_user_maxspeed.

Now it seems like flash speed works BUT all the others don't -.-'.

Mind helping me out? Please help me check my is_user_connected and is_user_alive commands. I have a feeling something is wrong with those 2.

Also, I still don't know how to make the menu disappear after X seconds ._.

Lastly, how do you make the title of the menu yellow?


P.s. Added the NEW .sma in this post. Please download the newer one with the changes. And ty for the ^n thingy.
Attached Files
File Type: sma Get Plugin or Get Source (classmod.sma - 601 views - 10.5 KB)
__________________
Wheee...!

Last edited by Schoolboy; 03-04-2008 at 05:14. Reason: Didn't work =/
Schoolboy is offline
MattOG
Senior Member
Join Date: May 2005
Old 03-04-2008 , 08:19   Re: Zombie Classes A lil help here its almost done!
Reply With Quote #9

can you not just use set_task with menu_destroy()??
__________________

+Karma If I helped
MattOG is offline
Schoolboy
Member
Join Date: Oct 2007
Location: 3rd Rock from the sun.
Old 03-05-2008 , 06:32   Re: Zombie Classes A lil help here its almost done!
Reply With Quote #10

Can ye add it in and post the "finished" code for testing?

thx
__________________
Wheee...!
Schoolboy 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 05:56.


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