Raised This Month: $ Target: $400
 0% 

How to stack blocks, Not blockmaker.


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
fantarn
Member
Join Date: Feb 2011
Old 11-15-2011 , 10:56   How to stack blocks, Not blockmaker.
Reply With Quote #1

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)
}
}
fantarn 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 08:23.


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