AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Triggering function at round-end and giving multiple HE grenades (https://forums.alliedmods.net/showthread.php?t=246116)

EpicKiller 08-12-2014 04:49

Triggering function at round-end and giving multiple HE grenades
 
Hello! A friend of mine asked me for a VIP menu and I accepted doing it. But I need two elements that I'm not familiar with: I need to trigger a fuction at round-end and I need to give a player four HE grenades. How could I do that? Thanks in advance!

PreDominance 08-12-2014 05:27

Re: Triggering function at round-end and giving multiple HE grenades
 
Round end function.
For multiple nades...create a global array, say.. new numGivenNades[33];, and I'm not sure if you increment this with something like SendWeaponAnim() or if there's an actual greande_throw. There's a give command in the fun module that you can use here.

Flick3rR 08-12-2014 06:17

Re: Triggering function at round-end and giving multiple HE grenades
 
Just
PHP Code:

give_item(id"weapon_hegrenade")
cs_set_user_bpammo(idCSW_HEGRENADE4

You can hook logevent for round end and loop trough players there.

EpicKiller 08-12-2014 06:50

Re: Triggering function at round-end and giving multiple HE grenades
 
Quote:

Originally Posted by Flick3rR (Post 2182720)
Just
PHP Code:

give_item("weapon_hegrenade")
cs_set_user_bpammo(idCSW_HEGRENADE4

You can hook logevent for round end and loop trough players there.

Oh. Well, I never thought that that would work. Thank you, you made it a lot easier. :)

Nextra 08-12-2014 08:45

Re: Triggering function at round-end and giving multiple HE grenades
 
Quote:

Originally Posted by EpicKiller (Post 2182739)
Oh. Well, I never thought that that would work. Thank you, you made it a lot easier. :)

Note that this is different from giving a player 4 additional grenades. It enforces that the player has exactly 4 grenades instead. So if you want to add 4 (so the player can have 8 after two rounds for example) you need to do this:

PHP Code:

cs_set_user_bpammo(idCSW_HEGRENADEcs_get_user_bpammo(idCSW_HEGRENADE)) 


EpicKiller 08-12-2014 14:50

Re: Triggering function at round-end and giving multiple HE grenades
 
Quote:

Originally Posted by Nextra (Post 2182812)
Note that this is different from giving a player 4 additional grenades. It enforces that the player has exactly 4 grenades instead. So if you want to add 4 (so the player can have 8 after two rounds for example) you need to do this:

PHP Code:

cs_set_user_bpammo(idCSW_HEGRENADEcs_get_user_bpammo(idCSW_HEGRENADE)) 


That truly didn't cross my mind. Thank you, that's a really nice improvement to the plugin.

HamletEagle 08-13-2014 04:15

Re: Triggering function at round-end and giving multiple HE grenades
 
Quote:

Originally Posted by EpicKiller (Post 2183014)
That truly didn't cross my mind. Thank you, that's a really nice improvement to the plugin.

It's not an improvement for what Flicker posted, it's just something different.
Flicker's code set your he grenades to 4, no matter what ammount you have.
Nextra's code add to your actual ammount of he grenades 4. So you will have x+4


All times are GMT -4. The time now is 13:12.

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