Raised This Month: $51 Target: $400
 12% 

[ZPA][AYUDA] Cambiar funcion de este modo


  
 
 
Thread Tools Display Modes
Author Message
Dawichi
Senior Member
Join Date: May 2013
Location: republica dominicana
Old 07-25-2013 , 11:19   [ZPA][AYUDA] Cambiar funcion de este modo
#1

Hola a todos este hoy les pido que me ayuden a cambiar la funcion de este modo se llama cannibal yo quiero que en vez de que mate a los humanos osea el es como un zombie que sea un humano aver aqui el code es de zombie plague advanced

PHP Code:
/*================================================================================

    -------------------------------------------
    -*- [ZPA] Game Mode: Cannibal || Update v.2.0 -*-
    -------------------------------------------
    Plugin by Re.Act!ve
    ~~~~~~~~~~~~~~~
    - Description -
    ~~~~~~~~~~~~~~~    
    [RU]
    Новый мод для ZPA 1.6 - Cannibal.

    ~~~~~~~~~~~~~~~
    - Changelog -
    ~~~~~~~~~~~~~~~
    v. 1.0 - Plugin created. Testing.

================================================================================*/

#include < amxmodx >
#include < cstrike >
#include < hamsandwich >
#include < fakemeta_util >
#include < zombie_plague_advance >

#define TASK_TEAM 1299
#define ID_TEAM (taskid - TASK_TEAM)
new const CS_TEAM_NAMES[][] = { "UNASSIGNED""TERRORIST""CT""SPECTATOR" }
enum
{
    
FM_CS_TEAM_UNASSIGNED 0,
    
FM_CS_TEAM_T,
    
FM_CS_TEAM_CT,
    
FM_CS_TEAM_SPECTATOR
}
const 
OFFSET_LINUX // offsets 5 higher in Linux builds
const OFFSET_CSTEAMS 114

// Precache
new const g_cannibal[64] =     "Cannibal"    // Model Name
const Floatg_can_speed 200.0    // Speed
const Floatg_can_gravity 1.0    // Gravity
new const p_GunMDL[64] = "models/p_m134.mdl"
new const g_chance 40
new const g_access_flag[] = "a"
new const g_play_sounds[][] = {    "zombie_plague/nemesis1.wav" ,    "zombie_plague/survivor1.wav" }
new const 
g_sound_ambience[][] = { "zombie_plague/ambience.wav" }

// Duration in seconds of each sound
new const Float:g_sound_ambience_duration[] = { 58.0 56.0 }
const 
PEV_ADDITIONAL_AMMO pev_iuser1;
new 
g_gameidg_maxplayerscvar_minplayerscvar_dmgbool:g_CanModecannibal_model[128], bool:i_cannibal[33], cvar_ammocvar_gun_typecvar_hnumcvar_healthcvar_clip
new g_msg_syncg_msgTeamInfoFloat:g_teams_targettime;
//new g_ent_playermodel[33] // player model entity
const PRIMARY_WEAPONS_BIT_SUM = (1<<CSW_SCOUT)|(1<<CSW_XM1014)|(1<<CSW_MAC10)|(1<<CSW_AUG)|(1<<CSW_UMP45)|(1<<CSW_SG550)|(1<<CSW_GALIL)|(1<<CSW_FAMAS)|(1<<CSW_AWP)|(1<<CSW_MP5NAVY)|(1<<CSW_M249)|(1<<CSW_M3)|(1<<CSW_M4A1)|(1<<CSW_TMP)|(1<<CSW_G3SG1)|(1<<CSW_SG552)|(1<<CSW_AK47)|(1<<CSW_P90)
const 
SECONDARY_WEAPONS_BIT_SUM = (1<<CSW_P228)|(1<<CSW_ELITE)|(1<<CSW_FIVESEVEN)|(1<<CSW_USP)|(1<<CSW_GLOCK18)|(1<<CSW_DEAGLE)

// Ambience sounds task
#define TASK_AMB 3256

public plugin_natives()
{
    
register_native("zp_cannibal_mode""native_cannibal_mode"1)
    
register_native("zp_get_user_cannibal""native_get_user_cannibal"1)
    
//register_native("zp_make_user_cannibal", "native_make_user_cannibal", 1)
}

public 
plugin_init( )
{
    
// Plugin registeration.
    
register_plugin"[ZPA] Cannibal Mode","2.0""Re.Act!ve" )
    
    
// Register some cvars
    // Edit these according to your liking
    
cvar_minplayers =         register_cvar("zp_cannibal_minplayers""10")
    
cvar_health =             register_cvar("zp_cannibal_health""0")    // < 0 - count humans * cvar_hnum>
    
cvar_hnum =             register_cvar("zp_cannibal_hnum""90")
    
//cvar_canclip =           register_cvar("zp_cannibal_unlimclip", "0")
    
cvar_dmg =               register_cvar("zp_cannibal_damage""1.0")    
    
cvar_clip =             register_cvar("zp_cannibal_gunclip""100")
    
cvar_ammo =         register_cvar("zp_cannibal_gunammo""400")    
    
cvar_gun_type =         register_cvar("zp_cannibal_guntype""1")    // 0 - StandartGun m249, 1 - Force ZP Extra Item Gun
    
register_cvar("zp_cannibal_extra""Minigun")    // name extra
    
register_clcmd("drop""clcmd_drop")
    
register_clcmd("ability1""clcmd_drop")
    
RegisterHam(Ham_Touch"weaponbox""fw_TouchWeapon")
    
RegisterHam(Ham_Touch"armoury_entity""fw_TouchWeapon")
    
RegisterHam(Ham_Touch"weapon_shield""fw_TouchWeapon")
    
RegisterHam(Ham_TakeDamage"player""fw_TakeDamage")
    
RegisterHam(Ham_Killed"player""fw_PlayerKilled")
    
register_forward(FM_PlayerPreThink"fw_PlayerPreThink"
    
g_maxplayers get_maxplayers( )
    
g_msgTeamInfo get_user_msgid("TeamInfo")
    
g_msg_sync CreateHudSyncObj()
}

public 
plugin_precache( )
{
    
// Read the access flag
    
new access_flag read_flagsg_access_flag )
    new 
i

    formatex
(cannibal_modelcharsmax(cannibal_model), "models/player/%s/%s.mdl"g_cannibalg_cannibal)
    
engfunc(EngFunc_PrecacheModelcannibal_model)

    
precache_model(p_GunMDL)

    for (
0sizeof g_play_soundsi++)
        
precache_soundg_play_sounds[i] )
    
    
// Precache the ambience sounds
    
new sound[100]
    for (
0sizeof g_sound_ambiencei++)
    {
        if (
equal(g_sound_ambience[i][strlen(g_sound_ambience[i])-4], ".mp3"))
        {
            
formatex(soundsizeof sound 1"sound/%s"g_sound_ambience[i])
            
precache_genericsound )
        }
        else
        {
            
precache_soundg_sound_ambience[i] )
        }
    }
    
    
// Register our game mode
    
g_gameid zp_register_game_mode"Cannibal Mode"access_flagg_chance0ZP_DM_BALANCE )
}

public 
fw_TakeDamage(victiminflictorattackerFloat:damage)
{
    if (
victim != attacker && is_user_connected(attacker))
    {
        if(
i_cannibal[attacker])
            
SetHamParamFloat(4damage get_pcvar_float(cvar_dmg))
    }
}

public 
fw_PlayerPreThink(id)
{
    if(!
is_user_alive(id) || !i_cannibal[id]) return;
    
set_pev(idpev_maxspeedg_can_speed);
}

public 
fw_PlayerKilled(victimattackershouldgib)
{
    if(
i_cannibal[victim]) i_cannibal[victim] = false;
}

public 
zp_round_started_pregame )
{
    
// Check if it is our game mode
    
if( game == g_gameid )
    {
        
// Check for min players
        
if( fnGetAlive() < get_pcvar_num(cvar_minplayers) )
            return 
ZP_PLUGIN_HANDLED

        
// Start our new mode
        
start_cannibal( )
    }
    
// Make the compiler happy =)
    
return PLUGIN_CONTINUE
}

public 
zp_round_startedgameid )
{
    
// Check if it is our game mode
    
if( game == g_gameid )
    {
        
// Play the starting sound
        
client_cmd(0"spk ^"%s^""g_play_soundsrandom_num(0sizeof g_play_sounds -1) ] )
        
        
// Remove ambience task affects
        
remove_taskTASK_AMB )
        
        
// Set task to start ambience sounds
        #if defined AMBIENCE_SOUNDS
        
set_task2.0"start_ambience_sounds"TASK_AMB )
        
#endif
    
}
}

public 
zp_game_mode_selectedgameidid )
{
    
// Check if our game mode was called
    
if( gameid == g_gameid )
        
start_cannibal( )
    
    
// Make the compiler happy again =)
    
return PLUGIN_CONTINUE
}

// This function contains the whole code behind this game mode
start_cannibal( )
{
    new 
idiPlayersnum;
    
iPlayersnum fnGetAlive();
    
g_CanMode true;
    
id fnGetRandomAlive(random_num(1iPlayersnum));

    if(
is_user_connected(id)) {
        new 
name[32];
        
get_user_name(idnamesizeof name 1);
        
zp_infect_user(id010);
        
//zp_make_user_nemesis(id);
        
i_cannibal[id] = true;
        
set_hudmessage(22115621, -1.00.1710.05.01.01.0, -1)
        
ShowSyncHudMsg(0g_msg_sync"Осторожно, %s Каннибал!!!"name)
        
do_screen_fade(id1.51.5000255);
        
fm_set_user_rendering(idkRenderFxGlowShell,155,50,0,kRenderNormal,25
        
zp_set_user_model(idg_cannibal);

        
drop_weapons(id1);
        
drop_weapons(id2);
        if(
get_pcvar_num(cvar_gun_type) != 0
        {
            
fm_strip_user_weapons(id);
            new 
iWep2 fm_give_item(id"weapon_m249");
            if( 
iWep2 )
            {
                
cs_set_weapon_ammo(iWep2get_pcvar_num(cvar_clip))
                
cs_set_user_bpammo (idCSW_M249get_pcvar_num(cvar_ammo))    
                
//set_pdata_float(id, m_flNextAttack, 1.0, PLAYER_LINUX_XTRA_OFF)
            
}
            
ReplaceModels(id);
        }
        else     {
            new 
extra_item[32]
            
get_cvar_string("zp_cannibal_extra"extra_item31)
            
zp_force_buy_extra_item(idzp_get_extra_item_id(extra_item))
        }

        if(
get_pcvar_num(cvar_health) == 0)
            
fm_set_user_health(id, (iPlayersnum 1) * get_pcvar_num(cvar_hnum))
        else
            
fm_set_user_health(idget_pcvar_num(cvar_health))

        
fm_set_user_gravity(idfm_get_user_gravity(id) * g_can_gravity);
        
client_cmd(id"spk items/gunpickup2")
    }
    
// Remaining players should be humans (CTs)
    
for (id 1id <= g_maxplayersid++)
    {
        
// Not alive
        
if (!is_user_alive(id))
            continue;
        
        
// First nemesis
        
if (i_cannibal[id])
            continue;
        
        
// Switch to CT
        
if (fm_cs_get_user_team(id) != FM_CS_TEAM_CT// need to change team?
        
{
            
fm_cs_set_user_team(idFM_CS_TEAM_CT)
            
fm_user_team_update(id)
        }
    }
}

ReplaceModels(id) {
    
//set_pev(id, pev_viewmodel2, v_GunMDL)
    
set_pev(idpev_weaponmodel2p_GunMDL)
}

public 
clcmd_drop(id)
{
    if (
i_cannibal[id])
        return 
PLUGIN_HANDLED
    
    
return PLUGIN_CONTINUE;
}

// Ham Weapon Touch Forward
public fw_TouchWeapon(weaponid)
{
    
// Not a player
    
if (!is_user_connected(id))
        return 
HAM_IGNORED;
    
    
// Dont pickup weapons if zombie, survivor or sniper (+PODBot MM fix)
    
if (i_cannibal[id])
        return 
HAM_SUPERCEDE;
    
    return 
HAM_IGNORED;
}

public 
start_ambience_sounds( )
{
    
// Variables
    
static amb_sound[64], soundFloat:duration
    
    
// Select our ambience sound
    
sound random_num0sizeof g_sound_ambience )
    
copyamb_soundsizeof amb_sound g_sound_ambiencesound ] )
    
duration g_sound_ambience_durationsound ]
    
    
// Check whether it's a wav or mp3, then play it on clients
    
if ( equalamb_soundstrlenamb_sound ) - ], ".mp3" ) )
        
client_cmd0"mp3 play ^"sound/%s^""amb_sound )
    else
        
client_cmd0"spk ^"%s^""sound )
    
    
// Start the ambience sounds
    
set_taskduration"start_ambience_sounds"TASK_AMB )
}

public 
client_disconnect(id) {
if(
i_cannibal[id]) i_cannibal[id] = false;
}

public 
zp_round_endedwinteam )
{
    new 
id;
    for (
id 1id <= g_maxplayersid++)
    {
        if (
is_user_connected(id) && i_cannibal[id])
        {
            
fm_set_user_rendering(id0000kRenderNormal25 
            
i_cannibal[id] = false;
        }
    }    
    
g_CanMode false;
    
// Stop ambience sounds on round end
    
remove_taskTASK_AMB )
}

// Code ZPA (by MeRcyLeZZ)
fnGetRandomAlive(n)
{
    static 
iAliveid
    iAlive 
0
    
    
for (id 1id <= g_maxplayersid++)
    {
        if (
is_user_alive(id))
            
iAlive++
        
        if (
iAlive == n)
            return 
id;
    }
    
    return -
1;
}

// Code ZPA (by MeRcyLeZZ)
fnGetAlive()
{
    static 
iAliveid
    iAlive 
0
    
    
for (id 1id <= g_maxplayersid++)
    {
        if (
is_user_alive(id))
            
iAlive++
    }
    
    return 
iAlive;
}

// Drop primary/secondary weapons
stock drop_weapons(iddropwhat)
{
    
// Get user weapons
    
static weapons[32], numiweaponid
    num 
// reset passed weapons count (bugfix)
    
get_user_weapons(idweaponsnum)
    
    
// Loop through them and drop primaries or secondaries
    
for (0numi++)
    {
        
// Prevent re-indexing the array
        
weaponid weapons[i]
        
        if ((
dropwhat == && ((1<<weaponid) & PRIMARY_WEAPONS_BIT_SUM)) || (dropwhat == && ((1<<weaponid) & SECONDARY_WEAPONS_BIT_SUM)))
        {
            
// Get weapon entity
            
static wname[32], weapon_ent
            get_weaponname
(weaponidwnamecharsmax(wname))
            
weapon_ent fm_find_ent_by_owner(-1wnameid)
            
            
// Hack: store weapon bpammo on PEV_ADDITIONAL_AMMO
            
set_pev(weapon_entPEV_ADDITIONAL_AMMOcs_get_user_bpammo(idweaponid))
            
            
// Player drops the weapon and looses his bpammo
            
engclient_cmd(id"drop"wname)
            
cs_set_user_bpammo(idweaponid0)
        }
    }
}

/*stock fm_cs_set_user_model_index(id, value)
{
    set_pdata_int(id, OFFSET_MODELINDEX, value, OFFSET_LINUX)
}

stock fm_set_playermodel_ent(id)
{
    // Make original player entity invisible without hiding shadows or firing effects
    fm_set_rendering(id, kRenderFxNone, 255, 255, 255, kRenderTransTexture, 1)
    
    // Format model string
    static model[100]
    formatex(model, charsmax(model), "models/player/%s/%s.mdl", g_cannibal, g_cannibal)
    
    // Set model on entity or make a new one if unexistant
    if (!pev_valid(g_ent_playermodel[id]))
    {
        g_ent_playermodel[id] = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "info_target"))
        if (!pev_valid(g_ent_playermodel[id])) return;
        
        set_pev(g_ent_playermodel[id], pev_classname, MODEL_ENT_CLASSNAME)
        set_pev(g_ent_playermodel[id], pev_movetype, MOVETYPE_FOLLOW)
        set_pev(g_ent_playermodel[id], pev_aiment, id)
        set_pev(g_ent_playermodel[id], pev_owner, id)
    }
    
    engfunc(EngFunc_SetModel, g_ent_playermodel[id], model)
}*/

stock do_screen_fade(       idFloat:fadeTimeFloat:holdTimeredgreenbluealphatype 0x0000       )
{
   static 
msgScreenFade;
   if (      !
msgScreenFade    ) { msgScreenFade get_user_msgid(    "ScreenFade"           ); }
   new 
fadehold;
   
fade clamp(    floatround(     fadeTime float(1<<12)), 00xFFFF    );
   
hold clamp(     floatround(         holdTime float(1<<12)), 00xFFFF      );
   
message_begin(    MSG_ONE_UNRELIABLEmsgScreenFade_id          );
   
write_short(          fade    );
   
write_short(    hold    );
   
write_short(    type   );
   
write_byte(      red    );
   
write_byte(  green    );
   
write_byte(    blue    );
   
write_byte(     alpha    );
   
message_end(    );
}

// Set a Player's Team
stock fm_cs_set_user_team(idteam)
{
    
set_pdata_int(idOFFSET_CSTEAMSteamOFFSET_LINUX)
}

// Get User Team
stock fm_cs_get_user_team(id)
{
    return 
get_pdata_int(idOFFSET_CSTEAMSOFFSET_LINUX);
}

// Update Player's Team on all clients (adding needed delays)
stock fm_user_team_update(id)
{
    static 
Float:current_time
    current_time 
get_gametime()
    
    if (
current_time g_teams_targettime >= 0.1)
    {
        
set_task(0.1"fm_cs_set_user_team_msg"id+TASK_TEAM)
        
g_teams_targettime current_time 0.1
    
}
    else
    {
        
set_task((g_teams_targettime 0.1) - current_time"fm_cs_set_user_team_msg"id+TASK_TEAM)
        
g_teams_targettime g_teams_targettime 0.1
    
}
}

// Send User Team Message
public fm_cs_set_user_team_msg(taskid)
{
    
// Tell everyone my new team
    
emessage_begin(MSG_ALLg_msgTeamInfo)
    
ewrite_byte(ID_TEAM// player
    
ewrite_string(CS_TEAM_NAMES[fm_cs_get_user_team(ID_TEAM)]) // team
    
emessage_end()
}

public 
native_cannibal_mode() {
    new 
i;
    if(
g_CanMode1;
    else 
0;
    return 
i;
}

/*public native_make_user_cannibal() {

}*/

public native_get_user_cannibal(id)
{
    new 
bool:gPl
    
if(i_cannibal[id]) gPl=true;
    else 
gPl=false;

    return 
gPl;

Dawichi is offline
 



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 00:33.


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