Spar Script!

So, I’m trying to script a spar script! And don’t get into how messy it is or whatever Tricxta usually manages to insult me with xP I’m start with the basics and what I can. Anyway, what happens is it doesn’t warp the second player to the right position when the spar is started, and the image for the showtext shows just the person who enter’s first name and only shows up for that person…nobody else can see it.

[CODE]if(playerenters){
setstring server.#Lid1,0;
setstring server.#Lid2,0;
setstring server.#Lsparcount,0;
timeout=0.05;

}
if (playerchats){
if(strequals(#c,join)) {
this.count = 0;
for (this.var =0;this.var<playerscount;this.var++) {
if (players[this.var].x in |19,46| && players[this.var].y in |27,51|)setstring server.#Lsparcount,#v(strtofloat(#s(server.#Lsparcount))+1);
}
if (server.#Lsparcount < 2) {
playerx=32;
playery=37;
setplayerprop #c, Joined!;
}
else {setplayerprop #c, The spar is ocupied!;}
}
if(strequals(#c,start)) {
players[server.#Lid1].x=30;
players[server.#Lid1].y=43;
players[server.#Lid2].x=45;
players[server.#Lid2].x=43;
lay2 heart,players[server.#Lid1].x,players[server.#Lid1].y;
lay2 heart,players[server.#Lid2].x,players[server.#Lid2].y;
lay2 heart,players[server.#Lid1].x,players[server.#Lid1].y;
lay2 heart,players[server.#Lid2].x,players[server.#Lid2].y;
lay2 heart,players[server.#Lid1].x,players[server.#Lid1].y;
lay2 heart,players[server.#Lid2].x,players[server.#Lid2].y;
putbomb 1,30,30;
}
if(strequals(#c,leave)) {
playerx=36;
playery=55;
setplayerprop #c, Left!;
}
timeout=0.05;
}

if( timeout){
for (this.var =0;this.var<playerscount;this.var++) {
if (players[this.var].x in |27,46| && players[this.var].y in |34,52|) {
setstring server.#Lid1=this.var,#v(this.var);}
}
for (this.var =this.id1+1;this.var<playerscount;this.var++)
if (players[this.var].x in |27,46| && players[this.var].y in |34,52|) {
setstring server.#Lid2,#v(this.var);}

showtext 28,34,32,Arial,b,#n(server.#Lid1) vs #n(server.#Lid2);
changeimgcolors 400+i,0,0,0,1;
changeimgzoom 400+i,.8;
changeimgvis 400+i,2;
timeout=0.05;
}
[/CODE]

Thank you if you help xP Learning slowly but surely.

just take Downsider’s.

I would, but I’m tired of hearing people say that we just copy things xP

And 2, taking somebody elses script isn’t teaching me anything, lol. I’m trying to learn here :slight_smile:

    this.heartlay=players[server.#Lid1].fullhearts-players[server.#Lid1].hearts;
    for (this.i=0;this.i<this.heartlay;this.i++)lay2 heart,players[server.#Lid1].x,players[server.#Lid1].y;
    this.heartlay=players[server.#Lid2].fullhearts-players[server.#Lid2].hearts;
    for (this.i=0;this.i<this.heartlay;this.i++)lay2 heart,players[server.#Lid2].x,players[server.#Lid2].y;

^^^ more elegant way and will heal a player fully even if they have more then 3 hearts.

Not very elegant at all… A spar needs a *swordsOnly weapon anyway, so my implementation takes advantage of that. The leader is the “server”, the other players get sent shoot “packets” whenever they have to be warped, healed, kicked, etc.

Oooh! That is a great idea downsider! I haven’t really gotten to shooting packets yet xP
But yes, I’ll think about it and find a way to implement that. Thanks :slight_smile:

And Tric, I see how that works, thanks xP I might use it.

you can have more than 1 command in a for loop, peeps.

Eh, please elaborate?

tricxta decided to use two for loops when he only needs to use 1. see if you can tell me why.

Not sure ;/

I want to mention that the part for checking how many players are in the sparringarea isn’t working either…

Just use Downsider’s script. o__o

Thanks, Spooon. I guess most servers would xP I’m trying to make something unique. This is just the bare bone. As soon as I get this working and figure out why it wasn’t working, I’ll be adding a TON more to this script. Possibly showing the number of hearts, but not in images…Bomber Arena already has that xP Also some other functions. I’m learning, and this is a great script to try out a TON of different things :slight_smile: