Cześć, mam pytanie i wsumie prosbe, zrobilby ktos tak zeby po wejsciu na serwer czapka byla automatycznie losowo ustawiona?
#include <amxmodx> #include <amxmisc> #include <fakemeta> #define PLUGIN "Czapki" #define VERSION "1.0" #define AUTHOR "Cypis" new gEnt[33]; new Array:gModel; new Array:gNazwa; new Array:gBody; public plugin_init() { register_plugin(PLUGIN, VERSION, AUTHOR); register_clcmd("say /hat", "MenuHat"); register_clcmd("say /hats", "MenuHat"); register_clcmd("say /czapki", "MenuHat"); } public plugin_precache() { gModel = ArrayCreate(128); gNazwa = ArrayCreate(64); gBody = ArrayCreate(); ArrayPushString(gModel, "Zadna"); ArrayPushString(gNazwa, "\yZdejmij czapke"); ArrayPushCell(gBody, 0); new configfile[128]; get_configsdir(configfile, 127); add(configfile, 127, "/hats.ini"); if(!file_exists(configfile)) return; new linia[256], txtlen, ilosc; for(new i=0; i<file_size(configfile, 1); i++) { read_file(configfile, i, linia, 255, txtlen); if(contain(linia, ";") != -1 || !txtlen) continue; new model[128], nazwa[64], body[6]; parse(linia, model, 127, nazwa, 63, body, 5); remove_quotes(model); remove_quotes(nazwa); remove_quotes(body); format(model, 127, "models/czapki/%s", model); ArrayPushString(gModel, model); ArrayPushString(gNazwa, nazwa); ArrayPushCell(gBody, str_to_num(body)); new gmodel[64]; if(ilosc) { for(new j=1; j<ArraySize(gBody)-1; j++) { ArrayGetString(gModel, j, gmodel, 63); if(equal(model, gmodel)) { gmodel[0] = 1; break; } else gmodel[0] = 0; } } if(!gmodel[0]) { precache_model(model); log_amx("Precache %s", model); } else log_amx("Precache %s %s %s", model, nazwa, body); ilosc++; } } public MenuHat(id) { new nazwa[64], int[4], menu = menu_create("Czapki:", "Handel_Czapki"); for(new i=0; i<ArraySize(gBody); i++) { num_to_str(i, int, 3); ArrayGetString(gNazwa, i, nazwa, 63); menu_additem(menu, nazwa, int); } menu_setprop(menu, MPROP_EXITNAME, "Wyjdz"); menu_display(id, menu); return PLUGIN_HANDLED; } public Handel_Czapki(id, menu, item) { if(item == MENU_EXIT) return; new acces, callback, num[4], nazwa[64]; menu_item_getinfo(menu, item, acces, num, 3, nazwa, 63, callback); UstawCzapke(id, str_to_num(num)); item? client_print(id, 3, "Zalozyles czapke %s", nazwa): client_print(id, 3, "Zdjales swoja czapke"); } stock UstawCzapke(id, anum) { if(gEnt[id]) set_pev(gEnt[id], pev_effects, anum? pev(gEnt[id], pev_effects) & ~EF_NODRAW: pev(gEnt[id], pev_effects) | EF_NODRAW); if(!anum) return; new model[128]; ArrayGetString(gModel, anum, model, 127); if(!gEnt[id]) { gEnt[id] = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "info_target")) set_pev(gEnt[id], pev_movetype, MOVETYPE_FOLLOW); set_pev(gEnt[id], pev_aiment, id); set_pev(gEnt[id], pev_rendermode, kRenderNormal); } engfunc(EngFunc_SetModel, gEnt[id], model); set_pev(gEnt[id], pev_body, ArrayGetCell(gBody, anum)); }