Raised This Month: $ Target: $400
 0% 

message and event troubles


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
SSJ2GOKU
Senior Member
Join Date: Oct 2005
Location: Belgium
Old 10-30-2005 , 13:42   message and event troubles
Reply With Quote #1

can anyone find the bug PLEASE
i've been trying already for 2 weeks to get this code to work

btw im NeoSniperkiller (if you see it in the plugin)


Code:
#include <amxmodx> #include <fun> #include <engine> #include <fakemeta> new kamestarta, kamecharge, kameab, kametrail new weaponName[41] new weaponId new Float:vOrigin[3] public plugin_init() {     register_plugin("Booster","2.0","NeoSniperkiller")     register_event("CurWeapon", "Get_WeaponName", "be", "1=1")     register_message( get_user_msgid( "EETrail" ), "trail" )     return PLUGIN_CONTINUE } public client_PostThink(id){     new ent = find_ent_in_sphere( -1, vOrigin, 64.0 );     while( ent > 0 ){         new szModel[32];         entity_get_string( ent, EV_SZ_model, szModel, 31 );         if( containi( szModel, "sprites/kamecharge.spr" ) != -1 ){             entity_set_model( ent, "sprites/10xkamecharge.spr" );         }     }     return PLUGIN_CONTINUE } public Get_WeaponName(id) {     weaponId = read_data(2)     get_weaponname(weaponId, weaponName, 40) } public trail(id){     if( weaponName[id] == 2){         set_msg_arg_int( 5, ARG_SHORT, kamecharge) // beam start         set_msg_arg_int( 6, ARG_SHORT, kamestarta) // beam head         set_msg_arg_int( 7, ARG_SHORT, kameab)         set_msg_arg_int( 8, ARG_SHORT, kametrail) // trail         set_msg_arg_int( 9, ARG_BYTE, get_msg_arg_int(9) * 10 )         return PLUGIN_CONTINUE     }     return PLUGIN_CONTINUE } public plugin_precache(){     kamestarta = precache_model("sprites/10xkameastart.spr")     kameab = precache_model("sprites/10xkamea.spr")     kametrail = precache_model("sprites/10xkametrail.spr")     kamecharge = precache_model("sprites/10xkamecharge.spr")     return PLUGIN_CONTINUE }
SSJ2GOKU is offline
Send a message via MSN to SSJ2GOKU
XxAvalanchexX
Veteran Member
Join Date: Oct 2004
Location: abort73.com
Old 10-30-2005 , 14:14  
Reply With Quote #2

Code:
    new ent = find_ent_in_sphere( -1, vOrigin, 64.0 );     while( ent > 0 ){         new szModel[32];         entity_get_string( ent, EV_SZ_model, szModel, 31 );         if( containi( szModel, "sprites/kamecharge.spr" ) != -1 ){             entity_set_model( ent, "sprites/10xkamecharge.spr" );         }     }
1. Where was the vOrigin variable declared?
2. This will run an infinite loop, since once you get ent the value never changes. If it was 7, for example, then it would run the loop over and over and over again since it never drops below 0.
__________________
No longer around. Thanks your support, everyone! As always:
THIS ONES FOR YOU
3000 PTS
XxAvalanchexX is offline
SSJ2GOKU
Senior Member
Join Date: Oct 2005
Location: Belgium
Old 10-30-2005 , 14:19  
Reply With Quote #3

ty
i deleted the vOrigin to see what you guys would place for it

but eh

its the part below that doesnt work
it freezes the players connection at "precaching resources" when he connects
SSJ2GOKU is offline
Send a message via MSN to SSJ2GOKU
XxAvalanchexX
Veteran Member
Join Date: Oct 2004
Location: abort73.com
Old 10-30-2005 , 14:58  
Reply With Quote #4

Because at that point it starts executing his client_PostThink which causes an infinite loop.
__________________
No longer around. Thanks your support, everyone! As always:
THIS ONES FOR YOU
3000 PTS
XxAvalanchexX is offline
SSJ2GOKU
Senior Member
Join Date: Oct 2005
Location: Belgium
Old 10-30-2005 , 19:56  
Reply With Quote #5

can you fix it ?

this is what its supposed to do:

when the guy is using a weapon, the curWeapon should return its value.
when the weapons value is 2, the sprites of ONLY THAT WEAPON should be changed.
SSJ2GOKU is offline
Send a message via MSN to SSJ2GOKU
XxAvalanchexX
Veteran Member
Join Date: Oct 2004
Location: abort73.com
Old 10-30-2005 , 20:54  
Reply With Quote #6

Code:
public Get_WeaponName(id) {     weaponId = read_data(2)     get_weaponname(weaponId, weaponName, 40)     if(weaponId == 2) {         new ent, Float:origin[3];         entity_get_vector(id,EV_VEC_origin,origin);         while((ent = find_ent_in_sphere(ent,origin,64.0)) != 0) {             new model[32];             entity_get_string(ent,EV_SZ_model,model,31);             if(containi(model,"sprites/kamecharge.spr") != -1) {                 entity_set_model(ent,"sprites/10xkamecharge.spr");             }         }     } }
__________________
No longer around. Thanks your support, everyone! As always:
THIS ONES FOR YOU
3000 PTS
XxAvalanchexX is offline
SSJ2GOKU
Senior Member
Join Date: Oct 2005
Location: Belgium
Old 10-31-2005 , 15:53  
Reply With Quote #7

ty but still its no solution for my problem man


its this part that still doesnt do a thing, and that makes the player stuck

Code:
public Get_WeaponName(id)   {       weaponId = read_data(2)       get_weaponname(weaponId, weaponName, 40) }   public trail(id){     if( weaponName[id] == 2){         set_msg_arg_int( 5, ARG_SHORT, kamecharge) // beam start         set_msg_arg_int( 6, ARG_SHORT, kamestarta) // beam head         set_msg_arg_int( 7, ARG_SHORT, kameab)         set_msg_arg_int( 8, ARG_SHORT, kametrail) // trail         set_msg_arg_int( 9, ARG_BYTE, get_msg_arg_int(9) * 10 )         return PLUGIN_CONTINUE     }        return PLUGIN_CONTINUE }
SSJ2GOKU is offline
Send a message via MSN to SSJ2GOKU
knekter
Senior Member
Join Date: Mar 2004
Location: PA
Old 10-31-2005 , 16:28   well
Reply With Quote #8

Well if you haven't noticed:
Code:
if( weaponName[id] == 2)
weaponName is a string not a number. You need to use:
Code:
if(equali(weaponName[id], "2"))
Also you should make the variable:
Code:
new weaponName[33][41] get_weaponname(weaponId, weaponName[id], 40)
__________________
More updates for Matrix Mod!
knekter is offline
Send a message via AIM to knekter Send a message via MSN to knekter
SSJ2GOKU
Senior Member
Join Date: Oct 2005
Location: Belgium
Old 10-31-2005 , 18:05  
Reply With Quote #9

so this it should be then?

Code:
 #include <amxmodx> #include <fun> #include <engine> #include <fakemeta> new kamestarta, kamecharge, kameab, kametrail new weaponName[33][41] new weaponId new Float:vOrigin[3] public plugin_init() {     register_plugin("Booster","2.0","NeoSniperkiller")     register_event("CurWeapon", "Get_WeaponName", "be", "1=1")       register_message( get_user_msgid( "EETrail" ), "trail" )     return PLUGIN_CONTINUE } public Get_WeaponName(id)   {       weaponId = read_data(2)       get_weaponname(weaponId, weaponName, 40)     if(weaponId == 2) {         new ent, Float:origin[3];         entity_get_vector(id,EV_VEC_origin,origin);         while((ent = find_ent_in_sphere(ent,origin,64.0)) != 0) {             new model[32];             entity_get_string(ent,EV_SZ_model,model,31);             if(containi(model,"sprites/kamecharge.spr") != -1) {                   entity_set_model(ent,"sprites/10xkamecharge.spr");               }         }     } }   public trail(id){     if(equali(weaponName[id], "2")) {         set_msg_arg_int( 5, ARG_SHORT, kamecharge) // beam start         set_msg_arg_int( 6, ARG_SHORT, kamestarta) // beam head         set_msg_arg_int( 7, ARG_SHORT, kameab)         set_msg_arg_int( 8, ARG_SHORT, kametrail) // trail         set_msg_arg_int( 9, ARG_BYTE, get_msg_arg_int(9) * 10 )         return PLUGIN_CONTINUE     }        return PLUGIN_CONTINUE } public plugin_precache(){     kamestarta = precache_model("sprites/10xkameastart.spr")     kameab = precache_model("sprites/10xkamea.spr")     kametrail = precache_model("sprites/10xkametrail.spr")     kamecharge = precache_model("sprites/10xkamecharge.spr")     return PLUGIN_CONTINUE }
SSJ2GOKU is offline
Send a message via MSN to SSJ2GOKU
knekter
Senior Member
Join Date: Mar 2004
Location: PA
Old 10-31-2005 , 18:18  
Reply With Quote #10

Code:
get_weaponname(weaponId, weaponName[id], 40)
__________________
More updates for Matrix Mod!
knekter is offline
Send a message via AIM to knekter Send a message via MSN to knekter
Reply



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 23:44.


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