Raised This Month: $ Target: $400
 0% 

My plugin works for everyone else but not for me...


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
o0panda
Member
Join Date: Sep 2005
Old 04-16-2006 , 04:40   My plugin works for everyone else but not for me...
Reply With Quote #1

Hello,

Amx is at 1.71 on windows. Well, my plugin worked before I upgraded to 1.70 so it might be code changes that affected it. My problem is that on fy_ maps, I made a plugin so that they will drop their usp or glock, and give them a deagle instead. It works, however, it's not working for me anymore. It works for everyone else and even bots, but I can't make it work for me.

Code:
#include <amxmodx> #include <fun> #include <cstrike> new givedeagle = 0; public plugin_init() {   register_plugin("Drop&Give", "1.0", "pandaGirl")   register_event("ResetHUD", "spawned", "b")   new mapname[33]   get_mapname(mapname,32)   if(contain(mapname,"fy_") > -1 ) {     givedeagle = 1;     } } public spawned(id) {         if(givedeagle == 1 && is_user_alive(id)) {     set_task(0.5,"give_it",id)     } } public give_it(id) {   new clip, ammo, weapon = get_user_weapon(id,clip,ammo);     switch (weapon) {     case CSW_GLOCK18: {         client_cmd(id, "drop weapon_glock18")         give_item(id,"weapon_deagle")         cs_set_user_bpammo(id, CSW_DEAGLE, 35)         }     case CSW_USP: {           client_cmd(id, "drop weapon_usp")         give_item(id,"weapon_deagle")         cs_set_user_bpammo(id, CSW_DEAGLE, 35)         }     }   }

I ono why it's ignoring me and not anyone else. =/
o0panda is offline
Sandurr
Senior Member
Join Date: Aug 2005
Old 04-16-2006 , 07:26  
Reply With Quote #2

listenserver?
Sandurr is offline
o0panda
Member
Join Date: Sep 2005
Old 04-30-2006 , 19:27  
Reply With Quote #3

Omg, I forgot about this thread. Sorry for not replying.

No, I am running my server on a Windows Dedicated Server. I still can't figure out how to fix it.
o0panda is offline
VEN
Veteran Member
Join Date: Jan 2005
Old 05-02-2006 , 09:14  
Reply With Quote #4

You should not check just for player's current weapon.
For example clients who set _cl_autowepswitch CVAR to 0 will hold a knife because it given before secondary weapon on spawn.

Try that way:
Code:
public give_it(id) {     if (user_has_weapon(id, CSW_GLOCK18))         engclient_cmd(id, "drop", "weapon_glock18")     else if (user_has_weapon(id, CSW_USP))         engclient_cmd(id, "drop", "weapon_usp")     else         return     give_item(id, "weapon_deagle")     cs_set_user_bpammo(id, CSW_DEAGLE, 35) }

Also you probably want to strip weapon but don't know how to do it.
In this case you may use my strip_user_gun stock: http://forums.alliedmods.net/showthread.php?t=26300
VEN is offline
o0panda
Member
Join Date: Sep 2005
Old 05-02-2006 , 21:59  
Reply With Quote #5

Thx for the fix, I did have autoswitch off, but used your fix also.

And, if it's suppose to strip, I still see it "drop" right in front of me. I just added that strip code before my function, I thought it disappears. o.o
o0panda is offline
VEN
Veteran Member
Join Date: Jan 2005
Old 05-04-2006 , 03:29  
Reply With Quote #6

Quote:
Originally Posted by o0panda
I did have autoswitch off, but used your fix also.
I think you mean ON (0 = OFF, 1 = ON).

Quote:
And, if it's suppose to strip, I still see it "drop" right in front of me. I just added that strip code before my function, I thought it disappears. o.o
Because of incorrect usage. Copy the stock to your plugin and then try that way:
Code:
public give_it(id) {     if (user_has_weapon(id, CSW_GLOCK18))         strip_user_gun(id, CSW_GLOCK18)     else if (user_has_weapon(id, CSW_USP))         strip_user_gun(id, CSW_USP)     else         return     give_item(id, "weapon_deagle")     cs_set_user_bpammo(id, CSW_DEAGLE, 35) }

Note: engine module should be enabled.
VEN is offline
o0panda
Member
Join Date: Sep 2005
Old 05-04-2006 , 14:31  
Reply With Quote #7

Ok, I meant on lol. And, ya I didn't change my coding while I had your stock. Thanks again.
o0panda is offline
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 05:09.


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