The Drop Flag doesnt work, means theres no echo. Like before I said, the Drop Flag trigger of the Weap comes first and disabled the DNPC one. Also if I said Drop Flag without having the Weapon it echos.
rest works fine
Weaponname: -BlueFlag
DBNPCname: BlueFlag
Weapon:
PHP Code:
function onActionServerSide(cmd) {
switch (cmd) {
case "removeWeapon": {
temp.pl = findplayerbycommunityname(params[1]);
pl.removeWeapon("-BlueFlag");
break;
}
}
}
//#CLIENTSIDE
function onCreated() {
replaceani("walk", "sch_ctfbwalk");
replaceani("idle", "sch_ctfbidle");
showtext 0,player.x+1.5,player.y-1.5,arial,bc,Blue Flag!;
changeimgzoom 0,0.9;
client.bflag = "got";
settimer(.05);
}
function onPlayerChats() {
if (player.chat == "drop flag") {
replaceani("walk", "walk");
replaceani("idle", "idle");
setani("idle", null);
triggerserver("gui", name, "removeWeapon", player.account);
}
}
function onTimeout() {
if (client.bflag == "got") {
showtext 0,player.x+1.5,player.y-1.5,arial,bc,Blue Flag!;
changeimgzoom 0,0.9;
settimer(.05);
}
}
DBNPC:
PHP Code:
function onActionDropFlag() {
echo ("Do you?"); //No it doesnt
temp.pl = findplayerbycommunityname(params[1]);
if (client.blueowner == "1") {
echo ("do you now?"); //also not
this.blueowner = 2;
this.dir = 1;
pl.client.blueowner = 2;
this.level = ctf.gmap;
this.x = 94.5;
this.y = 26;
this.blockagain();
this.show();
}
}
function onActionMoveFlag() {
if (player.guild == "Red Team") {
player.addWeapon("-BlueFlag");
this.blueowner = 1;
player.client.blueowner = 1;
this.hide();
}
}
function onCreated() {
this.setshape(1,32,32);
this.blueowner = 2;
this.dir = 1;
this.setcharani("sch_ctfblueidle",null);
this.blockagain();
this.show();
}
//#CLIENTSIDE
function onPlayerTouchsme() {
triggeraction(this.x, this.y, "moveFlag", player.account);
}
function onPlayerChats() {
if (player.chat == "Drop Flag") {
triggeraction(this.x, this.y, "dropFlag", player.account);
}
}
I would need to find a way to trigger the DBNPC dropFlag with a command in the weapon, so I wouldnt have to check the client.bluowner stuff. Just because only the guy with the weap would be able to trigger that.
Now simply:
I need a way to use a triggeraction(//bla); in a weapon wich would trigger an action in an DBNPC