Raised This Month: $ Target: $400
 0% 

Help [Plugin]


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
happycappy
Junior Member
Join Date: May 2006
Location: NL
Old 07-10-2006 , 15:12   Help [Plugin]
Reply With Quote #1

Its the first time im making a plugin, so don't be to hard on me
Im trying to make a plugin to punish people saying lol, so its the SayLolGetSlap plugin. But because its the first time, i screwed something up so it doesnt work.
I used rolnaaba's script , http://forums.alliedmods.net/showthread.php?t=41148 , but im stuck on something , instead of getting hp in that plugin, i wanted to let someone lose hp, so what did i do? I changed the number of health to -1. But somehow, when im testing it, and i say lol, my hp doesnt goes down, and i cant activate it. The other problem is, the slapping effect, if i use this script there wont be slapped, but just -1 hp, so could someone help me with that? Here's the code:
Code:
#include <amxmodx> #include <amxmisc> #include <fun> public plugin_init() {     register_plugin("Say Lol And Get Slapped", "1.0", "eXec")     register_concmd("say lol", "lol")     register_cvar("slaplol_on", "1") } public func_gethp(id) {     if(get_cvar_num("slaplol_on") == 0)     {         return PLUGIN_HANDLED     }         else     {         set_user_health(id, get_user_health(id) - 1)         return PLUGIN_HANDLED     }     return PLUGIN_HANDLED     }
__________________
7331

Last edited by happycappy; 07-10-2006 at 15:13. Reason: Typo
happycappy is offline
Rolnaaba
Veteran Member
Join Date: May 2006
Old 07-10-2006 , 15:22   Re: Help [Plugin]
Reply With Quote #2

Simple use the user_slap comand and set the power to 1
Your Plugin with user_slap:
Code:
#include <amxmodx> #include <amxmisc> #include <fun> public plugin_init() {     register_plugin("Say Lol And Get Slapped", "1.0", "eXec")     register_concmd("say lol", "lol")     register_cvar("slaplol_on", "1") } public func_gethp(id) {     if(get_cvar_num("slaplol_on") == 0)     {         return PLUGIN_HANDLED     }         else     {  user_slap(id,1,rnddir=1)         return PLUGIN_HANDLED     }     return PLUGIN_HANDLED     }
that will slap the player and subtract 1 point of damage from their health
__________________
DO NOT PM me about avp mod.
Rolnaaba is offline
Hawk552
AMX Mod X Moderator
Join Date: Aug 2005
Old 07-10-2006 , 15:24   Re: Help [Plugin]
Reply With Quote #3

Don't read his tutorial. It sucks. Seriously. Read another one.

But for a quick fix,

Code:
#include <amxmodx> #include <amxmisc> #include <fun>   public plugin_init() {         register_plugin("Say Lol And Get Slapped", "1.0", "eXec")         register_concmd("say lol", "lol")         register_cvar("slaplol_on", "1") } public lol(id)     if(get_cvar_num("slaplol_on"))         set_user_health(id, get_user_health(id) - 1)
__________________
Hawk552 is offline
Send a message via AIM to Hawk552
Des12
Senior Member
Join Date: Jan 2005
Old 07-10-2006 , 16:12   Re: Help [Plugin]
Reply With Quote #4

If you didnt understand that,

your register:
register_concmd("say lol", "lol")

your function:
public func_gethp(id)

you need the second argument to match the function, as Hawk showed

so:

register_concmd("say lol", "func_gethp")

public func_gethp(id)
__________________
-Dest Romano

www.JustRP.com
A TSRP Server

Quote:
Originally Posted by Brad
Don't you go be bringing reality into this.
Des12 is offline
Rolnaaba
Veteran Member
Join Date: May 2006
Old 07-10-2006 , 16:23   Re: Help [Plugin]
Reply With Quote #5

hawk he can get the subtraction of hp to work the whole problem was it didnt slap the person so what you posted only fixs a typo i wrote and does nothing to help his problem
Code:
#include <amxmodx> #include <amxmisc> #include <fun>   public plugin_init() {         register_plugin("Say Lol And Get Slapped", "1.0", "eXec")         register_concmd("say lol", "lol")         register_cvar("slaplol_on", "1") } public lol(id)     if(get_cvar_num("slaplol_on"))         user_slap(id,1)
will work
__________________
DO NOT PM me about avp mod.
Rolnaaba is offline
Hawk552
AMX Mod X Moderator
Join Date: Aug 2005
Old 07-10-2006 , 16:46   Re: Help [Plugin]
Reply With Quote #6

Actually both work, and it's not a typo, you made a horribly inefficient script. I really wish you'd just stop helping people until you really understand Pawn, because right now you don't, and you're misleading so many people that way.
__________________
Hawk552 is offline
Send a message via AIM to Hawk552
v3x
Veteran Member
Join Date: Oct 2004
Location: US
Old 07-10-2006 , 18:36   Re: Help [Plugin]
Reply With Quote #7

Quote:
Originally Posted by Hawk552
Actually both work, and it's not a typo, you made a horribly inefficient script. I really wish you'd just stop helping people until you really understand Pawn, because right now you don't, and you're misleading so many people that way.
Exactly. Couldn't of put it in better words myself ;)
__________________
What am I doing these days? Well, I run my own Rust server. It's heavily modded. If you'd like to join, the ip is 167.114.101.67:28116

I also created a website called Rust Tools. It will calculate and tell you the raw amounts of resources needed to craft items.
v3x is offline
Rolnaaba
Veteran Member
Join Date: May 2006
Old 07-10-2006 , 20:14   Re: Help [Plugin]
Reply With Quote #8

hawk on ur post all u did was fix my typo of typing:
Code:
public func_gethp()
instead
Code:
public lol()
this was what i was speaking of
__________________
DO NOT PM me about avp mod.
Rolnaaba is offline
Hawk552
AMX Mod X Moderator
Join Date: Aug 2005
Old 07-10-2006 , 20:22   Re: Help [Plugin]
Reply With Quote #9

Quote:
Originally Posted by Rolnaaba
hawk on ur post all u did was fix my typo of typing:
Code:
public func_gethp()

instead
Code:
public lol()

this was what i was speaking of
Yes, that's a typo, but your script was still horribly inefficient. As I said, just stop helping people until you actually learn how to script.
__________________
Hawk552 is offline
Send a message via AIM to Hawk552
happycappy
Junior Member
Join Date: May 2006
Location: NL
Old 07-11-2006 , 04:33   Re: Help [Plugin]
Reply With Quote #10

Thank you very much guys You really helped me out

Edit: Ok, now the next thing actually is, that when he get slapped of saying lol, i want to be said : "Player" got slapped because he said lol. How to do that? I know i got t learn scripting myself, but please show me .

Btw, in the script there is PLUGIN_HANDLED, shouldnt it be PLUGIN_CONTINOUED?
__________________
7331

Last edited by happycappy; 07-11-2006 at 04:45. Reason: Typo
happycappy is offline
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 08:05.


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