Sari la conținut

[Plugin] Xmas Plugin


Shadows Adi

Postări Recomandate

  • Scripters
Postat

Descriere: Daca vreti sa faceti un addons de craciun aveti nevoie de acest plugin pentru a nu mai incarca serverul cu 100 de pluginuri. Acest plugin poate face: schimba modelele la ct/tero cand dai hs se aude un sunet cand o echipa castiga apare sus in centru un mesaj bomb events cu un bomb timer cand scoti cutitul se aude un sunet

  • Descărcare: 
  •  
 

/* Sublime AMXX Editor v2.2 */

#include <amxmodx> 
#include <fun>
#include <csx>
#include <engine>
#include <cstrike>
#include <fakemeta>
#include <ColorChat>
#include <hamsandwich>
#include <dhudmessage> 
#include <fakemeta_util>

new const    
            PLUGIN[]     = "XMAS BASE PLUGIN",
            VERSION[]     = "1.0.1",
            AUTHOR[]    = "Filiq/Diversity" 

new Sounds[][] = {
    "xmas/xmas_bomb_planted.mp3", 
    "xmas/Hoho.wav",
    "xmas/Hoho2.wav"
}

new const BombModels[][] = {
    "models/xmas_filip/bomb/christmastree.mdl",
    "models/xmas_filip/bomb/christmastree2.mdl",
    "models/xmas_filip/bomb/frost_man.mdl"
}

new c4time,
    gString[256]

enum pData {
    pSanta,
    pGrinch
}
new PlayerData[33][pData]

enum cvarlist {
    grinch_hp,
    grinch_ap,
    grinch_speed,

    santa_hp,
    santa_ap,
    santa_speed
}
new Cvar[cvarlist] 

public plugin_init() {
    register_plugin(PLUGIN, VERSION, AUTHOR)
        
    RegisterHam(Ham_Spawn, "player", "OnPlayerSpawn", 1)

    register_event("DeathMsg", "OnPlayerDeath", "a")
    register_event("HLTV", "NewRound", "a", "1=0", "2=0")
    register_event("DeathMsg", "DeathMSG", "a")
    register_event("SendAudio", "terowin", "a", "2=%!MRAD_terwin")
    register_event("SendAudio", "ctwin", "a", "2=%!MRAD_ctwin") 

    register_forward(FM_SetModel, "fwd_SetModel")  

    Cvar[grinch_hp] = register_cvar("grinch_hp", "250")
    Cvar[grinch_ap] = register_cvar("grinch_ap", "150")
    Cvar[grinch_speed] = register_cvar("grinch_speed", "350")

    Cvar[santa_hp] = register_cvar("santa_hp", "250")
    Cvar[santa_ap] = register_cvar("santa_ap", "150")
    Cvar[santa_speed] = register_cvar("santa_speed", "350")

    new iEntity,
        iMaxPlayers = get_maxplayers(),
        iInfoTarget = engfunc(EngFunc_AllocString, "info_target")

    for(new id = 1; id <= iMaxPlayers; id++) {
        iEntity = engfunc(EngFunc_CreateNamedEntity, iInfoTarget)
        
        if(pev_valid(iEntity)) {
            engfunc(EngFunc_SetModel, iEntity, "models/xmas_filip/santa_hat.mdl")
            set_pev(iEntity, pev_movetype, MOVETYPE_FOLLOW)
            set_pev(iEntity, pev_aiment, id)
            set_pev(iEntity, pev_owner, id)
        }
    }
}

public plugin_precache() {

    for(new i = 0; i < sizeof(Sounds); i++) precache_sound(Sounds)
    for(new i = 0; i < sizeof(BombModels); i++) precache_model(BombModels) 

    precache_model("models/xmas_filip/santa_hat.mdl")
    //precache_model("models/player/xmas_red1/xmas_red1.mdl")
    //precache_model("models/player/xmas_blue1/xmas_blue1.mdl")
}

public OnPlayerDeath() {    

    new iKiller  = read_data(1)
    new iVictim  = read_data(2) 

    SearchSantaGrinch(1)
    SearchSantaGrinch(2)
    
    if(iVictim == iKiller) return 

    if(PlayerData[iVictim][pGrinch]) ColorChat(0, RED, "^x04[Santa VS Grinch]^x01 Grinch^x03 %s^x01 a fost distrus de catre^x03 %s^x01!", GetName(iVictim), GetName(iKiller))
    if(PlayerData[iVictim][pSanta]) ColorChat(0, RED, "^x04[Santa VS Grinch]^x01 Craciunul a fost distrus de catre^x03 %s^x01!", GetName(iKiller))

}

public OnPlayerSpawn(playerid) {
    if(!is_user_connected(playerid)) return
    
    //switch(cs_get_user_team(playerid)) {
    //    case CS_TEAM_T: cs_set_user_model(playerid, "models/player/xmas_red1/xmas_red1.mdl")
    //    case CS_TEAM_CT: cs_set_user_model(playerid, "models/player/xmas_blue1/xmas_blue1.mdl")
    //}

    if(PlayerData[playerid][pGrinch] || PlayerData[playerid][pSanta]) {
        fm_set_user_armor(playerid, 0)
        set_rendering(playerid)

        PlayerData[playerid][pGrinch] = 0
        PlayerData[playerid][pSanta] = 0
    }
}

public NewRound() {
    set_lights("i")
    c4time = 0
}

public DeathMSG() {
    new killer = read_data(1),
        victim = read_data(2),
        hs = read_data(3)

    if(killer == victim) return 

    if(hs == 1) { 
        PlaySoundToClients(killer, Sounds[random_num(1, 2)])
        PlaySoundToClients(victim, Sounds[random_num(1, 2)])
    }
}

public terowin() {
    set_dhudmessage(random(255), random(255), random(255), -1.0, 0.27, 2, 6.0, 3.0, 0.1, 1.5)
    show_dhudmessage(0, "Craciunul a fost distrus!")
}

public ctwin() {
    set_dhudmessage(random(255), random(255), random(255), -1.0, 0.27, 2, 6.0, 3.0, 0.1, 1.5)
    show_dhudmessage(0, "Craciunul a fost salvat!")

public SetModel(ent, const szModel[]) {
    if(!pev_valid(ent)) return FMRES_IGNORED
    
    if(equal(szModel, "models/w_c4.mdl")) { 
        new RandModel = random_num(0, 2) 

        engfunc(EngFunc_SetModel, ent, BombModels[RandModel])
        
        return FMRES_SUPERCEDE
    }

    return FMRES_IGNORED
}

public bomb_planted(planter) {
    c4time = get_cvar_num("mp_c4timer")  
    set_task(1.0, "bombtimer", 1000000, _, _, "b")

    PlaySoundToClients(0, Sounds[0])

    new money = 2000
    cs_set_user_money(planter, money+cs_get_user_money(planter))

    ColorChat(0, RED, "^x04[XMAS]^x01 Craciunul este aproape distrus de catre^x03 %s^x01 prin plantarea^x03 bombei^x01!", GetName(planter))
    ColorChat(0, RED, "^x04[XMAS]^x01 Acesta a primit^x03 %d$^x01 pentru plantarea bombei.", money)
}

public bomb_explode(planter) {
    c4time = 0
    new money = 3000
    cs_set_user_money(planter, money+cs_get_user_money(planter))

    ColorChat(0, RED, "^x04[XMAS]^x01 Craciunul a fost distrus de catre^x03 %s^x01 prin explozia^x03 bombei^x01!", GetName(planter))
    ColorChat(0, RED, "^x04[XMAS]^x01 Acesta a primit^x03 %d$^x01 pentru explozia bombei.", money)
}

public bomb_defused(defuser) {
    c4time = 0
    new money = 5500
    cs_set_user_money(defuser, money+cs_get_user_money(defuser))

    ColorChat(0, RED, "^x04[XMAS]^x01 Craciunul a fost salvat de catre^x03 %s^x01 prin dezamorsarea^x03 bombei^x01!", GetName(defuser))
    ColorChat(0, RED, "^x04[XMAS]^x01 Acesta a primit^x03 %d$^x01 pentru dezamorsarea bombei.", money)
}

public bombtimer() { 

    if(c4time > 0) {
        c4time -- 

        set_dhudmessage(random(255), random(255), random(255), -1.0, 0.86, 2, 1.1, 1.1, 0.0, 0.0)
        show_dhudmessage(0, "Craciunul va fi distrus in: %d", c4time)

    } else remove_task(1000000)

public SearchSantaGrinch(arg) { 
    new TeroNum = CountPlayers(1),
        CTNum = CountPlayers(2),
        playerid 
    
    switch(arg) {
        case 1: {
            if(TeroNum == 1 && CTNum > 0) {
                playerid = GetRemainingPlayerId(1)

                if(PlayerData[playerid][pGrinch] == 1) return true

                PlayerData[playerid][pGrinch] = 1

                ColorChat(0, RED, "^x04[Santa VS Grinch]^x03 %s^x03 a devenit^x03 Grinch^x01!", GetName(playerid))
                ColorChat(0, RED, "^x04[Santa VS Grinch]^x01 Acesta a primit:^x03 %d^x01 HP,^x03 %d^x01 AP,^x03 %d^x01 Viteza.", get_pcvar_num(Cvar[grinch_hp]), get_pcvar_num(Cvar[grinch_ap]), get_pcvar_num(Cvar[grinch_speed]))

                gString[0] = (EOS)
                formatex(gString, 100, "^n^n%s a devenit Grinch!^nSansele craciunului au scazut!", GetName(playerid))
                HudMessage(0, gString)

                set_rendering(playerid, kRenderFxGlowShell, 255, 0, 0, kRenderNormal, 25)

                set_user_maxspeed(playerid, float(get_pcvar_num(Cvar[grinch_speed])))
                fm_set_user_health(playerid, get_pcvar_num(Cvar[grinch_hp]))
                fm_set_user_armor(playerid, get_pcvar_num(Cvar[grinch_ap]))

                gString[0] = (EOS)
                formatex(gString, 128, "cl_forwardspeed %.1f;cl_sidespeed %.1f;cl_backspeed %.1f", float(get_pcvar_num(Cvar[grinch_speed])), float(get_pcvar_num(Cvar[grinch_speed])), float(get_pcvar_num(Cvar[grinch_speed])))
                client_cmd(playerid, gString)
            }
        }
        case 2: {
            if(CTNum == 1 && TeroNum > 0) {
                playerid = GetRemainingPlayerId(2)

                if(PlayerData[playerid][pSanta] == 1) return true

                PlayerData[playerid][pSanta] = 1

                ColorChat(0, RED, "^x04[Santa VS Grinch]^x03 %s^x03 a devenit^x03 Santa^x01!", GetName(playerid))
                ColorChat(0, RED, "^x04[Santa VS Grinch]^x01 Acesta a primit:^x03 %d^x01 HP,^x03 %d^x01 AP,^x03 %d^x01 Viteza.", get_pcvar_num(Cvar[santa_hp]), get_pcvar_num(Cvar[santa_ap]), get_pcvar_num(Cvar[santa_speed]))

                gString[0] = (EOS)
                formatex(gString, 100, "%s a devenit Santa!^nSansele craciunului au crescut!", GetName(playerid))
                HudMessage(0, gString, _, _, _, _, 0.60) 

                set_rendering(playerid, kRenderFxGlowShell, 0, 255, 255, kRenderNormal, 25)

                fm_set_user_maxspeed(playerid, float(get_pcvar_num(Cvar[santa_speed])))
                fm_set_user_health(playerid, get_pcvar_num(Cvar[santa_hp]))
                fm_set_user_armor(playerid, get_pcvar_num(Cvar[santa_ap]))

                gString[0] = (EOS)
                formatex(gString, 128, "cl_forwardspeed %.1f;cl_sidespeed %.1f;cl_backspeed %.1f", float(get_pcvar_num(Cvar[santa_speed])), float(get_pcvar_num(Cvar[santa_speed])), float(get_pcvar_num(Cvar[santa_speed])))
                client_cmd(playerid, gString)
            }
        }
    }

    return true
}  

stock CountPlayers(const Team) {

    new iPlayers[32],
        iPlayersNum,
        iPlayersCount = 0

    get_players(iPlayers, iPlayersNum)  
    for(new i = 0; i < iPlayersNum; i++) {
        if(is_user_connected(iPlayers) && is_user_alive(iPlayers)) {
            switch(Team) {
                case 1: if(get_user_team(iPlayers)  == 1) iPlayersCount++
                case 2: if(get_user_team(iPlayers)  == 2) iPlayersCount++
            } 
        } 
    } 

    return iPlayersCount
}

stock GetRemainingPlayerId(const Team) {

    new iPlayers[32],
        iPlayersNum,
        iPlayerId = 0

    get_players(iPlayers, iPlayersNum)          
    for(new i = 0; i < iPlayersNum; i++) {
        if(is_user_connected(iPlayers) && is_user_alive(iPlayers)) {
            switch(Team) {
                case 1: if(get_user_team(iPlayers) == 1) iPlayerId = iPlayers
                case 2: if(get_user_team(iPlayers) == 2) iPlayerId = iPlayers
            } 
        } 
    }

    return iPlayerId
}

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

stock HudMessage(const id, const message[], red = 0, green = 160, blue = 0, Float:x = -1.0, Float:y = 0.65, effects = 2, Float:fxtime = 0.01, Float:holdtime = 3.0, Float:fadeintime = 0.01, Float:fadeouttime = 0.01) {
    new count = 1, players[32];
    
    if(id) players[0] = id;
    else get_players(players, count, "ch"); {
        for(new i = 0; i < count; i++) {
            if(is_user_connected(players)) {    
                new color = pack_color(clamp_byte(red), clamp_byte(green), clamp_byte(blue))
                
                message_begin(MSG_ONE_UNRELIABLE, SVC_DIRECTOR, _, players);
                write_byte(strlen(message) + 31);
                write_byte(DRC_CMD_MESSAGE);
                write_byte(effects);
                write_long(color);
                write_long(_:x);
                write_long(_:y);
                write_long(_:fadeintime);
                write_long(_:fadeouttime);
                write_long(_:holdtime);
                write_long(_:fxtime);
                write_string(message);
                message_end();
            }
        }
    }
}

stock GetName(playerid) {
    new name[33]

    get_user_name(playerid, name, 33)

    return name
}

Denumire plugin: Xmas Plugin Versiune: 1.0.1 Instalare: 

	1. Fisierul nume_plugin.sma il puneti in addons/amxmodx/scripting
2. Fisierul nume_plugin.amxx il puneti in addons/amxmodx/plugins
3. Intrati in fisierul addons/amxmodx/configs/plugins.ini si adaugati la urma:
	- nume_plugin.amxx
	

Arhivat

Acest topic este acum arhivat și este închis pentru alte răspunsuri.

  • Navigare recentă   0 membri

    • Nici un utilizator înregistrat nu vede această pagină.
×
×
  • Creează nouă...

Informații Importante

Termeni de Utilizare & Politică Intimitate