View Single Post
  #8  
Old 08-13-2009, 12:28 PM
Codein Codein is offline
jwd
Codein's Avatar
Join Date: Oct 2005
Location: Greater Manchester
Posts: 2,423
Codein has a spectacular aura aboutCodein has a spectacular aura about
Send a message via AIM to Codein Send a message via MSN to Codein
Quote:
Originally Posted by Liberated View Post
so this?
PHP Code:
function getCoordinates(xOffsetyOffset) {
if (
playerdir==0)
{
  
this.x=player.x+0.5;
  
this.y=player.y-yOffset;
}
elseif (
playerdir==1)
{
  
this.x=playerx-xOffset;
  
this.y=player.y+0.5;
}
elseif (
playerdir==2)
{
  
this.x=player.x+0.5;
  
this.y=player.y+yOffset;
}
elseif (
playerdir==3)
{
  
this.x=player.x+xOffset;
  
this.y=player.y+0.5;
}
}
function 
onWeaponFired()
{
  
setani("lift"Null);
  
getCoordinates(77)
  
putexplosion2(1,2,this.x,this.y);
  
freezeplayer(0.5);
  
player.chat "Kaboom!"

you put xOffset in this.y at playerdir == 3 tho :P, but everyone makes error specialy me.
Whoops, well spotted

Quote:
Originally Posted by Liberated View Post
no, no not at all!
thanks for the help! Im only trying to improve and get my scripts good and clean looking, so any C&C is appreciated!
And i really want to stay away from GS1 so im glad you mentioned that.
PHP Code:
//#CLIENTSIDE
function getCoordinates(xOffsetyOffset
{
  if (
player.dir == 0)
  {
    
this.player.0.5;
    
this.player.yOffset;
  }
  elseif (
player.dir == 1)
  {
    
this.playerx xOffset;
    
this.player.0.5;
  }
  elseif (
player.dir == 2)
  {
    
this.player.0.5;
    
this.player.yOffset;
  }
  elseif (
player.dir == 3)
  {
    
this.player.xOffset;
    
this.player.0.5;
  }
}
function 
onWeaponFired()
{
  
setani("lift"Null);
  
getCoordinates(77)
  
putexplosion2(1,2,this.x,this.y);
  
freezeplayer(0.5);
  
player.chat "Kaboom!"

i just edited the previous script on the forum, so nothing on the RC or something. I hope this is okay? Or did i do too much by also putting spaced around the = between this.x and player.x?

And can/should getcoordinates be serverside?
getCoordinates should be clientside. Also, that's the spacing style I use, so no worries there

http://wiki.graal.us/Index

This may also come in handy.
Reply With Quote