Raised This Month: $ Target: $400
 0% 

Entity's Not Giving


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
The Specialist
BANNED
Join Date: Nov 2006
Old 11-25-2006 , 01:27   Entity's Not Giving
Reply With Quote #1

Im making this weapon entity and bullet entitys, but its not giving me the weapon entity. any ideas ? also I need a good way to find out if the player has my gun out .
Code:
#include <amxmodx> #include <engine> #include <cstrike> #include <fun> // Global Variables new g_Switch; new g_Price; new spr_zbeam; public plugin_init() {     register_plugin("The Gauss","0.1","The Specialist");     g_Switch = register_cvar("tg_switch","1");     g_Price = register_cvar("tg_price","3000");     register_touch("BulletEnt","player","gauss_damage");     register_clcmd("say /buy_gauss","buy_gauss",ADMIN_ALL,"Buys A Gauss");     register_clcmd("say_team /buy_gauss","buy_gauss",ADMIN_ALL,"Buys A Gauss");     register_concmd("amx_buy_gauss","buy_gauss",ADMIN_ALL , "Buys A Gauss"); } // called by client command public buy_gauss(id) {     // if cvar is 0 end plugin functon         if(get_pcvar_num(g_Switch)==0)     {         client_print(id,print_chat,"[AMX] The Gauss Is Off");         return PLUGIN_HANDLED;     }else{         // else check to see if player has enough money                 new Cash = cs_get_user_money(id);                 // if player doesnt end function                 if( Cash < get_pcvar_num(g_Price))         {             client_print(id,print_chat,"[AMX] You Dont Have Enough Money For That!");             return PLUGIN_HANDLED;         }else{             // else charge for gun and give the player a gauss                         cs_set_user_money(id,Cash - get_pcvar_num(g_Price));             give_gauss(id);         }     }     return PLUGIN_HANDLED; } // give player gauss public give_gauss(id) {     // create the weapon         new Ent_Weapon = create_entity("info_target");         // give the weapon a class         entity_set_string(Ent_Weapon,EV_SZ_classname,"weaponbox");         // make the weapon solid         entity_set_int(Ent_Weapon,EV_INT_solid,SOLID_NOT);         // give the weapon an owner         entity_set_edict(Ent_Weapon,EV_ENT_aiment,id);         // give the weapon a model         entity_set_model(Ent_Weapon,"models/p_gauss.mdl");     entity_set_string(Ent_Weapon,EV_SZ_viewmodel,"models/v_gauss.mdl");     entity_set_model(Ent_Weapon, "models/w_gauss.mdl");         } // create the bullet entities public make_bullets(id, iWeapon)  {      // create entity         new BulletEnt = create_entity("info_target");         // if bullet Entity index is larger then 0         if(BulletEnt > 0)     {               new Float:Angle[3];         new Float:Origin[3];         new Float:AimVelocity[3];                 new Float:MinBox[3] = {-1.0, -1.0, -1.0};         new Float:MaxBox[3] = {1.0, 1.0, 1.0};                 // get vectors of entity                 entity_get_vector(id, EV_VEC_origin, Origin);         Origin[2] += 12.0;                 // give the bullets a classname                 entity_set_string(BulletEnt, EV_SZ_classname, "BulletX");                 // give the bullets a model                 entity_set_model(BulletEnt, "models/shell.mdl");                 new Weapon[33];                 get_weaponname(iWeapon, Weapon, 32);         entity_set_string(BulletEnt, EV_SZ_targetname, Weapon);                 entity_get_vector(id, EV_VEC_v_angle, Angle);                 entity_set_vector(BulletEnt, EV_VEC_mins, MinBox);         entity_set_vector(BulletEnt, EV_VEC_maxs, MaxBox);                 // set the bullets origin                 entity_set_origin(BulletEnt, Origin);         entity_set_vector(BulletEnt, EV_VEC_angles, Angle);         entity_set_vector(BulletEnt, EV_VEC_v_angle, Angle);                 // make the bulelts effects and solid and move and set owner                 entity_set_int(BulletEnt, EV_INT_effects, 2);         entity_set_int(BulletEnt, EV_INT_solid, 2);         entity_set_int(BulletEnt, EV_INT_movetype, 5);         entity_set_edict(BulletEnt, EV_ENT_owner, id);                 // users velocty by aim                     VelocityByAim(id, 800, AimVelocity);                 // set hte velocity                 entity_set_vector(BulletEnt, EV_VEC_velocity, AimVelocity);                 // TE_BEAMFOLLOW                 message_begin(MSG_BROADCAST, SVC_TEMPENTITY);         write_byte(22);         write_short(BulletEnt);  // Entity to follow         write_short(spr_zbeam);  // Sprite index         write_byte(10);          // Life         write_byte(2);           // Line width         write_byte(193);         // Red         write_byte(193);         // Green         write_byte(191);         // Blue         write_byte(120);         // Brightness         message_end();     }         return 0; } public gauss_damage(id,BulletEnt) {     // get the touched users health         new Health = get_user_health(id);     new Damage = random_num(50,100);     new Attacker = entity_get_edict(BulletEnt, EV_ENT_owner);     new TargetName[33];     entity_get_string(BulletEnt, EV_SZ_targetname, TargetName, sizeof(TargetName));         // if players health is larger then damage then set health         if(Health > Damage )     {         set_user_health(id,Health - Damage);     }else{         // kill user and make a death message and set frags                 user_silentkill(id);         make_deathmsg(Attacker, id, 0,TargetName);         set_user_frags(Attacker, get_user_frags(Attacker) + 1);     }     } // preacahce models and sounds public plugin_precache() {     precache_model("models/v_gauss.mdl");     precache_model("models/p_gauss.mdl");     precache_model("models/w_gauss.mdl");     precache_sound("sound/gauss_fire1.wav");     precache_sound("sound/gauss_fire2.wav");     precache_model("models/shell.mdl");     spr_zbeam = precache_model("sprites/zbeam4.spr"); }
thanks guys
The Specialist is offline
Send a message via AIM to The Specialist
 



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 06:48.


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