mas1NNNa Administrator
Mesaje : 526 Data de inscriere : 18/06/2011 Varsta : 27 Localizare : Navodari
| Subiect: Executare client Mier Iul 20, 2011 6:01 am | |
| Sallut la toti ! In acest tutorial va veti putea executa o comanda asupra unui jucator(client) La inceput avem asa : Cod: /* Script generated by Pawn Studio */ #include #include
#define PLUGIN "New Plugin" #define AUTHOR "Unknown" #define VERSION "1.0"
public plugin_init() { register_plugin(PLUGIN, VERSION, AUTHOR) // Add your own code here }
Adaugam concmd
Cod: register_concmd("comanda","public-ul",accesul de Admin,"Mesajul ce va aparea la amx_help")
la noi fiind --> Cod: register_concmd("amx_ss","ss",ADMIN_KICK,"- Faci snapshot unui jucator")
sa va reamintesc lista acceselor la admini Cod: ADMIN_SLAP ADMIN_SLAY ADMIN_KICK ADMIN_BAN ADMIN_MAP ADMIN_CVAR ADMIN_RCON ADMIN_VOTE ADMIN_CHAT ADMIN_CFG ADMIN_PASSWORD ADMIN_IMMUNITY ADMIN_RESERVATION ADMIN_LEVEL_A ADMIN_LEVEL_B ADMIN_LEVEL_C ADMIN_LEVEL_D ADMIN_LEVEL_E ADMIN_LEVEL_F ADMIN_LEVEL_G ADMIN_LEVEL_H
Acum adaugam publicul Cod: public ss(id,level,cid){
}
Acum sa verificam ca este admin adaugam Cod: if(!cmd_access(id,level,cid,2)) return PLUGIN_HANDLED;
Acuma trebuie sa cream codul care va fi executat pe jucator, si cream un :
Cod: new arg[32] read_argv(1,arg,31)
Acum trebuie sa facem ca acest arg sa fie executat pe cineva Cod: new player = cmd_target(id,arg,1)
Acum verificam daca jucatorul este viu Cod: if(!is_user_alive(id)) return PLUGIN_HANDLED
Pana acum avem asa : Cod: public ss(id,level,cid){ if(!cmd_access(id,level,cid,2)) return PLUGIN_HANDLED;
new arg[32] read_argv(1,arg,31) new player = cmd_target(id,arg,1)
if(!is_user_alive(id)) return PLUGIN_HANDLED }
Acum cream comanda : Cod: client_cmd(player,"snapshot") return PLUGIN_HANDLED
Pentru cei care zic de exp : Cod: Nu arata nicaieri ca a executat poza Nu arata numele la admin Nu arata numele la jucator
Unde aveam --> | Adaugam asta deasupra lui Cod: client_cmd(player,"snapshot")
Cod: client_print(0, print_chat, "ADMIN ii face ss lui %s", player)
Acum fa arata doar numele Jucatorului executat . Daca vrem sa arate si numele adminului adaugam
static name[32] get_user_name(id,name,31);
si apoi modificam : Cod: client_print(0, print_chat, "ADMIN ii face ss lui %s", player)
cu --> Cod: client_print(0, print_chat, "ADMIN %s ii face ss lui %s",name , player)
si la final ar trebui sa arate : Cod: /* Script generated by Pawn Studio */
#include #include
#define PLUGIN "New Plugin" #define AUTHOR "Unknown" #define VERSION "1.0"
public plugin_init() { register_plugin(PLUGIN,VERSION,AUTHOR) register_concmd("amx_ss","ss",ADMIN_KICK,"- facem ss jucatorului") }
public ss(id,level,cid){ if(!cmd_access(id,level,cid,2)) return PLUGIN_HANDLED;
static name[32] new arg[32]
read_argv(1,arg,31) new player = cmd_target(id,arg,1)
get_user_name(id,name,31);
if(!is_user_alive(id)) return PLUGIN_HANDLED
client_print(0, print_chat, "ADMIN %s ii face ss lui %s", name, player) client_cmd(player,"snapshot")
return PLUGIN_HANDLED } | |
|