Raised This Month: $ Target: $400
 0% 

Resupplied


Post New Thread Reply   
 
Thread Tools Display Modes
Plugin Info:     Modification:   Sven Coop        Category:   Gameplay       
Trent-Resnor
Member
Join Date: Jan 2007
Location: Ontario, Canada
Old 01-10-2007 , 00:46   Resupplied
Reply With Quote #1

RESUPPLIED
Version 0.8

Changes:
0.8 - Recoded around ResetHUD Loop - Thanks Teame06 and VEN
0.7 - Properly declared precache sound. - Thanks DoomBringer
0.6 - Corrected Code accordingly. - Thanks DoomBringer & Emp`
0.5 - Initial Post and release.

Test Resupplied Plugin:
209.160.72.191:27035 >> Sven-Coop Server

Running with AMX Mod X 1.76c... Earlier versions might be supported.

Modules:

Fun
Amxmodx

Purpose:
The purpose of resupplied, is to provide admins and or users with a new gameplay style. With resupplied, the admin will be able to turn on Spawn protection, which in many cases would help in those sven coop maps where the monsters and mobs spawn right beside or are camping in spawn. Not only is Spawn Protection a feature, but so is the Resupplying of ammo to the players. The resupply method is carried out the same way but instead of spawn protection, players will be able to get ammo bonuses on the field before spawn, to give them that extra kick to survive a little longer. The resupply code goes by a random number that is generated every time its called (by the timer). The players have 16 distinct chances to what they need, such as extra health, and extra ammo.

Cvars:
spawnprotection_timer <0 - 255> Default: 10.0
resupply_timer <0 - 255> Default: 60.0
----
Note: The timers can go higher then 255 (more like float values) it's just a suggested max and 0 disables the timer, meaning it will and would be turned off.

Note: Cleaned up the code abit according to emps` & Doombringers suggestions.

Attached Files
File Type: sma Get Plugin or Get Source (resupplied.sma - 1009 views - 2.5 KB)
__________________

Last edited by Trent-Resnor; 01-11-2007 at 23:14. Reason: Update/Code Corrections
Trent-Resnor is offline
Send a message via MSN to Trent-Resnor
Emp`
AMX Mod X Plugin Approver
Join Date: Aug 2005
Location: Decapod 10
Old 01-10-2007 , 01:24   Re: Resupplied
Reply With Quote #2

clean up code a bit (use switches and don't set a task of 0.0)

also for resupply (not sure how SC works, if there are more than 1 resethud events) you should either A: check if the task exists already for that player and don't make a new task or B: check if the task exists for that player and remove the old task

edit: also doesn't look like you need to include amxmisc
Emp` is offline
Send a message via AIM to Emp` Send a message via MSN to Emp` Send a message via Yahoo to Emp` Send a message via Skype™ to Emp`
Trent-Resnor
Member
Join Date: Jan 2007
Location: Ontario, Canada
Old 01-10-2007 , 07:41   Re: Resupplied
Reply With Quote #3

There we go, re uploaded. Not sure if I corrected the A: check if the task exists already for that player and don't make a new task. But I did fix the rest of the code according to your suggestions emp`, switch instead of if statements and thanks for pointing out that i didn't need amxmisc also the task of 0.0 should be changed to 1.0. Thanks.
__________________
Trent-Resnor is offline
Send a message via MSN to Trent-Resnor
Deviance
Veteran Member
Join Date: Nov 2004
Location: Sweden
Old 01-10-2007 , 08:21   Re: Resupplied
Reply With Quote #4

Code:
public spawn_protection_on(id) {     if(is_user_alive(id)) {         set_user_godmode(id,1)         set_hudmessage(212, 255, 255, 0.58, 0.0, 0, 6.0, get_cvar_float("spawnprotection_timer"), 2.0)         show_hudmessage(id, "SPAWN PROTECTION")         set_task(get_cvar_float("spawnprotection_timer"),"spawn_protection_off",id)         set_user_rendering(id,kRenderFxGlowShell,0,255,0,kRenderNormal,25)     } }
Should be
Code:
public spawn_protection_on(id) {     if(is_user_alive(id)) {         set_user_godmode(id,1)         set_hudmessage(212, 255, 255, 0.58, 0.0, 0, 6.0, get_pcvar_float(spawn_protect), 2.0)         show_hudmessage(id, "SPAWN PROTECTION")         set_task(get_pcvar_float(spawn_protect),"spawn_protection_off",id)         set_user_rendering(id,kRenderFxGlowShell,0,255,0,kRenderNormal,25)     } }
Also you can't call precache_sound() inside plugin_init(), you need to use plugin_precache().
Deviance is offline
Trent-Resnor
Member
Join Date: Jan 2007
Location: Ontario, Canada
Old 01-10-2007 , 08:31   Re: Resupplied
Reply With Quote #5

Thanks for pointing those out. Greatly appreciated !
__________________
Trent-Resnor is offline
Send a message via MSN to Trent-Resnor
Deviance
Veteran Member
Join Date: Nov 2004
Location: Sweden
Old 01-10-2007 , 10:30   Re: Resupplied
Reply With Quote #6

Code:
public spawn_protection_off(id) {     if(is_user_alive(id)) {         precache_sound("items/suitchargeok1.wav")         set_user_godmode(id,0)         set_user_rendering(id,kRenderFxNone,0,0,0,kRenderNormal,25)         emit_sound(0,CHAN_AUTO,"items/suitchargeok1.wav",1.0,ATTN_NORM,0,PITCH_NORM)     } }
You can't use precache_sound() like this. You have to use it in plugin_precache()

Code:
public plugin_precache() {     precache_sound("items/suitchargeok1.wav") }
Deviance is offline
Trent-Resnor
Member
Join Date: Jan 2007
Location: Ontario, Canada
Old 01-10-2007 , 12:39   Re: Resupplied
Reply With Quote #7

Thanks for that correction !
__________________
Trent-Resnor is offline
Send a message via MSN to Trent-Resnor
VEN
Veteran Member
Join Date: Jan 2005
Old 01-10-2007 , 15:29   Re: Resupplied
Reply With Quote #8

  1. Do you aware that for every alive player every HUD reset you creating an additional loop task?
  2. Why would you want to emit a sound on all clients while your protection function is for a specific client?

Last edited by VEN; 01-10-2007 at 15:33.
VEN is offline
Trent-Resnor
Member
Join Date: Jan 2007
Location: Ontario, Canada
Old 01-10-2007 , 16:46   Re: Resupplied
Reply With Quote #9

Thanks for pointing that out ven.
__________________
Trent-Resnor is offline
Send a message via MSN to Trent-Resnor
Emp`
AMX Mod X Plugin Approver
Join Date: Aug 2005
Location: Decapod 10
Old 01-10-2007 , 19:53   Re: Resupplied
Reply With Quote #10

you should just do
Code:
	new health=get_user_health(id)
//..skip a few lines
			case 15: { set_user_health(id, health+10); }
			case 16: { set_user_health(id, health+5); }
instead of getting their health twice

Last edited by Emp`; 01-10-2007 at 20:37. Reason: apparently, task_exists is slow
Emp` is offline
Send a message via AIM to Emp` Send a message via MSN to Emp` Send a message via Yahoo to Emp` Send a message via Skype™ to Emp`
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 20:32.


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