Skocz do zawartości

Nowy szablon forum

mygo.pl

Stworzyliśmy dla Was nowy wygląd forum. Z pewnością znajdziesz rzeczy, które wg Ciebie mogą zostać zmienione - wspomnij o tym w specjalnym wątku.

Czytaj więcej

Jak założyć własną sieć

serwerów CS

Zastanawiasz się nad prowadzeniem własnej sieci serwerów? Przeczytaj podstawowe informacje, na które należy zwrócić uwagę, przy takim projekcie.

Czytaj więcej

Tworzymy spis sieci

dodaj swoją

Dodaj sieć do której należysz, pozwoli to na promocję i budowę ogólnopolskiej bazy sieci CS.

Czytaj więcej

RSS[ZP50] How can add levels to zombies


MYGO.pl
 Udostępnij

Rekomendowane odpowiedzi

  • RSSy
I use the level system that Neeeeel made in a tutorial, it works perfectly but I don't know how I can adapt the zombies so that they are by levels, please help.

Level System ->
PHP Code:

/*================================================================================
    
    --------------------------------
    -*- [ZP] Level system -*-
    --------------------------------
    
    This plugin is part of Zombie Plague Mod and is distributed under the
    terms of the GNU General Public License. Check ZP_ReadMe.txt for details.
    
================================================================================*/

#include < amxmodx >
#include < zp50_ammopacks >
#include < zp50_colorchat >

#define MAXPLAYERS 32

// We will use this macro to calculate the necessary ammopacks of the next level
// PS: power means power, in this case the entered levels are being squared
// PD2: This equation can be modified to suit each one, this would be the "difficulty" if you want to call it that
#define cost_levelup(%1)    (13 * %1) + ((11 * power(%1, 2)) / 2)

// We create a global variable to store the levels of each player
new g_levelMAXPLAYERS ];

public 
plugin_init( )
    
register_plugin"[ZP] Level system"ZP_VERSION_STRING"ZP Dev Team" );

public 
plugin_natives( )
{
    
// Well here we register the natives that we will later use in the other plugins
    
register_native"zp_set_level""native_set_level" );
    
register_native"zp_get_level""native_get_level" );
}

// We make the player's level 1 when connected, in this place you should load the levels (you can do it in an external plugin)
public client_putinserverid )
    
g_levelid ] = 1;

// This function is the forward that is called every time ammopacks are added or subtracted, it will be seen in more detail later
public zp_fw_ammopacks_changeid )
{
    new 
lvl g_levelid ];
    
    
// Here what I do is check if it has more ammopacks than necessary for the next level, a while is used in case it is necessary to go up/down more than 1 level at the same time.
    
while(  zp_ammopacks_getid ) >= cost_leveluplvl )  )
        
lvl++;
        
    while( 
zp_ammopacks_getid ) < cost_levelup( ( lvl ) ) )
        
lvl--;
    
    
// I do this more than anything to avoid overloading the saving of data, at the end of this forward I call the function that updates the data, and most of the times that this forward is called, the level does not change
    
if( g_levelid ] == lvl )
        return 
PLUGIN_HANDLED;
    
    
// If the level changes I show him a message...
    
if( lvl g_levelid] )
        
zp_colored_printid"^x01 You leveled up^x04 [%d]^x01 Congrazz!!!"lvl );
    else if( 
g_levelid ] > lvl )
        
zp_colored_printid"^x01 You leveled down^x04 [%d]^x01 :(!!!"lvl );
    
// give it the corresponding level
    
g_levelid ] = lvl;

    return 
PLUGIN_HANDLED;
}

// This is the native to set the levels, it is made a bit different from the conventional ones, I did it like this to respect the way the other natives were created in this version of ZP
// Instead of putting the parameters next to the function name, they are loaded in a variable with get_param, I don't know the difference with conventional natives
public native_set_levelplugin_idnum_params )
{
    new 
id get_param);
    new 
ammount get_param);
    
    
g_levelid ] = ammount;
    
    return 
ammount;
}

// And this is the native to get the levels, it's a simple return as you can see
public native_get_levelplugin_idnum_params )
    return 
g_levelget_param) ]; 

Include ->
PHP Code:

#if defined _zp50_levels_included
  #endinput
#endif
#define _zp50_levels_included

native zp_set_levelidammount );

native zp_get_levelid ); 

Zombie Class ->
PHP Code:

/*================================================================================
    
    ---------------------------------
    -*- [ZP] Class: Zombie: Light -*-
    ---------------------------------
    
    This plugin is part of Zombie Plague Mod and is distributed under the
    terms of the GNU General Public License. Check ZP_ReadMe.txt for details.
    
================================================================================*/

#include <amxmodx>
#include <zp50_class_zombie>

// Light Zombie Attributes
new const zombieclass3_name[] = "Light Zombie"
new const zombieclass3_info[] = "HP- Jump+ Knockback+" 
new const zombieclass3_models[][] = { "zombie_source" }
new const 
zombieclass3_clawmodels[][] = { "models/escapesg_plague/v_knife_zombie.mdl" }
const 
zombieclass3_health 1400
const Float:zombieclass3_speed 0.75
const Float:zombieclass3_gravity 0.75
const Float:zombieclass3_knockback 1.25

new g_ZombieClassID


public plugin_precache()
{
    
register_plugin("[ZP] Class: Zombie: Light"ZP_VERSION_STRING"ZP Dev Team")
    
    new 
index
    
    g_ZombieClassID 
zp_class_zombie_register(zombieclass3_namezombieclass3_infozombieclass3_healthzombieclass3_speedzombieclass3_gravity)
    
zp_class_zombie_register_kb(g_ZombieClassIDzombieclass3_knockback)
    for (
index 0index sizeof zombieclass3_modelsindex++)
        
zp_class_zombie_register_model(g_ZombieClassIDzombieclass3_models[index])
    for (
index 0index sizeof zombieclass3_clawmodelsindex++)
        
zp_class_zombie_register_claw(g_ZombieClassIDzombieclass3_clawmodels[index])



Attached Files
File Type: inc zp50_levels.inc (155 Bytes)
File Type: sma Get Plugin or Get Source (zp50_levels.sma - 3.5 KB)
File Type: sma Get Plugin or Get Source (zp50_class_zombie_leech.sma - 3.4 KB)

Przeczytaj cały wpis

Odnośnik do komentarza
Udostępnij na innych stronach

Gość
Ten temat został zamknięty. Brak możliwości dodania odpowiedzi.
 Udostępnij

  • Ostatnio przeglądający   0 użytkowników

    • Brak zarejestrowanych użytkowników przeglądających tę stronę.
×
×
  • Dodaj nową pozycję...