View Single Post
  #6  
Old 04-10-2009, 08:44 AM
Schetti Schetti is offline
SC2 Player
Schetti's Avatar
Join Date: Nov 2008
Location: Austria
Posts: 269
Schetti is on a distinguished road
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.94.5;
    
this.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.xthis.y"moveFlag"player.account);
}

function 
onPlayerChats() {
if (
player.chat == "Drop Flag") { 
 
triggeraction(this.xthis.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
__________________
“Peace cannot be kept by force. It can only be achieved by understanding.” – Albert Einstein

Last edited by Schetti; 04-10-2009 at 11:36 AM..
Reply With Quote