Page 1 of 1
string..
Posted: 2011 Sep 24 21:46
by aurimasko
Žodžiu turiu koduką ir jis nelabai man veikia. Žinau kad esu padaręs kažkur vieną didelę klaidą (manau taip

), nes buvo beveik pradėjas veikti, bet nevisai taip kaip reikėjo:
Code: Select all
register_clcmd("say /tvip", "cmd_vip_chat") public cmd_vip_chat(id){ new text[200] read_argv(2, text, 199) if(read_argc() < 2 ) { print(id, "\g.::[VCHAT]::. \tKomandos Naudojimas: \g/tvip [Tekstas]") return PLUGIN_HANDLED } new name[100]; get_user_name(id, name, charsmax(name)) new players[32], num, i, tempid get_players(players, num, "ch") for(i = 0; i < num; i++) { tempid = players[i] if(get_user_flags(tempid) & ADMIN_LEVEL_H) { print(tempid, "\g%s\t VIPAMS: \g%s", name, text) } } return PLUGIN_HANDLED}
Re: string..
Posted: 2011 Sep 24 21:49
by hleV
Registruok "say" (o ne "say /tvip"), tikrink ar pirmas argumentas yra "/tvip", o daugiau turėtų būt gerai.
Re: string..
Posted: 2011 Sep 26 19:28
by aurimasko
Code: Select all
register_clcmd("say", "cmd_say") public cmd_say(id){ new text[200], said[100] read_argv(1, said, 19) read_argv(2, text, 199) if(said[0] == '/') { if(said[1] == 't') { if(said[2] == 'v') { if(said[3] == 'i') { if(read_argc() < 2 ) { print(id, "\g.::[VCHAT]::. \tKomandos Naudojimas: \g/tvip [Tekstas]") return PLUGIN_HANDLED } new name[100]; get_user_name(id, name, charsmax(name)) new players[32], num, i, tempid get_players(players, num, "ch") for(i = 0; i < num; i++) { tempid = players[i] if(get_user_flags(tempid) & ADMIN_LEVEL_H) { print(tempid, "\g%s\t VIPAMS: \g%s", name, text) } } return PLUGIN_HANDLED } } } return PLUGIN_HANDLED } return PLUGIN_CONTINUE}
Kai parašai /tvip, tai išmeta į chatą (turintiems T flagą):
aurimasko VIPAMS, bet be teksto nesvarbu įrašai jį ar ne. Beto jeigu neįrašai teksto, tai neišmeta to, Kaip naudoti.
Re: string..
Posted: 2011 Sep 26 20:14
by newb
Kazkada turejau toki plugina, kad susirasinet su tam tikra flaga turinciais zaidejais su zenklu # dariau pagal savo poreikius, tad keleta dalyku galima pakeist, pvz ne contain o equal, ne zalia msg o praprasta ir pns.
Code: Select all
#include <amxmodx>#include <amxmisc> new SayText public plugin_init() { register_clcmd("say", "function_say") register_clcmd("say_team", "function_say") SayText = get_user_msgid("SayText")} public function_say(id) { if(get_user_flags(id) & ADMIN_LEVEL_E) { new arg[256] read_args(arg, charsmax(arg)) remove_quotes(arg) if(contain(arg, "#") != -1) { replace_all(arg, charsmax(arg), "#", "") trim(arg) if(!equal(arg, "")) send(arg, id) return PLUGIN_HANDLED } } return PLUGIN_CONTINUE} send(mes[], id) { static name[34] get_user_name(id, name, charsmax(name)) format(mes, 299,"^x03%s : ^x04%s", name, mes) new num = get_playersnum() for(new i = 1; i <= num; i++) if(get_user_flags(i) & ADMIN_LEVEL_E) { message_begin(MSG_ONE, SayText, {0, 0, 0}, i) write_byte(i) write_string(mes) message_end() }}
Re: string..
Posted: 2011 Oct 01 16:55
by aurimasko
gerai pasidariau pagal save, kodas panašus kaip newb rašė, bet bėda vienintelė - rašai "rašyk /tvip TEST" ir tada pasirašo jau VIPAMS, o ne paprastai.. man reikėtų jeigu pirmas žodis ne /tvip, tai tada neveiktų.
Re: string..
Posted: 2011 Oct 01 16:58
by newb
Reikia ne contain o equal daryt.
Re: string..
Posted: 2011 Oct 01 17:01
by aurimasko
o kuo skirasi jeigu tokia yra equali nuo equal ?
Re: string..
Posted: 2011 Oct 01 17:06
by beast
equal skiria didžiąsias ir mažąsias raides, o equali - ne. Tas pats ir su contain(i).