thanx dude that looks like everything, and that really helped me out a lot.
and it looks like everything is there [:.
and yea styling would prolly make it easier too. but yea thanks for all the help
Quote:
Originally Posted by fragman85
PHP Code:
//#CLIENTSIDE
function onCreated() {
this.sparAreaX = 0;
this.sparAreaY = 0;
this.sparAreaWidth = 10;
this.sparAreaHeight = 10
setTimer(0.05);
}
Instead of constantly setting the Coordinates in a .05 TimeOut, you do better using this.vars and setting them once in the onCreated() Event.
PHP Code:
function onPlayerChats() {
if (player.chat == "start") {
if (this.sparring.size() == 2 && player.account in this.sparring) {
putbomb(0, 31, 35);
}
}
elseif (player.chat == "join" && !(player.account in this.sparring)) {
if (this.sparring.size() < 3) {
player.x = 30;
player.y = 30;
}
}
}
You forgot two checks here. When the player says start, you have to check if the Player is one of the two sparrers, otherwise everybody in the Level can start the Spar, which is pretty dumb. Also when someone attemps to join, he can't be one of the two sparrers :o.
You also forgot a .size () here.
PHP Code:
function onTimeout() {
if (player.x in |this.sparAreaX, this.sparAreaX + this.sparAreaWidth|
&& player.y in |this.sparAreaY, this.sparAreaY + this.sparAreaHeight|) {
enableweapons();
if (!(player.account in this.sparring)) {
if (this.sparring.size() < 3) {
this.sparring.add(player.account);
}
else {
player.x = 30;
player.y = 30;
}
}
}
else {
disableweapons();
if (player.account in this.sparring) this.sparring.remove(player.account);
}
setTimer(0.05);
}
Here, I just added enableweapons() if the player is in the Spar Area and disableweapons() if not, so outside can't be pked. Oh and of course the temp.vars were replaced with the this.vars.
Sorry if I forgot something, but try to style your scripts more in the future :o
|