Nematytu chate

Šiame forume rašomi vartotojų klausimai/problemos su kuriomis jie susidūrė kuriant pluginus.
Post Reply
edgaras85
O taip. Jis jau surinko 50 žinučių!
Posts: 50
Joined: 2010 Sep 04 11:59
Skype: edgaras259

Nematytu chate

Post by edgaras85 »

Kaip padaryti kad kai parasai
/admin
Nerasytu visiem ir isvis i chata nerasytu kad tu rasei /admin
o tiesiok tau parasytu
Prisijunge Adminai ir viskas

newb
Pluginų patvirtintojas
Posts: 1047
Joined: 2010 Sep 23 21:43
Location: Wonderland
Contact:

Re: Nematytu chate

Post by newb »

Netestinau, bet turetu veikti.

Code: Select all

#include <amxmodx> #define ADMIN_FLAG ADMIN_BAN new gmsgSayText, maxplayersstatic const COLOR[] = "^x04" public plugin_init() {    register_clcmd("say /admin", "print_adminlist")        gmsgSayText = get_user_msgid("SayText")    maxplayers = get_maxplayers()} public print_adminlist(user) {    new adminnames[33][32]    new message[256]    new id, count, x, len        for(id = 1 ; id <= maxplayers ; id++)        if(is_user_connected(id))            if(get_user_flags(id) & ADMIN_FLAG)                get_user_name(id, adminnames[count++], 31)    len = format(message, 255, "%sAdmins ONLINE: ",COLOR)    if(count > 0) {        for(x = 0 ; x < count ; x++) {            len += format(message[len], 255-len, "%s%s ", adminnames[x], x < (count-1) ? ", ":"")            if(len > 96 ) {                print_message(user, message)                len = format(message, 255, "%s ",COLOR)            }        }        print_message(user, message)    }    else {        format(message, charsmax(message), "%sNo Admins online.", COLOR)        print_message(user, message)    }        return PLUGIN_HANDLED} print_message(id, msg[]) {    message_begin(MSG_ONE, gmsgSayText, {0,0,0}, id)    write_byte(id)    write_string(msg)    message_end()}  

edgaras85
O taip. Jis jau surinko 50 žinučių!
Posts: 50
Joined: 2010 Sep 04 11:59
Skype: edgaras259

Re: Nematytu chate

Post by edgaras85 »

newb wrote:Netestinau, bet turetu veikti.

Code: Select all

#include <amxmodx> #define ADMIN_FLAG ADMIN_BAN new gmsgSayText, maxplayersstatic const COLOR[] = "^x04" public plugin_init() {    register_clcmd("say /admin", "print_adminlist")        gmsgSayText = get_user_msgid("SayText")    maxplayers = get_maxplayers()} public print_adminlist(user) {    new adminnames[33][32]    new message[256]    new id, count, x, len        for(id = 1 ; id <= maxplayers ; id++)        if(is_user_connected(id))            if(get_user_flags(id) & ADMIN_FLAG)                get_user_name(id, adminnames[count++], 31)    len = format(message, 255, "%sAdmins ONLINE: ",COLOR)    if(count > 0) {        for(x = 0 ; x < count ; x++) {            len += format(message[len], 255-len, "%s%s ", adminnames[x], x < (count-1) ? ", ":"")            if(len > 96 ) {                print_message(user, message)                len = format(message, 255, "%s ",COLOR)            }        }        print_message(user, message)    }    else {        format(message, charsmax(message), "%sNo Admins online.", COLOR)        print_message(user, message)    }        return PLUGIN_HANDLED} print_message(id, msg[]) {    message_begin(MSG_ONE, gmsgSayText, {0,0,0}, id)    write_byte(id)    write_string(msg)    message_end()}  
O aciu sitas veikia :)

O kaip padaryti sita?
kad nematytu kai rasai /spec arba /back

Code: Select all

/* Plugin generated by AMXX-Studio */ #include <amxmodx>#include <amxmisc>#include <cstrike>#include <fun> #define PLUGIN "Spec Switch"#define VERSION "0.1.3"#define AUTHOR "many" new CsTeams:zTeam[33]new zDeath[33]new bool:type_spec[33] = falsenew g_cvarnew gmsgSayText public plugin_init(){    register_plugin(PLUGIN, VERSION, AUTHOR)    /* Cvar */    g_cvar    = register_cvar("amx_specmode",    "0")     // 0 - enable use to all, 1 - enable use only ADMINs    gmsgSayText = get_user_msgid("SayText")    /* Client Commands */    register_clcmd("say /spec",         "cmdSpec", ADMIN_ALL, "- go to spectator")    register_clcmd("say_team /spec",     "cmdSpec", ADMIN_ALL, "- go to spectator")    register_clcmd("say /back",         "cmdBack", ADMIN_ALL, "- go back to your team")    register_clcmd("say_team /back",     "cmdBack", ADMIN_ALL, "- go back to your team")} public cmdSpec(id){    if(!get_pcvar_num(g_cvar)) Spec(id)    else if( get_pcvar_num(g_cvar) && (get_user_flags(id) & ADMIN_KICK)) Spec(id)    else if( get_pcvar_num(g_cvar) && !(get_user_flags(id) & ADMIN_KICK)) PrintUserNotAdmin(id)} public cmdBack(id){    if (type_spec[id] && cs_get_user_team(id) == CS_TEAM_SPECTATOR && zTeam[id] != CS_TEAM_SPECTATOR ) Back(id)    else if( get_pcvar_num(g_cvar) && !(get_user_flags(id) & ADMIN_KICK) ) PrintUserNotAdmin(id)} public Spec(id){    zDeath[id] = cs_get_user_deaths(id)    if (cs_get_user_team(id) == CS_TEAM_SPECTATOR)    return    else{        type_spec[id] = true        zTeam[id] = cs_get_user_team(id)        cs_set_user_team(id, CS_TEAM_SPECTATOR)        user_silentkill(id)        client_print(id, print_chat,"Type /back to return from Spectator")    }    return} public Back(id){    cs_set_user_team(id, zTeam[id])    cs_set_user_deaths(id, zDeath[id])} PrintUserNotAdmin(id){    client_print(id,print_chat,"Only Admins can use /spec, /back command")} public PrintRule(id){    if ( is_user_connected(id) && !is_user_bot(id) && !is_user_hltv(id) ){        client_print(id,print_chat,"Type /spec if you want to go Spectator")        client_print(id,print_chat,"Type /back to return from Spectator")    }} public client_putinserver(id){    if(!get_pcvar_num(g_cvar)) Rule(id)    else if( get_pcvar_num(g_cvar) && (get_user_flags(id) & ADMIN_KICK)) Rule(id)} print_message(id, msg[]) {    message_begin(MSG_ONE, gmsgSayText, {0,0,0}, id)    write_byte(id)    write_string(msg)    message_end()} public client_disconnect(id) type_spec[id] = falsepublic client_connect(id) type_spec[id] = falsepublic Rule(id) set_task(20.0, "PrintRule", id) /* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE*{\\ rtf1\\ ansi\\ ansicpg1252\\ deff0{\\ fonttbl{\\ f0\\ fnil\\ fcharset0 Tahoma;}}\n{\\ colortbl ;\\ red0\\ green0\\ blue0;}\n\\ viewkind4\\ uc1\\ pard\\ cf1\\ lang1033\\ b\\ f0\\ fs16 \n\\ par }*/ 

newb
Pluginų patvirtintojas
Posts: 1047
Joined: 2010 Sep 23 21:43
Location: Wonderland
Contact:

Re: Nematytu chate

Post by newb »

Pakeisk situos

Code: Select all

public cmdSpec(id){     if(!get_pcvar_num(g_cvar)) Spec(id)     else if( get_pcvar_num(g_cvar) && (get_user_flags(id) & ADMIN_KICK)) Spec(id)     else if( get_pcvar_num(g_cvar) && !(get_user_flags(id) & ADMIN_KICK)) PrintUserNotAdmin(id)     return PLUGIN_HANDLED}  public cmdBack(id){     if (type_spec[id] && cs_get_user_team(id) == CS_TEAM_SPECTATOR && zTeam[id] != CS_TEAM_SPECTATOR ) Back(id)     else if( get_pcvar_num(g_cvar) && !(get_user_flags(id) & ADMIN_KICK) ) PrintUserNotAdmin(id)     return PLUGIN_HANDLED}

edgaras85
O taip. Jis jau surinko 50 žinučių!
Posts: 50
Joined: 2010 Sep 04 11:59
Skype: edgaras259

Re: Nematytu chate

Post by edgaras85 »

Aciu :)

Post Reply

Who is online

Users browsing this forum: No registered users and 7 guests