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

!stuck command [help]


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Paparazziv2
Senior Member
Join Date: Feb 2011
Location: Chile, La Serena
Old 09-20-2011 , 14:41   !stuck command [help]
Reply With Quote #1

Hi, i create my first plugin, but i need help with this. i need when the players say !stuck uses the slap with 0 damage of RegAdminCmd, and i need this with this:
- The player have 3 opportunities of use for this command (1/3) (2/3) (3/3) and no more.

really, my work has not been anything since right out of a tutorial and change three things and nothing more than that. But I am very motivated to learn about this world of script.
I have this done:
Code:
#include <sourcemod>
#include <sdktools>
 
new Handle:sm_myslap_damage = INVALID_HANDLE
 
public Plugin:myinfo =
{
    name = "Unstuck players with a cmd",
    author = "pAPARAZi",
    description = "Untuck players with a command (!stuck).",
    version = "1.0",
    url = "http://www.sourcemod.net/"
}
 
public OnPluginStart()
{
    LoadTranslations("common.phrases")
    RegAdminCmd("sm_myslap", Command_MySlap, ADMFLAG_SLAY)
 
    sm_myslap_damage = CreateConVar("sm_stuck", "0", "Default slap damage")
    AutoExecConfig(true, "plugin_antistuck")
}
 
public Action:Command_MySlap(client, args)
{
    new String:arg1[32], String:arg2[32]
    new damage = GetConVarInt(sm_myslap_damage)
 
    /* Get the first argument */
    GetCmdArg(1, arg1, sizeof(arg1))
 
    /* If there are 2 or more arguments, and the second argument fetch 
     * is successful, convert it to an integer.
     */
    if (args >= 2 && GetCmdArg(2, arg2, sizeof(arg2)))
    {
        damage = StringToInt(arg2)
    }
 
    /**
     * target_name - stores the noun identifying the target(s)
     * target_list - array to store clients
     * target_count - variable to store number of clients
     * tn_is_ml - stores whether the noun must be translated
     */
    new String:target_name[MAX_TARGET_LENGTH]
    new target_list[MAXPLAYERS], target_count
    new bool:tn_is_ml
 
    if ((target_count = ProcessTargetString(
            arg1,
            client,
            target_list,
            MAXPLAYERS,
            COMMAND_FILTER_ALIVE, /* Only allow alive players */
            target_name,
            sizeof(target_name),
            tn_is_ml)) <= 0)
    {
        /* This function replies to the admin with a failure message */
        ReplyToTargetError(client, target_count);
        return Plugin_Handled;
    }
 
    for (new i = 0; i < target_count; i++)
    {
        SlapPlayer(target_list[i], damage)
        LogAction(client, target_list[i], "\"%L\" slapped \"%L\" (damage %d)", client, target_list[i], damage)
    }
 
    if (tn_is_ml)
    {
        ShowActivity2(client, "[SM] ", "Slapped %t for %d damage!", target_name, damage)
    }
    else
    {
        ShowActivity2(client, "[SM] ", "Slapped %s for %d damage!", target_name, damage)
    }
 
    return Plugin_Handled;
}
__________________
Sorry for the bad english please.

Paparazziv2 is offline
Send a message via MSN to Paparazziv2
Antithasys
Moderator
Join Date: Apr 2008
Old 09-20-2011 , 15:00   Re: !stuck command [help]
Reply With Quote #2

Try this. Untested.
Attached Files
File Type: sp Get Plugin or Get Source (antistuck.sp - 444 views - 1.1 KB)
__________________
[my plugins]

When you think about asking a question... consider what have you tried?
Antithasys is offline
Paparazziv2
Senior Member
Join Date: Feb 2011
Location: Chile, La Serena
Old 09-20-2011 , 17:43   Re: !stuck command [help]
Reply With Quote #3

__________________
Sorry for the bad english please.

Paparazziv2 is offline
Send a message via MSN to Paparazziv2
Antithasys
Moderator
Join Date: Apr 2008
Old 09-20-2011 , 18:05   Re: !stuck command [help]
Reply With Quote #4

Have some since I have no idea what your reply means.
__________________
[my plugins]

When you think about asking a question... consider what have you tried?
Antithasys is offline
TnTSCS
AlliedModders Donor
Join Date: Oct 2010
Location: Undisclosed...
Old 09-20-2011 , 18:38   Re: !stuck command [help]
Reply With Quote #5

I think if a player is stuck in a prop, or to another player, slapping won't move them - they're stuck... I usually either unbury them or respawn them, save the location I'm standing on, then teleport them (after I've moved a bit)
TnTSCS is offline
Paparazziv2
Senior Member
Join Date: Feb 2011
Location: Chile, La Serena
Old 09-20-2011 , 20:21   Re: !stuck command [help]
Reply With Quote #6

Quote:
Originally Posted by Antithasys View Post
Have some since I have no idea what your reply means.
waiting for a response as a correction, learning something towards .. thank you very much for the plugin but I wanted to learn thanks
__________________
Sorry for the bad english please.

Paparazziv2 is offline
Send a message via MSN to Paparazziv2
Antithasys
Moderator
Join Date: Apr 2008
Old 09-20-2011 , 22:55   Re: !stuck command [help]
Reply With Quote #7

Quote:
Originally Posted by Paparazziv2 View Post
waiting for a response as a correction, learning something towards .. thank you very much for the plugin but I wanted to learn thanks
Well I didn't comment it, and it should be a good exercise to try to read it and understand why I did what I did.

You could then apply the principles and make a different plugin.
__________________
[my plugins]

When you think about asking a question... consider what have you tried?
Antithasys 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 15:31.


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