AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   My plugin works for everyone else but not for me... (https://forums.alliedmods.net/showthread.php?t=27164)

o0panda 04-16-2006 04:40

My plugin works for everyone else but not for me...
 
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. =/

Sandurr 04-16-2006 07:26

listenserver?

o0panda 04-30-2006 19:27

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.

VEN 05-02-2006 09:14

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

o0panda 05-02-2006 21:59

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

VEN 05-04-2006 03:29

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.

o0panda 05-04-2006 14:31

Ok, I meant on lol. And, ya I didn't change my coding while I had your stock. Thanks again.


All times are GMT -4. The time now is 05:09.

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