Help with first work
Hello im making my first plugin and i need some advice on it
main idea is that admin write in chat hp <name> <hpamount> and it gives how to make it what am doing wrong? i know that i can make it with set_task but then i cant enter specified amount please as much simplest solution Code:
public plugin_init() { |
Re: [how to]
You will have to hook client_cmd say and say_team, then to read the argvs, remove quotes and parse. The get second arg of the command to be a target and get it's index. Then do what you want. I'll post an example code later.
|
Re: [how to]
Thank you post please , i will try method as you explained
|
Re: [how to]
Code:
don't forget to add admin check, and check for syntax error if there is no value |
Re: [how to]
i get :
Error: Array must be indexed (variable "szValue") on line 37 btw if you can please comment every step you write it will be easier for me to understand , thnx. im defined color_chat that is ok ? because before defining i was getting error undefined symbol , now im getting : Warning: Expression has no effect on line 25 |
Re: [how to]
Tested and works. I used the colorchat.inc, because it was much easier. If you want, you could replace the ColorMessages with whatever you want, doesn't matter for the functions. I think I explained the important stuff in the code. Take a look :)
PHP Code:
|
Re: [how to]
Thank you very much but i discovered bug when was testing for ex. when im writing hp botname amount it gives hp not for bot but for me :D its after removing checking of admin and one more question how to insert this code in plugin that would work together in chat( i want make same command but only slay)
its from admincmd im trying to do : register_clcmd("say","Slay") register_clcmd("say","Slay") it compiles but wont work Code:
new arg[32] |
Re: [how to]
Just wrong index of giving HP function, fixed! Just insert these functions to your code in cmd say and say_team
|
Re: [how to]
I knew that there is mistake with index but where dont know :D so where it should be? :D
and about slay , i tryed that method you said but it wont worked i dont know why maybe there is need to call amx_slay on target , do you have ideas? |
Re: [how to]
I fixed the index mistake in the code above.
For the slay - if you are trying to do another thing, different of that command with giving HP, better make a new thread and explain more. For slaying user, use user_kill(id, 1). And you may make it with chat command, of course. |
| All times are GMT -4. The time now is 09:35. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.