// https://rathena.org/board/topic/117023-is-a-passible-to-create-a-fast-type-event/
- script fast_type_main -1,{
OnInit:
bindatcmd("create", strnpcinfo(3)+"::OnCreate", 99, 99);
bindatcmd("end", strnpcinfo(3)+"::OnEnd", 99, 99);
bindatcmd("type", strnpcinfo(3)+"::OnAtcommand",0, 99);
end;
OnCreate:
if (.@atcmd_numparameters) {
.status = 1;
.event_type_size = .@atcmd_numparameters;
deletearray .event_type$;
copyarray .event_type$, .@atcmd_parameters$, .event_type_size;
initnpctimer;
}
end;
OnAtcommand:
if (.status && .event_type_size) {
if (implode(.event_type$, " ") == implode(.@atcmd_parameters$, " ")) {
announce "<Type Event> "+strcharinfo(0)+" won the game.", bc_all;
donpcevent strnpcinfo(3)+"::OnEnd";
}
}
end;
OnEnd:
if (.status)
announce "<Type Event> Event ended.", bc_all;
stopnpctimer;
.status = 0;
deletearray .event_type$;
end;
OnTimer1000:
announce "<Type Event> First player to type '"+implode(.event_type$, " ")+"' win the game.", bc_all;
end;
OnTimer10000:
setnpctimer 0;
end;
}
Comments
0 B
|👍
/👎