Files

40 lines
1.2 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# NPC.js — main() (satır 38)
[← NPC.js](index.md) · [← Master](../../wiki.md)
```javascript
function main(c)
{
var player = c.getSubject();
if (!player) return;
var fromChat = !!c.getValue("message");
var msg = c.getValue("message");
// Eger sohbetten degilse, Eclipse menüsünden gelmis olabilir.
if (!msg) {
msg = mappet.get("nano_cmd_" + player.getName());
mappet.set("nano_cmd_" + player.getName(), "");
}
if (!msg) return;
msg = String(msg).trim();
if (msg === "") return;
if (!isCommander(player.getName())) return;
var isCommand = (msg === "bekle" || msg === "iyileş" || msg === "menu" || msg === "ai" || startsWith(msg, "getir") || msg === "takip" || msg === "dur" || msg === "gel" || startsWith(msg, "saldır") || msg === "git" || msg === "koru");
if (isCommand)
{
if (fromChat && c.cancel) {
try { c.cancel(); } catch(e) {}
}
c.scheduleScript(1, function(ctx) {
var p = ctx.getServer().getPlayer(player.getName());
if (p) processCommand(ctx, p, msg);
});
}
}
```