AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   How to stack blocks, Not blockmaker. (https://forums.alliedmods.net/showthread.php?t=172098)

fantarn 11-15-2011 10:56

How to stack blocks, Not blockmaker.
 
Hey,

How can i stack blocks with my plugin?
when i say /cobblestone and spawn 2 blocks they dont stack up.
this is the code.

Code:

/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <amxmisc>
#include <fakemeta>
#include <engine>
#include <cstrike>
#include <hamsandwich>
#include <fun>


#define PLUGIN "MinecraftMod"
#define VERSION "1.0"
#define AUTHOR "Fantarn"


public plugin_init() {
        register_plugin(PLUGIN, VERSION, AUTHOR)
        register_clcmd("say /cobblestone","cobblestone");
        RegisterHam(Ham_TakeDamage, "info_target", "Entity_TakeDamage_Post", 1)
}


public plugin_precache(){
        precache_model("models/cobblestone.mdl");
}


public cobblestone(id,ent){
        if(cs_get_user_money(id) < 2000){
        client_print(id,print_chat,"you need 2000$ to create a cobblestone block")
        return
}

    new bablo = cs_get_user_money(id)
    new Float:fVelocity[3], Float:fOrigin[3]
    new ent = create_entity("info_target")
   
   
    cs_set_user_money(id,bablo - 2000)
    entity_get_vector(id, EV_VEC_origin, fOrigin)
    VelocityByAim(id, 34, fVelocity)
   
    fOrigin[0] += fVelocity[0]
    fOrigin[1] += fVelocity[1]

    VelocityByAim(id, 300, fVelocity)
   
    if(is_valid_ent(ent))
    {
    entity_set_string(ent, EV_SZ_classname, "cobblestone")
    entity_set_model(ent, "models/cobblestone.mdl")
    entity_set_size(ent, Float:{ -10.0, -10.0, 0.0 }, Float:{ 10.0, 10.0, 25.0 })
    entity_set_int(ent, EV_INT_movetype, MOVETYPE_TOSS)
    entity_set_vector(ent, EV_VEC_origin, fOrigin)
    entity_set_float(ent, EV_FL_health, 200.0)
    entity_set_float(ent, EV_FL_takedamage, DAMAGE_AIM)
    entity_set_int(ent, EV_INT_solid, SOLID_BBOX)
    entity_set_int(ent, EV_INT_sequence, 0)
    entity_set_float(ent, EV_FL_nextthink, get_gametime() + 0.01)
    drop_to_floor(ent)
    }
}

public Entity_TakeDamage_Post(victim, inflicator, attacker, Float:damage, damage_type)
{
        if(!is_user_connected(attacker))
                return;

        new szClassName[32];
        entity_get_string(victim, EV_SZ_classname, szClassName, charsmax(szClassName))

        if(equal(szClassName, "cobblestone"))
        {
        emit_sound(victim, CHAN_VOICE, "debris/wood1.wav", VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
}
}



All times are GMT -4. The time now is 08:23.

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