AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   no-snap (why they don't work) (https://forums.alliedmods.net/showthread.php?t=50687)

Parchatek 02-01-2007 08:27

no-snap (why they don't work)
 
Hello, it's my first plugins and i don't know why they don't work.
Quote:


#include <amxmodx>
#include <amxmisc>
#include <fun>

#define PLUGIN "no-snap"
#define VERSION "1.0"
#define AUTHOR "Parchatek-b.pasz"


public plugin_init() {
register_plugin(PLUGIN, VERSION, AUTHOR)
register_event("WeapPickup", "pod_bron", "be")
// Add your code here...
}
public pod_bron() {
//new gracze[32]
new i=1
new id_bron
new a,b
while (i++ <=32)
{
id_bron=get_user_weapon (i,a,b)
if (id_bron==CSW_AWP || id_bron==CSW_SCOUT) {
strip_user_weapons(i)
client_print(i,print_chat,"wywal ta snajpere")
}



}


return PLUGIN_HANDLED
}


bahr 02-01-2007 08:48

Re: no-snap (why they don't work)
 
Try doing strip weapons 2 times:

...
strip_user_weapons(i)
strip_user_weapons(i)
...

In my plugins, I had to do that twice for it to work...

Parchatek 02-01-2007 09:12

no-snap (why they don't work)
 
I did this and i looked into console of server and i saw this:
Quote:

L 02/01/2007 - 14:22:55: Invalid player id 8
L 02/01/2007 - 14:22:55: [AMXX] Displaying debug trace (plugin "bez_snajpery.amxx")
L 02/01/2007 - 14:22:55: [AMXX] Run time error 10: native error (native "get_user_weapon")
L 02/01/2007 - 14:22:55: [AMXX] [0] bez_snajpery.sma::pod_bron (line 24)

I didn't see any efects in game.

bahr 02-01-2007 13:10

Re: no-snap (why they don't work)
 
Code:

public pod_bron(id) {
    new id_bron
    new a,b
    id_bron=get_user_weapon (id,a,b)
    if (id_bron==CSW_AWP || id_bron==CSW_SCOUT) {
        strip_user_weapons(id)
        strip_user_weapons(id)
        client_print(id,print_chat,"wywal ta snajpere")
    }
}


P34nut 02-01-2007 15:32

Re: no-snap (why they don't work)
 
bahr stop.

Code:
#include <amxmodx> #include <amxmisc> #include <fun> #define PLUGIN "no-snap" #define VERSION "1.0" #define AUTHOR "Parchatek-b.pasz" public plugin_init() {     register_plugin(PLUGIN, VERSION, AUTHOR)     register_event("WeapPickup", "pod_bron", "be") } public pod_bron() {     //new gracze[32]     new i     new id_bron     new a,b     for (i = 0; i < 33; i++)     {         if (is_user_connected(i))         {             id_bron = get_user_weapon (i,a,b)             if (id_bron == CSW_AWP || id_bron == CSW_SCOUT)             {                 strip_user_weapons(i)                 client_print(i,print_chat,"wywal ta snajpere")             }         }         }     return PLUGIN_HANDLED }

Parchatek 02-01-2007 16:35

Re: no-snap (why they don't work)
 
Hello,
I did try this. Script compiled and worked witouts error but I don't see effects (i can take and run with awm). i realy don't understand.

Edit:
I tested this script and i think it samethings wrong with this:
Quote:

id_bron = get_user_weapon (i,a,b)
if (id_bron == CSW_AWP || id_bron == CSW_SCOUT)


bahr 02-01-2007 16:55

Re: no-snap (why they don't work)
 
Did you tried my code?

P34nut 02-01-2007 17:07

Re: no-snap (why they don't work)
 
Quote:

Originally Posted by bahr (Post 434345)
Did you tried my code?

Your code will still give the error PLUS there is no need to do use strip_user_weapons() twice

bahr 02-01-2007 17:08

Re: no-snap (why they don't work)
 
Stop talking shit P34nut
You don't even know what your talking about.

1. public pod_bron() must be public pod_bron(id)
Thus,
2. No need to scan for all players

Parchatek 02-01-2007 17:21

Re: no-snap (why they don't work)
 
I tried all codes in this page but anything worked.

Edit:
Quote:

#include <amxmodx>
#include <amxmisc>
#include <fun>

#define PLUGIN "no-snap"
#define VERSION "1.0"
#define AUTHOR "Parchatek-b.pasz"


public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)
register_event("WeapPickup", "pod_bron", "be")
}
public pod_bron()
{
//new gracze[32]
new i
new id_bron
new a,b
for (i = 0; i < 33; i++)
{
if (is_user_connected(i))
{
id_bron = get_user_weapon (i,a,b)
if ((id_bron == CSW_AWP) || (id_bron == CSW_SCOUT))
{
strip_user_weapons(i)
client_print(i,print_chat,"wywal ta snajpere")
}
}

}
return PLUGIN_HANDLED
}



If is doing ONLY (if ((id_bron == CSW_AWP) || (id_bron == CSW_SCOUT))) when map start (i have only knife and pistol) and never after . Why?


All times are GMT -4. The time now is 00:44.

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