Reklam gösterimini engelleyici yazılım kullandığınızı görüyoruz.
Sitemizin ayakta kalıp sizlere hizmet edebilmek için en büyük gelir kaynağı sayfamızda gösterilen reklamlardır.
Reklam gösterimde bizim sayfamıza ayrıcalık tanıyarak ayakta kalmamıza destek olmak ister misiniz ?

Silinmiş Konu   | Nemesis mode

Konu

#1
iyi günler
arkadaşlar eklentide bir problem var örnek nemesıs modunda otomatik kendisi açıldıgında normal bir şekilde serverin kişi sayısına göre nemesis seçiyor 
sorun admin komutuyla seçilmek istediğinizde otomatik olarak rasgele başkasını seçiyor seçtiğim kişide yapmıyor ve server kişi sayısına göre seçiyor ben öyle istemiyorum : / 
istediğim admin komutuyla seçmek istediğim kişi 1er 1er seçmek istiyorum isterseniz 0 halini atayım onada bi bakabilirsiniz

nemesis mod server kişi sayısına göre

Kod:
/*================================================================================

-------------------------------
-*- [ZP] Game Mode: Nemesis -*-
-------------------------------

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 <amx_settings_api>
#include <cs_teams_api>
#include <zp50_gamemodes>
#include <zp50_class_nemesis>
#include <zp50_deathmatch>

// Settings file
new const ZP_SETTINGS_FILE[] = "zombieplague.ini"

// Default sounds
new const sound_nemesis[][] = { "zombie_plague/nemesis1.wav" , "zombie_plague/nemesis2.wav" }

#define SOUND_MAX_LENGTH 64

new Array:g_sound_nemesis

// HUD messages
#define HUD_EVENT_X -1.0
#define HUD_EVENT_Y 0.17
#define HUD_EVENT_R 255
#define HUD_EVENT_G 20
#define HUD_EVENT_B 20

new g_MaxPlayers
new g_HudSync
new g_TargetPlayer

new cvar_nemesis_chance, cvar_nemesis_min_players
new cvar_nemesis_show_hud, cvar_nemesis_sounds
new cvar_nemesis_allow_respawn

public plugin_precache()
{
// Register game mode at precache (plugin gets paused after this)
register_plugin("[ZP] Game Mode: Nemesis", ZP_VERSION_STRING, "ZP Dev Team")
zp_gamemodes_register("Nemesis Mode")

// Create the HUD Sync Objects
g_HudSync = CreateHudSyncObj()

g_MaxPlayers = get_maxplayers()

cvar_nemesis_chance = register_cvar("zp_nemesis_chance", "20")
cvar_nemesis_min_players = register_cvar("zp_nemesis_min_players", "0")
cvar_nemesis_show_hud = register_cvar("zp_nemesis_show_hud", "1")
cvar_nemesis_sounds = register_cvar("zp_nemesis_sounds", "1")
cvar_nemesis_allow_respawn = register_cvar("zp_nemesis_allow_respawn", "0")

// Initialize arrays
g_sound_nemesis = ArrayCreate(SOUND_MAX_LENGTH, 1)

// Load from external file
amx_load_setting_string_arr(ZP_SETTINGS_FILE, "Sounds", "ROUND NEMESIS", g_sound_nemesis)

// If we couldn't load custom sounds from file, use and save default ones
new index
if (ArraySize(g_sound_nemesis) == 0)
{
for (index = 0; index < sizeof sound_nemesis; index++)
ArrayPushString(g_sound_nemesis, sound_nemesis[index])

// Save to external file
amx_save_setting_string_arr(ZP_SETTINGS_FILE, "Sounds", "ROUND NEMESIS", g_sound_nemesis)
}

// Precache sounds
new sound[SOUND_MAX_LENGTH]
for (index = 0; index < ArraySize(g_sound_nemesis); index++)
{
ArrayGetString(g_sound_nemesis, index, sound, charsmax(sound))
if (equal(sound[strlen(sound)-4], ".mp3"))
{
format(sound, charsmax(sound), "sound/%s", sound)
precache_generic(sound)
}
else
precache_sound(sound)
}
}

// Deathmatch module's player respawn forward
public zp_fw_deathmatch_respawn_pre(id)
{
// Respawning allowed?
if (!get_pcvar_num(cvar_nemesis_allow_respawn))
return PLUGIN_HANDLED;

return PLUGIN_CONTINUE;
}

public zp_fw_core_spawn_post(id)
{
// Always respawn as human on nemesis rounds
zp_core_respawn_as_zombie(id, false)
}

public zp_fw_gamemodes_choose_pre(game_mode_id, skipchecks)
{
if (!skipchecks)
{
// Random chance
if (random_num(1, get_pcvar_num(cvar_nemesis_chance)) != 1)
return PLUGIN_HANDLED;

// Min players
if (GetAliveCount() < get_pcvar_num(cvar_nemesis_min_players))
return PLUGIN_HANDLED;
}

// Game mode allowed
return PLUGIN_CONTINUE;
}

public zp_fw_gamemodes_choose_post(game_mode_id, target_player)
{
// Pick player randomly?
g_TargetPlayer = (target_player == RANDOM_TARGET_PLAYER) ? GetRandomAlive(random_num(1, GetAliveCount())) : target_player
}

public zp_fw_gamemodes_start()
{
new bmForSayi;
switch(GetAliveCount()){
case 1..10 : {
bmForSayi = 1;
}
case 11..15 : {
bmForSayi = 2;
}
case 16..20 : {
bmForSayi = 3;
}
case 21..25 : {
bmForSayi = 4;
}
case 26..32 : {
bmForSayi = 5;
}
}
for(new i; i < bmForSayi; i++){
g_TargetPlayer = GetRandomAlive(random_num(1, GetAliveCount()));
zp_class_nemesis_set(g_TargetPlayer);
if (get_pcvar_num(cvar_nemesis_show_hud)){
new name[32]
get_user_name(g_TargetPlayer, name, charsmax(name))
set_hudmessage(HUD_EVENT_R, HUD_EVENT_G, HUD_EVENT_B, HUD_EVENT_X, HUD_EVENT_Y, 1, 0.0, 5.0, 1.0, 1.0, -1)
ShowSyncHudMsg(0, g_HudSync, "%L", LANG_PLAYER, "NOTICE_NEMESIS", name)
}
}
new id
for (id = 1; id <= g_MaxPlayers; id++)
{
// Not alive
if (!is_user_alive(id))
continue;

// This is our Nemesis
if (zp_class_nemesis_get(id))
continue;

// Switch to CT
cs_set_player_team(id, CS_TEAM_CT);
}

// Play Nemesis sound
if (get_pcvar_num(cvar_nemesis_sounds))
{
new sound[SOUND_MAX_LENGTH]
ArrayGetString(g_sound_nemesis, random_num(0, ArraySize(g_sound_nemesis) - 1), sound, charsmax(sound))
PlaySoundToClients(sound)
}
}

PlaySoundToClients(const sound[]){
if (equal(sound[strlen(sound)-4], ".mp3"))
client_cmd(0, "mp3 play ^"sound/%s^"", sound)
else
client_cmd(0, "spk ^"%s^"", sound)
}

GetAliveCount(){
new iAlive, id

for (id = 1; id <= g_MaxPlayers; id++)
{
if (is_user_alive(id))
iAlive++
}

return iAlive;
}

GetRandomAlive(target_index){
new iAlive, id

for (id = 1; id <= g_MaxPlayers; id++)
{
if (is_user_alive(id))
iAlive++

if (iAlive == target_index)
return id;
}

return -1;
}

nemesis mod 0 orjinal hali

Kod:
/*================================================================================
    
    -------------------------------
    -*- [ZP] Game Mode: Nemesis -*-
    -------------------------------
    
    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 <amx_settings_api>
#include <cs_teams_api>
#include <zp50_gamemodes>
#include <zp50_class_nemesis>
#include <zp50_deathmatch>

// Settings file
new const ZP_SETTINGS_FILE[] = "zombieplague.ini"

// Default sounds
new const sound_nemesis[][] = { "zombie_plague/nemesis1.wav" , "zombie_plague/nemesis2.wav" }

#define SOUND_MAX_LENGTH 64

new Array:g_sound_nemesis

// HUD messages
#define HUD_EVENT_X -1.0
#define HUD_EVENT_Y 0.17
#define HUD_EVENT_R 255
#define HUD_EVENT_G 20
#define HUD_EVENT_B 20

new g_MaxPlayers
new g_HudSync
new g_TargetPlayer

new cvar_nemesis_chance, cvar_nemesis_min_players
new cvar_nemesis_show_hud, cvar_nemesis_sounds
new cvar_nemesis_allow_respawn

public plugin_precache()
{
    // Register game mode at precache (plugin gets paused after this)
    register_plugin("[ZP] Game Mode: Nemesis", ZP_VERSION_STRING, "ZP Dev Team")
    zp_gamemodes_register("Nemesis Mode")
    
    // Create the HUD Sync Objects
    g_HudSync = CreateHudSyncObj()
    
    g_MaxPlayers = get_maxplayers()
    
    cvar_nemesis_chance = register_cvar("zp_nemesis_chance", "20")
    cvar_nemesis_min_players = register_cvar("zp_nemesis_min_players", "0")
    cvar_nemesis_show_hud = register_cvar("zp_nemesis_show_hud", "1")
    cvar_nemesis_sounds = register_cvar("zp_nemesis_sounds", "1")
    cvar_nemesis_allow_respawn = register_cvar("zp_nemesis_allow_respawn", "0")
    
    // Initialize arrays
    g_sound_nemesis = ArrayCreate(SOUND_MAX_LENGTH, 1)
    
    // Load from external file
    amx_load_setting_string_arr(ZP_SETTINGS_FILE, "Sounds", "ROUND NEMESIS", g_sound_nemesis)
    
    // If we couldn't load custom sounds from file, use and save default ones
    new index
    if (ArraySize(g_sound_nemesis) == 0)
    {
        for (index = 0; index < sizeof sound_nemesis; index++)
            ArrayPushString(g_sound_nemesis, sound_nemesis[index])
        
        // Save to external file
        amx_save_setting_string_arr(ZP_SETTINGS_FILE, "Sounds", "ROUND NEMESIS", g_sound_nemesis)
    }
    
    // Precache sounds
    new sound[SOUND_MAX_LENGTH]
    for (index = 0; index < ArraySize(g_sound_nemesis); index++)
    {
        ArrayGetString(g_sound_nemesis, index, sound, charsmax(sound))
        if (equal(sound[strlen(sound)-4], ".mp3"))
        {
            format(sound, charsmax(sound), "sound/%s", sound)
            precache_generic(sound)
        }
        else
            precache_sound(sound)
    }
}

// Deathmatch module's player respawn forward
public zp_fw_deathmatch_respawn_pre(id)
{
    // Respawning allowed?
    if (!get_pcvar_num(cvar_nemesis_allow_respawn))
        return PLUGIN_HANDLED;
    
    return PLUGIN_CONTINUE;
}

public zp_fw_core_spawn_post(id)
{
    // Always respawn as human on nemesis rounds
    zp_core_respawn_as_zombie(id, false)
}

public zp_fw_gamemodes_choose_pre(game_mode_id, skipchecks)
{
    if (!skipchecks)
    {
        // Random chance
        if (random_num(1, get_pcvar_num(cvar_nemesis_chance)) != 1)
            return PLUGIN_HANDLED;
        
        // Min players
        if (GetAliveCount() < get_pcvar_num(cvar_nemesis_min_players))
            return PLUGIN_HANDLED;
    }
    
    // Game mode allowed
    return PLUGIN_CONTINUE;
}

public zp_fw_gamemodes_choose_post(game_mode_id, target_player)
{
    // Pick player randomly?
    g_TargetPlayer = (target_player == RANDOM_TARGET_PLAYER) ? GetRandomAlive(random_num(1, GetAliveCount())) : target_player
}

public zp_fw_gamemodes_start()
{
    // Turn player into nemesis
    zp_class_nemesis_set(g_TargetPlayer)
    
    // Remaining players should be humans (CTs)
    new id
    for (id = 1; id <= g_MaxPlayers; id++)
    {
        // Not alive
        if (!is_user_alive(id))
            continue;
        
        // This is our Nemesis
        if (zp_class_nemesis_get(id))
            continue;
        
        // Switch to CT
        cs_set_player_team(id, CS_TEAM_CT)
    }
    
    // Play Nemesis sound
    if (get_pcvar_num(cvar_nemesis_sounds))
    {
        new sound[SOUND_MAX_LENGTH]
        ArrayGetString(g_sound_nemesis, random_num(0, ArraySize(g_sound_nemesis) - 1), sound, charsmax(sound))
        PlaySoundToClients(sound)
    }
    
    if (get_pcvar_num(cvar_nemesis_show_hud))
    {
        // Show Nemesis HUD notice
        new name[32]
        get_user_name(g_TargetPlayer, name, charsmax(name))
        set_hudmessage(HUD_EVENT_R, HUD_EVENT_G, HUD_EVENT_B, HUD_EVENT_X, HUD_EVENT_Y, 1, 0.0, 5.0, 1.0, 1.0, -1)
        ShowSyncHudMsg(0, g_HudSync, "%L", LANG_PLAYER, "NOTICE_NEMESIS", name)
    }
}

// Plays a sound on clients
PlaySoundToClients(const sound[])
{
    if (equal(sound[strlen(sound)-4], ".mp3"))
        client_cmd(0, "mp3 play ^"sound/%s^"", sound)
    else
        client_cmd(0, "spk ^"%s^"", sound)
}

// Get Alive Count -returns alive players number-
GetAliveCount()
{
    new iAlive, id
    
    for (id = 1; id <= g_MaxPlayers; id++)
    {
        if (is_user_alive(id))
            iAlive++
    }
    
    return iAlive;
}

// Get Random Alive -returns index of alive player number target_index -
GetRandomAlive(target_index)
{
    new iAlive, id
    
    for (id = 1; id <= g_MaxPlayers; id++)
    {
        if (is_user_alive(id))
            iAlive++
        
        if (iAlive == target_index)
            return id;
    }
    
    return -1;
}
























resimler
[Resim: 9aQprZ.jpg]



[Resim: y6EnJn.jpg]


#2
Son Düzenleme: 18-01-2019, Saat: 19:45, Düzenleyen: Kalipso22.
Konu güncellenmediği için çöpe taşınmıştır .

HLDS'de deniyorsan o yüzden sıkıntı çıkarıyor olabilir . Online sunucularda test etmeyi dene .

Forum kurallarına aykırı olduğun için konunuz silinmiştir .


Bir Hata Söz Konusu Olursa Bizlere Ulaşarak Düzeltebilirsiniz.





Bir hesap oluşturun veya yorum yapmak için giriş yapın

Yorum yapmak için üye olmanız gerekiyor

ya da

Konu ile Alakalı Benzer Konular
Konular Yazar Yorumlar Okunma Son Yorum
Silinmiş Konu   | Nemesis Veda... nemesisveda 3 310 30-11-2019, Saat: 10:44
Son Yorum: MawiLarq
Silinmiş Konu   | zmonster Zombi nemesis & Zombi lazer mehmedfatih 1 328 22-06-2019, Saat: 19:06
Son Yorum: MawiLarq
Silinmiş Konu   | ghost mode eklentisi TheNorse 53 2,024 05-03-2019, Saat: 01:08
Son Yorum: Kalipso22
Silinmiş Konu   | Otomatik nemesis başlatma kodu ZAMAN BÖLGESİ 2 314 11-01-2019, Saat: 10:09
Son Yorum: Kalipso22
Silinmiş Konu   | Nemesis mod (ufak bir problem) Gece Wavisi 2 291 28-12-2018, Saat: 20:02
Son Yorum: Kalipso22

Task