Raised This Month: $ Target: $400
 0% 

how can I make a plugin


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Damir
Member
Join Date: Jul 2006
Old 02-26-2007 , 16:38   how can I make a plugin
Reply With Quote #1

how can I make a plugin how can I make a plugin when all players have 250 in heal ?
Damir is offline
allenwr
Veteran Member
Join Date: Jan 2006
Location: The place where the karm
Old 02-26-2007 , 17:22   Re: how can I make a plugin
Reply With Quote #2

PHP Code:
#include <amxmodx>
#include <fun>
 
public plugin_ini() {
     
register_plugin("Allenwr","1.0","250 health")
     
register_event("ResetHUD","event_hud","b")
}
 
public 
event_hud(id) {
     if(!
is_user_alive(id))
         return 
PLUGIN_HANDEL;
     
     
set_user_health(id250)

__________________
Don't ever place an order with Vee Servers. This is why.
allenwr is offline
Send a message via ICQ to allenwr Send a message via Yahoo to allenwr
stupok
Veteran Member
Join Date: Feb 2006
Old 02-26-2007 , 18:16   Re: how can I make a plugin
Reply With Quote #3

This may not be the right way to detect a player's spawn for your mod.

Fixed:

Code:
#include <amxmodx> #include <fun> public plugin_init() {     register_plugin("Plugin name", "1.0", "Author")     register_event("ResetHUD", "event_ResetHUD", "be") } public event_ResetHUD(id)     set_user_health(id, 250)
stupok is offline
allenwr
Veteran Member
Join Date: Jan 2006
Location: The place where the karm
Old 02-26-2007 , 20:09   Re: how can I make a plugin
Reply With Quote #4

I am just doing a check on whether the user is alive or not, and what you did doesnt matter, it still works either way...
__________________
Don't ever place an order with Vee Servers. This is why.
allenwr is offline
Send a message via ICQ to allenwr Send a message via Yahoo to allenwr
Hawk552
AMX Mod X Moderator
Join Date: Aug 2005
Old 02-26-2007 , 21:40   Re: how can I make a plugin
Reply With Quote #5

Quote:
Originally Posted by allenwr View Post
I am just doing a check on whether the user is alive or not, and what you did doesnt matter, it still works either way...
It's actually quite important, you not only screwed up on plugin_init (called it plugin_ini, something the compiler wouldn't catch), but also on the return (where you not only screwed up on the typing, but the value itself too).

Don't return PLUGIN_HANDLED in ResetHUD. It blocks the event and probably crashes the server. At the very best, bad things can happen.
__________________
Hawk552 is offline
Send a message via AIM to Hawk552
allenwr
Veteran Member
Join Date: Jan 2006
Location: The place where the karm
Old 02-26-2007 , 21:42   Re: how can I make a plugin
Reply With Quote #6

I learned something... and the plugin_ini, my bad... typing and not reading.
__________________
Don't ever place an order with Vee Servers. This is why.
allenwr is offline
Send a message via ICQ to allenwr Send a message via Yahoo to allenwr
XxAvalanchexX
Veteran Member
Join Date: Oct 2004
Location: abort73.com
Old 02-26-2007 , 21:42   Re: how can I make a plugin
Reply With Quote #7

The return value in a register_event hook is ignored.
__________________
No longer around. Thanks your support, everyone! As always:
THIS ONES FOR YOU
3000 PTS
XxAvalanchexX is offline
Hawk552
AMX Mod X Moderator
Join Date: Aug 2005
Old 02-26-2007 , 21:46   Re: how can I make a plugin
Reply With Quote #8

Quote:
Originally Posted by XxAvalanchexX View Post
The return value in a register_event hook is ignored.
I'm reasonably sure that the event can be blocked by returning PLUGIN_HANDLED. Either way, the plugin_ini typo was important.
__________________
Hawk552 is offline
Send a message via AIM to Hawk552
XxAvalanchexX
Veteran Member
Join Date: Oct 2004
Location: abort73.com
Old 02-26-2007 , 22:15   Re: how can I make a plugin
Reply With Quote #9

It's register_message that can be blocked.
__________________
No longer around. Thanks your support, everyone! As always:
THIS ONES FOR YOU
3000 PTS
XxAvalanchexX is offline
Hawk552
AMX Mod X Moderator
Join Date: Aug 2005
Old 02-27-2007 , 06:57   Re: how can I make a plugin
Reply With Quote #10

Quote:
Originally Posted by XxAvalanchexX View Post
It's register_message that can be blocked.
Yep, my bad.
__________________
Hawk552 is offline
Send a message via AIM to Hawk552
Reply


Thread Tools
Display Modes

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 00:45.


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