
08-13-2009, 12:28 PM
|
jwd
|
 |
Join Date: Oct 2005
Location: Greater Manchester
Posts: 2,423
|
|
Quote:
Originally Posted by Liberated
so this?
PHP Code:
function getCoordinates(xOffset, yOffset) {
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(7, 7)
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
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(xOffset, yOffset)
{
if (player.dir == 0)
{
this.x = player.x + 0.5;
this.y = player.y - yOffset;
}
elseif (player.dir == 1)
{
this.x = playerx - xOffset;
this.y = player.y + 0.5;
}
elseif (player.dir == 2)
{
this.x = player.x + 0.5;
this.y = player.y + yOffset;
}
elseif (player.dir == 3)
{
this.x = player.x + xOffset;
this.y = player.y + 0.5;
}
}
function onWeaponFired()
{
setani("lift", Null);
getCoordinates(7, 7)
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. |
|
|