AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   scripting help.. (https://forums.alliedmods.net/showthread.php?t=49570)

SAMURAI16 01-07-2007 04:51

scripting help..
 
so i want to make an plugin but i need some help
I need an example to check if player is in walking, in jump and have an HE grenade in hand. And after i will add stuff .
Thanks

Salepate 01-07-2007 05:16

Re: scripting help..
 
If you mean :
player is walking Or jumping but in any case with a HE in hand. I guess it would be :
Code:
if ( (pev(id,pev_button) & IN_JUMP) || (pev(id,pev_button) & IN_FORWARD) ) {     new temp1,temp2;     if ( get_user_weapon(id,temp1,temp2) == 4 ) {         // Your Code     } }
Identity of the He Grenade is 4.
So it check if wearer is wearing a weapon with 4 as an id.
(in my case i'm only checking if the user is jumping or walking forward)

SAMURAI16 01-07-2007 05:19

Re: scripting help..
 
he grenade == 4 ok
But flashbang and smoke wich number have ? And how i can check if all action (jumping,walking, have gren in hand) durring 5 seconds for example

Salepate 01-07-2007 05:22

Re: scripting help..
 
Flashbang : 25
Smoke Grenade : 9
(amxconst.inc)
If you wanna check it on a duration the better way to do is to use PreThink and PostThink (and honnestly I've never used it atm). But with one of these two functions you can check every frame of the player, and in this case, you just have to set a variable to 1 When the user starts.
Set it to 0 if : 5 seconds are reached or the player stopped his movement.

SweatyBanana 01-07-2007 15:24

Re: scripting help..
 
Quote:

Originally Posted by Salepate (Post 424611)
If you mean :
player is walking Or jumping but in any case with a HE in hand. I guess it would be :
Code:
if ( (pev(id,pev_button) & IN_JUMP) || (pev(id,pev_button) & IN_FORWARD) ) { new temp1,temp2; if ( get_user_weapon(id,temp1,temp2) == 4 ) { // Your Code } }

Identity of the He Grenade is 4.
So it check if wearer is wearing a weapon with 4 as an id.
(in my case i'm only checking if the user is jumping or walking forward)

Make sure he knows its in client prethink next time..

Salepate 01-07-2007 17:28

Re: scripting help..
 
As I said, i've never used neither Prethink nor Posthink, and I don't know it works, So I could have say something wrong.

My mistake


All times are GMT -4. The time now is 22:19.

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