AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Zombie Revolution help (https://forums.alliedmods.net/showthread.php?t=106974)

Killedbyme 10-21-2009 00:49

Zombie Revolution help
 
PHP Code:

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

#define CLASS_NOTHING 0
#define CLASS_NAVY 1
#define CLASS_MARINE 2
#define CLASS_ARMY 3
#define CLASS_AIRFORCE 4
#define CLASS_ROGUE 5
#define CLASS_BARBARIAN 6
#define CLASS_MYSTIC 7
#define CLASS_ZMEDIC 8

#define MAXCLASSES 9

new PlayerClass[33]
new 
PlayerXP[33]
new 
PlayerLevel[33]

new const 
CLASSES[MAXCLASSES][] = {
     
"None",
     
"Navy",
     
"Marine",
     
"Army",
     
"AirForce",
     
"Rogue",
     
"Barbarian",
     
"Mystic",
     
"Zombie Medic"
}

new 
msgtext

new const LEVELS[10] = {
    
50//50 XP for level 1
    
150//150 XP for level 2
    
200//200 XP for level 3
    
250//250 XP for level 4
    
300//300 XP for level 5
    
350//350 XP for level 6
    
400//400 XP for level 7
    
450//450 XP for level 8
    
500//500 XP for level 9
    
600//600 XP for level 10
}

public 
plugin_init()
{
    
register_plugin("ZR Mod""1.0""DwF Pain is inevitable")
    
    
register_cvar("sv_ZRmod""1")
    
    
register_event("DeathMsg""DeathMsg""a"
    
    
register_cvar("XP_per_kill""15")
    
    
register_menucmd(register_menuid("menu_ChooseClass"),1023,"MenuAction_ChooseClass");
    
    
register_event("ResetHUD""ResetHud""b")
    
    
msgtext get_user_msgid("StatusText"

    
register_clcmd("say /changeanimal""ChangeAnimal")
    
register_clcmd("say_team /changeanimal""ChangeAnimal")
}



stock ChooseClass(id)
{
    new 
menu[192
    new 
keys MENU_KEY_0|MENU_KEY_1|MENU_KEY_2|MENU_KEY_3 

    
    format
(menu191"ZR Mod: Choose Class^n^n1. Navy^n2. Marine^n3. Army^n4. AirForce^n^n0. Exit"
    
show_menu(idkeysmenu, -1"menu_ChooseClass")    
    return 
PLUGIN_CONTINUE
}

public 
DoChooseClass(idkey)
{

    if(
key == 0) {
       
         if(
PlayerClass[id] == CLASS_NOTHING) {
         
              
client_print(idprint_chat"[ZR Mod] You are already unenlisted! Join the ranks!")

              
ChooseClass(id)

              return 
PLUGIN_HANDLED
         
}        

         
PlayerClass[id] = CLASS_NOTHING
         
         client_print
(idprint_chat"[ZR Mod] You are no longer in the services!")
    }        

         
    if(
key == 1) {
         
         if(
PlayerClass[id] == CLASS_NAVY) {
              
              
client_print(idprint_chat"[ZR Mod] You are already enlisted in the Navy! Join something else!")
              
ChooseClass(id)
              return 
PLUGIN_HANDLED
         
}
                   
         
PlayerClass[id] = CLASS_NAVY
         client_print
(idprint_chat"[ZR Mod] You are now enlisted as a Navy Seal!")
    }
    
    if(
key == 2) {
         
         if(
PlayerClass[id] == CLASS_MARINE) {
              
              
client_print(idprint_chat"[ZR Mod] You are already enlisted in the Marine Corp! Join something else!")
              
ChooseClass(id)
              return 
PLUGIN_HANDLED
         
}
                   
         
PlayerClass[id] = CLASS_MARINE
         client_print
(idprint_chat"[ZR Mod] You are now enlisted as a Marine!")
    }    

    if(
key == 3) {
         
         if(
PlayerClass[id] == CLASS_ARMY) {
              
              
client_print(idprint_chat"[ZR Mod] You are already enlisted in the Army! Join something else!")
              
ChooseClass(id)
              return 
PLUGIN_HANDLED
         
}
                   
         
PlayerClass[id] = CLASS_ARMY
         client_print
(idprint_chat"[ZR Mod] You are now enlisted in the Army!")
    }

      
    
ShowHUD(id)
    
    return 
PLUGIN_HANDLED
}

public 
ResetHUD(id)
{
    if(
PlayerClass[id] == CLASS_NOTHING) {
    
         
ChooseClass(id)
         return 
PLUGIN_HANDLED
    
}
    
    return 
PLUGIN_HANDLED
}

public 
DeathMsg()
{
    if(
get_cvar_num("sv_ZRmod") == 0) {
         return 
PLUGIN_HANDLED
    
}
    
    new 
attacker read_data(1)
    
    if(
PlayerClass[attacker] == CLASS_NOTHING) {
         return 
PLUGIN_HANDLED
    
}
    
    if(
PlayerLevel[attacker] == 10) {
         return 
PLUGIN_HANDLED
    
}
            
    
PlayerXP[attacker] += get_cvar_num("15"
    
    if(
PlayerXP[attacker] >= LEVELS[PlayerLevel[attacker]]) {
     
         
PlayerLevel[attacker] += 1
         
         client_print
(attackerprint_chat"[ZR Mod] Congratulations! You are now level %i!"PlayerLevel[attacker])
         
         
ShowHUD(attacker)
    }   
    
    
ShowHUD(attacker)
    
    return 
PLUGIN_CONTINUE
}

public 
ShowHUD(id)    

    new 
HUD[51]
    
format(HUD50"[%s]Level: %i XP: %i"CLASSES[PlayerClass[id]], PlayerLevel[id], PlayerXP[id]) 

    
message_begin(MSG_ONEmsgtext, {0,0,0}, id
    
write_byte(0
    
write_string(HUD
    
message_end() 
    return


Heres what I am trying to achieve. I am trying to make it so CT's select from the Army, Navy, Marines, and Airforce and each class has 3 basic skills and then an ultimate. T's pick from Rogue, Barbarian, Mystic, and zombie medic with the same 3 skills and ultimate for each class. Now next to the players spawn is either armory (ct) or hive (t) and you must touch the hive to change class. Now once the map changes all xp is reset and people start anew. I hope you guys understand what im trying for. ill give you a server ip that has exactly what i want but i cant seem to get the code from so I decided to just build from scratch and make a better one. 69.162.77.228:27015 - This is not my server and i apologize if this seems like advertisement. Its the only server that has what im looking for but i want to improve it.

Hawk552 10-21-2009 08:22

Re: Zombie Revolution help
 
This is the scripting help section, not suggestions. You should only post here if you actually have some level of scripting experience and just need others to review/comment on/fix your work. No one is going to sit down and spend a few hours writing an entirely new XP mod for you based on an absolutely atrociously-done tutorial as a base.

Killedbyme 10-21-2009 11:42

Re: Zombie Revolution help
 
very well then. I will continue to fix it up as i have been doing. Quick question. And i guess this could be considered help. How do I make my classes team based?

Hawk552 10-21-2009 13:11

Re: Zombie Revolution help
 
x_get_user_team()


All times are GMT -4. The time now is 17:43.

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