AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Modify amx_llama (https://forums.alliedmods.net/showthread.php?t=92885)

MasterAdy 05-21-2009 14:58

Modify amx_llama
 
Code:

/* AMX Mod script.
*
* Admin Llama 1.4
*  by SniperBeamer
*
*
* Usage:
*  amx_llama <authid, nick, @team or #userid>
*  amx_unllama <authid, nick, @team or #userid>
* Settings:
*  amx_llamasound 0/1
* Example:
*  amx_llama @CT
*  amx_unllama SniperBeamer
*
* This file is provided as is (no warranties).
*
*/

//----------------------------------------------------------------------------------------------
#include <amxmodx>
#include <amxmisc>
//----------------------------------------------------------------------------------------------
#define MESSAGES 4
//----------------------------------------------------------------------------------------------
new llama_msg[MESSAGES][] = {
    "Ooorgle!",
    "Bleeeat!",
    "Brawwrr!",
    "Muuuuuh!"
}
new llama_sound[MESSAGES][] = {
    "misc/ooorgle.wav",
    "misc/bleeeat.wav",
    "misc/brawwrr.wav",
    "misc/cow.wav"
}
new bool:ids[33]
new pName[33][32]
//----------------------------------------------------------------------------------------------
public plugin_init()
{
    register_plugin("AMX Llama","1.4","SniperBeamer")
    register_cvar("amx_llamasound","1")
    register_concmd("amx_llama","llama",ADMIN_LEVEL_A,"- <authid, nick, @team or #userid>")
    register_concmd("amx_unllama","unllama",ADMIN_LEVEL_A,"- <authid, nick, @team or #userid>")
}
//----------------------------------------------------------------------------------------------
public plugin_precache()
{
    register_clcmd("say","check_say")
    register_clcmd("say_team","check_say")
    for (new i=0; i<MESSAGES; i++)
        precache_sound(llama_sound[i])
}
//----------------------------------------------------------------------------------------------
public llama(id,level,cid)
{
    if (!cmd_access(id,level,cid,2))
        return PLUGIN_HANDLED

    new arg[32]
    read_argv(1,arg,31)

    if (arg[0]=='@'){
        new plist[32],pnum
        get_players(plist,pnum,"e",arg[1])
        if (pnum==0){
            console_print(id,"No clients in such team")
            return PLUGIN_HANDLED
        }
        for (new i=0; i<pnum; i++){
            if (!(get_user_flags(plist[i])&ADMIN_IMMUNITY)&&!ids[plist[i]])
            {
                get_user_name(plist[i],pName[plist[i]],31)
                ids[plist[i]] = true
                client_cmd(plist[i],"name Llama")
            }
        }
        console_print(id,"[AMXX] You Llamed %s",arg[1])
    }
    else{
        new target = cmd_target(id,arg,3)
        if (!target || ids[target]) return PLUGIN_HANDLED
        ids[target] = true
        get_user_name(target,pName[target],31)
        console_print(id,"[AMXX] You Llamed %s",pName[target])
        client_cmd(target,"name Llama")
    }

    return PLUGIN_HANDLED
}
//----------------------------------------------------------------------------------------------
public unllama(id,level,cid)
{
    if (!cmd_access(id,level,cid,2))
        return PLUGIN_HANDLED

    new arg[32]
    read_argv(1,arg,31)

    if (arg[0]=='@'){
        new plist[32],pnum
        get_players(plist,pnum,"e",arg[1])
        if (pnum==0){
            console_print(id,"No clients in such team")
            return PLUGIN_HANDLED
        }
        for (new i=0; i<pnum; i++){
            if (!(get_user_flags(plist[i])&ADMIN_IMMUNITY)&&ids[plist[i]])
            {
                ids[plist[i]] = false
                client_cmd(ids[plist[i]],"name %s",pName[plist[i]])
            }
        }
        console_print(id,"[AMXX] You un-Llamed %s",arg[1])
    }
    else{
        new target = cmd_target(id,arg,3)
        if (!target || !ids[target]) return PLUGIN_HANDLED
        ids[target] = false
        client_cmd(target,"name %s",pName[target])
        console_print(id,"[AMXX] un-Llamed %s",pName[target])
    }

    return PLUGIN_HANDLED
}
//----------------------------------------------------------------------------------------------
public check_say(id)
{
    if (!ids[id]) return PLUGIN_CONTINUE

    new said[32]
    read_args(said,31)
    remove_quotes(said)
    for (new i=0; i<MESSAGES; i++)
        if(equal(said,llama_msg[i]))
            return PLUGIN_CONTINUE

    new ran = random_num(0,MESSAGES-1)
    client_cmd(id,"say %s",llama_msg[ran])
    if (get_cvar_num("amx_llamasound")) client_cmd(id,"spk %s",llama_sound[ran])

    return PLUGIN_HANDLED
}
//----------------------------------------------------------------------------------------------
public client_connect(id)
{
    ids[id] = false
}
//----------------------------------------------------------------------------------------------
public client_infochanged(id)
{
    if (!ids[id]) return PLUGIN_HANDLED
    new Name[32]
    get_user_name(id,Name,31)
    if (!contain(Name,"Llama")) client_cmd(id,"name Llama")

    return PLUGIN_HANDLED
}
//----------------------------------------------------------------------------------------------

This is the code by SniperBeamer , can someone include in this plugin a client_cmd or print_chat to show the admin that uses this ?
I tried myself but no luck .
Thanks in advance .

ot_207 05-21-2009 19:19

Re: Modify amx_llama
 
log_to_file()
PHP Code:

client_print(0print_chat"ADMIN %s: LLAMA %s"nametarget_name


MasterAdy 05-24-2009 07:23

Re: Modify amx_llama
 
Well , i`m not that noob .

Code:

/* AMX Mod script.
*
* Admin Llama 1.4
*  by SniperBeamer
*
*
* Usage:
*  amx_llama <authid, nick, @team or #userid>
*  amx_unllama <authid, nick, @team or #userid>
* Settings:
*  amx_llamasound 0/1
* Example:
*  amx_llama @CT
*  amx_unllama SniperBeamer
*
* This file is provided as is (no warranties).
*
*/

//----------------------------------------------------------------------------------------------
#include <amxmodx>
#include <amxmisc>
//----------------------------------------------------------------------------------------------
#define MESSAGES 4
//----------------------------------------------------------------------------------------------
new llama_msg[MESSAGES][] = {
    "Ooorgle!",
    "Bleeeat!",
    "Brawwrr!",
    "Muuuuuh!"
}
new llama_sound[MESSAGES][] = {
    "misc/ooorgle.wav",
    "misc/bleeeat.wav",
    "misc/brawwrr.wav",
    "misc/cow.wav"
}
new bool:ids[33]
new pName[33][32]
//----------------------------------------------------------------------------------------------
public plugin_init()
{
    register_plugin("AMX Llama","1.4","SniperBeamer")
    register_cvar("amx_llamasound","1")
    register_concmd("amx_llama","llama",ADMIN_LEVEL_A,"- <authid, nick, @team or #userid>")
    register_concmd("amx_unllama","unllama",ADMIN_LEVEL_A,"- <authid, nick, @team or #userid>")
}
//----------------------------------------------------------------------------------------------
public plugin_precache()
{
    register_clcmd("say","check_say")
    register_clcmd("say_team","check_say")
    for (new i=0; i<MESSAGES; i++)
        precache_sound(llama_sound[i])
}
//----------------------------------------------------------------------------------------------
public llama(id,level,cid)
{
    if (!cmd_access(id,level,cid,2))
        return PLUGIN_HANDLED

    new arg[32]
    read_argv(1,arg,31)

    if (arg[0]=='@'){
        new plist[32],pnum
        get_players(plist,pnum,"e",arg[1])
        if (pnum==0){
            console_print(id,"No clients in such team")
            return PLUGIN_HANDLED
        }
        for (new i=0; i<pnum; i++){
            if (!(get_user_flags(plist[i])&ADMIN_IMMUNITY)&&!ids[plist[i]])
            {
                get_user_name(plist[i],pName[plist[i]],31)
                ids[plist[i]] = true
                client_cmd(plist[i],"name Llama")
            }
        }
        console_print(id,"[AMXX] You Llamed %s",arg[1])
    }
    else{
        new target = cmd_target(id,arg,3)
        if (!target || ids[target]) return PLUGIN_HANDLED
        ids[target] = true
        get_user_name(target,pName[target],31)
        console_print(id,"[AMXX] You Llamed %s",pName[target])
        client_print(0, print_chat, "ADMIN %s: LLAMA %s", name, target)
        client_cmd(target,"name Llama")
         
    }

    return PLUGIN_HANDLED
}
//----------------------------------------------------------------------------------------------
public unllama(id,level,cid)
{
    if (!cmd_access(id,level,cid,2))
        return PLUGIN_HANDLED

    new arg[32]
    read_argv(1,arg,31)

    if (arg[0]=='@'){
        new plist[32],pnum
        get_players(plist,pnum,"e",arg[1])
        if (pnum==0){
            console_print(id,"No clients in such team")
            return PLUGIN_HANDLED
        }
        for (new i=0; i<pnum; i++){
            if (!(get_user_flags(plist[i])&ADMIN_IMMUNITY)&&ids[plist[i]])
            {
                ids[plist[i]] = false
                client_cmd(ids[plist[i]],"name %s",pName[plist[i]])
            }
        }
        console_print(id,"[AMXX] You un-Llamed %s",arg[1])
    }
    else{
        new target = cmd_target(id,arg,3)
        if (!target || !ids[target]) return PLUGIN_HANDLED
        ids[target] = false
        client_cmd(target,"name %s",pName[target])
        console_print(id,"[AMXX] un-Llamed %s",pName[target])
        client_print(0, print_chat, "ADMIN %s: UNLLAMA %s", name, target)
    }

    return PLUGIN_HANDLED
}
//----------------------------------------------------------------------------------------------
public check_say(id)
{
    if (!ids[id]) return PLUGIN_CONTINUE

    new said[32]
    read_args(said,31)
    remove_quotes(said)
    for (new i=0; i<MESSAGES; i++)
        if(equal(said,llama_msg[i]))
            return PLUGIN_CONTINUE

    new ran = random_num(0,MESSAGES-1)
    client_cmd(id,"say %s",llama_msg[ran])
    if (get_cvar_num("amx_llamasound")) client_cmd(id,"spk %s",llama_sound[ran])

    return PLUGIN_HANDLED
}
//----------------------------------------------------------------------------------------------
public client_connect(id)
{
    ids[id] = false
}
//----------------------------------------------------------------------------------------------
public client_infochanged(id)
{
    if (!ids[id]) return PLUGIN_HANDLED
    new Name[32]
    get_user_name(id,Name,31)
    if (!contain(Name,"Llama")) client_cmd(id,"name Llama")

    return PLUGIN_HANDLED
}
//----------------------------------------------------------------------------------------------

That 'name' doesn`t have an arg , and I don`t know how to make it work .
Still , it doesn`t print at all .

MasterAdy 05-26-2009 14:21

Re: Modify amx_llama
 
If noone knows or it`s not possible , a mod may close the topic ^^ .


All times are GMT -4. The time now is 01:27.

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