AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Not Dropping (https://forums.alliedmods.net/showthread.php?t=47638)

The Specialist 11-23-2006 00:52

Not Dropping
 
I made this plugin to increase the velocity of a weapon the entity_owner drops . and use register touch to do damage. but this wont allow me to drop any weapons . and theres no run time errors in my logs . any ideas ?
Code:
#include <amxmodx> #include <amxmisc> #include <engine> // Global Variables new g_Throw; public plugin_init() {     register_plugin("Throw Weapons","0.1","The Specialist");     g_Throw = register_cvar("tw_switch","1");     register_clcmd("drop","throw_weapon");     register_touch("Ent","player","throw_damage"); } public throw_weapon(id) {     // if pcvar is off then end fucntion         if(get_pcvar_num(g_Throw)==0)     {         return PLUGIN_HANDLED;     }else{         new name[33];                 get_user_name(id,name,32)                 new index = get_user_index(name);                 // find the weapon thrown by owner                 new Ent = find_ent_by_owner(index ,"weapon",id);                 // set the veocit yof the userrs weapon                 entity_set_string(Ent,EV_VEC_velocity,"10000")     }     return PLUGIN_HANDLED; } public throw_damage(id) {     // if user health is larger then damage then fakedamge         if(get_user_health(id) > 25 )     {         // deal fakedamge                 fakedamage(id,"weapon_awp",float(read_data(2)),DMG_CLUB &&  DMG_BLAST )         return;     }else{         // if user has less health then he dies         user_kill(id);     }     return; }

jim_yang 11-23-2006 01:04

Re: Not Dropping
 
because you return plugin_handled, this will block that clcmd
use return;

The Specialist 11-23-2006 01:20

Re: Not Dropping
 
kool. i can drop but no velocity increase on hte weapon i drop. or any fakedamge done. Is there something wrong with the way i set the velocity ?:cry:

jim_yang 11-23-2006 01:24

Re: Not Dropping
 
new name[33];
get_user_name(id,name,32)
new index = get_user_index(name);
id = index, so three lines above is useless.

The Specialist 11-23-2006 01:50

Re: Not Dropping
 
hmmm. still no increase in velocity . nay ideas why the weapon isnt speeding up on drop ? am i getting the ent index right?
Code:
#include <amxmodx> #include <amxmisc> #include <engine> // Global Variables new g_Throw; public plugin_init() {     register_plugin("Throw Weapons","0.1","The Specialist");     g_Throw = register_cvar("tw_switch","1");     register_clcmd("drop","throw_weapon");     register_touch("Ent","player","throw_damage"); } public throw_weapon(id) {     // if pcvar is off then end fucntion         if(get_pcvar_num(g_Throw)==1)     {                 // find the weapon thrown by owner                 new Ent = find_ent_by_owner(id,"weapon",id);                 // set the veocit yof the userrs weapon                 entity_set_string(Ent,EV_VEC_velocity,"1000")     }     return; } public throw_damage(id) {     // if user health is larger then damage then fakedamge         if(get_user_health(id) > 25 )     {         // deal fakedamge                 fakedamage(id,"weapon_awp",float(25),DMG_CLUB &&  DMG_BLAST )         return;     }else{         // if user has less health then he dies         user_kill(id);     }     return; }

jim_yang 11-23-2006 02:41

Re: Not Dropping
 
hooking command drop is a forward, maybe that time the weapon actually not dropped, so you can block it. i don't know the detail. maybe you should add a delay.

P34nut 11-23-2006 10:51

Re: Not Dropping
 
entity_set_string(Ent,EV_VEC_velocity,"1000")
this should be an vector not a string

this could be improved:
fakedamage(id,"weapon_awp",float(25),DMG_CLUB && DMG_BLAST )
to:
fakedamage(id, "weapon_awp", 25.0, (DMG_CLUB | DMG_BLAST))

The Specialist 11-23-2006 11:46

Re: Not Dropping
 
thanks Peanut ++karma:up:


All times are GMT -4. The time now is 07:01.

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