|
11-23-2012
|
34
|
|
scripture
Join Date: Jul 2012
Location: United Kingdom
Posts: 237
|
PHP Code:
//#CLIENTSIDE
function onCreated() {
showcharacter();
this.head = "head0.png";
this.body = "body.png";
this.nick = "Statue";
this.colors[0] = "orange";
this.colors[1] = "white";
this.colors[2] = "blue";
this.colors[3] = "red";
this.colors[4] = "black";
this.shield = "no-shield.png";
this.dir = 2;
setcharani("idle",NULL);
this.attr[1] = "";
this.chat = "Click me!";
}
function onMouseDown(mode) {
if (mode != "left") return;
temp.pl = findnearestplayer(mousex, mousey);
player.chat = format("%s was the nearest target", temp.pl.communityname);
this.head = player.head;
this.chat = player.chat;
this.body = player.body;
this.nick = player.nick;
this.ap = player.ap;
this.attr[1] = player.attr[1] //hat
this.ani = player.ani;
this.dir = player.dir;
}
function onPlayerChats() {
if (player.chat == "/reset") this.chat = "reset";
}
Keep in mind, this will reset whenever the level is updated. To prevent that you could do something like this (very simple and just viewable for you);
PHP Code:
//#CLIENTSIDE
function onPlayerEnters() {
showcharacter();
if (client.statue_first == NULL) {
this.head = "head0.png";
this.body = "body.png";
this.nick = "Statue";
this.colors[0] = "orange";
this.colors[1] = "white";
this.colors[2] = "blue";
this.colors[3] = "red";
this.colors[4] = "black";
this.shield = "no-shield.png";
this.dir = 2;
setcharani("idle",NULL);
this.attr[1] = "";
this.chat = "Click me!";
}
else {
this.head = client.statue_first[0];
this.body = client.statue_first[1];
this.nick = client.statue_first[2];
this.colors[0] = client.statue_first[3][0];
this.colors[1] = client.statue_first[3][1];
this.colors[2] = client.statue_first[3][2];
this.colors[3] = client.statue_first[3][3];
this.colors[4] = client.statue_first[3][4];
this.shield = client.statue_first[4];
this.dir = client.statue_first[5];
setcharani(client.statue_first[6], NULL);
this.attr[1] = client.statue_first[7];
}
}
function onMouseDown(mode) {
if (mode != "left") return;
client.statue_first = {
player.head, //head
player.body, //body
player.nick, //nickname
{player.colors[0], player.colors[1], player.colors[2], player.colors[3], player.colors[4]}, //colors
player.shield, //shield
player.dir, //direction
player.ani, //gani
player.attr[1] //hat
};
onPlayerEnters();
}
function onPlayerChats() {
if (player.chat != "reset") return;
this.chat = "reset";
client.statue_first = NULL;
onPlayerEnters();
setTimer(2);
}
function onTimeOut() {
this.chat = "";
}
Wasnt sure if you want to have your look setted or the other players look. If you want the other players look setted, you could do something like this for the onActionMouseDown()
PHP Code:
function onMouseDown(mode) {
if (mode != "left") return;
temp.pl = findNearestPlayer(mousex, mousey);
if (mousex in |temp.pl.x, temp.pl.x+3| && mousey in |temp.pl.y, temp.pl.y+3|) {
client.statue_first = {
temp.pl.head, //head
temp.pl.body, //body
temp.pl.nick, //nickname
{temp.pl.colors[0], temp.pl.colors[1], temp.pl.colors[2], temp.pl.colors[3], temp.pl.colors[4]}, //colors
temp.pl.shield, //shield
temp.pl.dir, //direction
temp.pl.ani, //gani
temp.pl.attr[1] //hat
};
onPlayerEnters();
}
}
Yah no clue what I wrote there so ask me if you didnt understand something
Damn Emera was faster but anyway it might help
|
wowwowoowwowoowoow i was looking at how john learnt scripting but i am still not at that level :[
|
|
|
|