Raised This Month: $51 Target: $400
 12% 

[req] pray plugin


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
xxxperts
Senior Member
Join Date: Oct 2013
Location: India
Old 11-20-2013 , 07:22   [req] pray plugin
Reply With Quote #1

today i gone in one sv " 103.2.238.246:27019" their was a plugin name pray, when i am dead and spectating the player and when i type "/pray" then player get 20 HP health but maximum life of player is 100HP this can be used only once for one player, after praying player in chat is comes "my cs user name" has just prayed for "name of player to whom i am spectating" if their is any plugin like this then plz give name or link & if not then plz make this plugin....
xxxperts is offline
Moody92
Veteran Member
Join Date: May 2011
Location: Oman
Old 11-20-2013 , 12:06   Re: [req] pray plugin
Reply With Quote #2

Explain more ?
Moody92 is offline
joshknifer
Veteran Member
Join Date: Jun 2011
Location: Denver, CO
Old 11-20-2013 , 12:36   Re: [req] pray plugin
Reply With Quote #3

Spectators can say /pray and whoever they are spectating gets +20HP. Each player spectating can use it once per round, and only on one person. Max HP stays at 100. Then he wants a print saying who gave and recieved the hp
__________________
joshknifer is offline
Send a message via Skype™ to joshknifer
Moody92
Veteran Member
Join Date: May 2011
Location: Oman
Old 11-20-2013 , 13:15   Re: [req] pray plugin
Reply With Quote #4

I am not familiar with the 'targeting the spectator guy' method if it does exist.
Here what I have done. Not sure if it works or not as it's been a long time since I last used AMXX-Studio

You can pray to someone when you're dead/spectator by typing /pray <name of the player>

PHP Code:
/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <amxmisc>
#include <fun>
#include <cstrike>

#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "author"

new prayed[33]
new 
Health2
public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
register_event("HLTV""NewRound""a""1=0""2=0")  
    
Health2 register_cvar("amx_pray_health""20")
    
    
register_clcmd("/pray""pray")

}

public 
NewRound(id){
    
prayed[id] = 0
}

public 
pray(id){
    
    if(
is_user_alive(id)){
        
client_print(idprint_chat"You cannot use /pray because you are alive")
    }
    else if(
prayed[id] == 1){
        
client_print(idprint_chat"You can only use /pray once per round, please try the next round")
    }
    
    
prayed[id] = 1
    
    
new arg[20]
    
read_argv(1arg19)

    new 
Health get_user_health(id)
    new 
player cmd_target(idarg1)
    new 
name[32]
    
get_user_name(idnamecharsmax(name))
    new 
name2[32]
    
get_user_name(playername2charsmax(name2))
    
    if (!
player)
    {
        
client_print(idprint_chat"[AMXX] Sorry, player %s could not be found or targetted!"arg)
        return 
PLUGIN_HANDLED
    

    else {
        
set_user_health(playerHealth Health2)
        
client_print(0print_chat"%s has just prayed for %s"namename2)
    }
 
    return 
PLUGIN_HANDLED


Last edited by Moody92; 11-20-2013 at 13:27.
Moody92 is offline
xxxperts
Senior Member
Join Date: Oct 2013
Location: India
Old 11-20-2013 , 23:01   Re: [req] pray plugin
Reply With Quote #5

moody i have an idea..!, u can use set_task for giving health and after the i use /pray and if the target dead than

client_print(id, print_chat, "Aww! %s has Diead Before Your Prayer Completed ", name2)

Last edited by xxxperts; 11-20-2013 at 23:01.
xxxperts is offline
OWNX
BANNED
Join Date: Nov 2013
Location: Usa
Old 11-20-2013 , 23:12   Re: [req] pray plugin
Reply With Quote #6

and a sound as long you pray will be awsome
OWNX is offline
Send a message via ICQ to OWNX Send a message via AIM to OWNX Send a message via Yahoo to OWNX Send a message via Skype™ to OWNX
Moody92
Veteran Member
Join Date: May 2011
Location: Oman
Old 11-24-2013 , 16:14   Re: [req] pray plugin
Reply With Quote #7

Quote:
Originally Posted by xxxperts View Post
moody i have an idea..!, u can use set_task for giving health and after the i use /pray and if the target dead than

client_print(id, print_chat, "Aww! %s has Diead Before Your Prayer Completed ", name2)
Could you explain more ?

The plugin I posted has many bugs that I noticed after revising it.
Due to my short free time, if anyone wants to edit the plugin I posted he is free to do that.
Moody92 is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 11-24-2013 , 16:47   Re: [req] pray plugin
Reply With Quote #8

@Moody92

You should learn :

- how to use cvars pointers
- how to hook global events

-> pointers doesn't hold cvar value
-> global events don't pass any player index

Those mistake are basic mistakes.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
Moody92
Veteran Member
Join Date: May 2011
Location: Oman
Old 11-25-2013 , 04:58   Re: [req] pray plugin
Reply With Quote #9

Quote:
Originally Posted by ConnorMcLeod View Post
@Moody92

You should learn :

- how to use cvars pointers
- how to hook global events

-> pointers doesn't hold cvar value
-> global events don't pass any player index

Those mistake are basic mistakes.

Thank you for your observations, I understand the meaning of what you just said. I'll edit the plugin as soon as possible
I'll look out for more tutorials regarding this matter as I am not a literally coder

Last edited by Moody92; 11-25-2013 at 05:05.
Moody92 is offline
Shooting King
RAAASENGAN
Join Date: Mar 2012
Location: India
Old 11-25-2013 , 08:03   Re: [req] pray plugin
Reply With Quote #10

Pray

PHP Code:
#include <amxmodx>
#include <engine>

#define PLUGIN        "Pray Plugin"
#define VERSION        "1.0"
#define AUTHOR        "Shooting King"

#define TASK_PRAY    78238

new bool:HasPrayed[33][2];
new 
pCvar_Hp;

public 
plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR);
    
register_clcmd("say /pray""cmd_GiveHp");
    
register_clcmd("say_team /pray""cmd_GiveHp");

    
pCvar_Hp register_cvar("amx_sk_pray_hp""20");
    
    
register_event("HLTV""event_NewRound""a""1=0""2=0");
}

public 
event_NewRound()
{
    for(new 
i=133i++)
    {
        
HasPrayed[i][1] = false;
        
HasPrayed[i][0] = false;
    }
}

public 
client_putinserver(id)
{
    
HasPrayed[id][1] = false;
    
HasPrayed[id][0] = false;
}

public 
cmd_GiveHp(id)
{
    static 
iSpecModeiSpecPlayerszName[32], szSpecName[32], izParam[1];
    
    
iSpecMode entity_get_int(idEV_INT_iuser1);
    if(
iSpecMode == || iSpecMode == 3)
    {
        
client_printidprint_chat"You are not Spectating a player." );
        return 
PLUGIN_CONTINUE;
    }
    
    if(
HasPrayed[id][0])
    {
        
client_printidprint_chat"You have to wait for 2.5 seconds." );
        return 
PLUGIN_CONTINUE;
    }
    
    if(
HasPrayed[id][1])
    {
        
client_printidprint_chat"You have already prayed this round." );
        return 
PLUGIN_CONTINUE;
    }
    
    
iSpecPlayer entity_get_int(idEV_INT_iuser2);
    if(
entity_get_float(iSpecPlayerEV_FL_health) == 100.0)
    {    
        
client_printidprint_chat"The Player you are spectating already has 100 Hp." );
        return 
PLUGIN_CONTINUE;
    }
    
    
get_user_nameidszNamecharsmax(szName));
    
get_user_nameiSpecPlayerszSpecNamecharsmax(szSpecName));
    
    
client_print0print_chat"%s has just prayed for %s."szNameszSpecName);
    
izParam[0] = iSpecPlayer;
    
HasPrayed[id][0] = true;
    
set_task2.5"Pray", (TASK_PRAY+id), izParam1);
    return 
PLUGIN_CONTINUE;
}

public 
Prayparam[1], id )
{
    
id -= TASK_PRAY;
    static 
Float:flCvarHealthFloat:flHealthFloat:flRemPlayerHealth;    
    
    
flRemPlayerHealth 100.0-entity_get_float(param[0], EV_FL_health);
    
    if( 
is_user_alive(param[0]) && (flRemPlayerHealth 0.0))
    {    
        
flCvarHealth get_pcvar_float(pCvar_Hp);
        
flHealth = ( flRemPlayerHealth >= flCvarHealth )? flCvarHealth:flRemPlayerHealth;
        
        
entity_set_float(param[0], EV_FL_healthentity_get_float(param[0], EV_FL_health)+flHealth);
        
HasPrayed[id][1] = true;
    }
    
HasPrayed[id][0] = false;

Cvars:
amx_sk_pray_hp <health> Default: 20
Attached Files
File Type: sma Get Plugin or Get Source (pray.sma - 669 views - 2.4 KB)
__________________
As every time said, don't ever UNDERESTIMATE me.

Donate - Here

Last edited by Shooting King; 11-25-2013 at 08:05.
Shooting King 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 09:36.


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