Atrius Manager
|
 |
Join Date: Dec 2004
Posts: 581
|
|
Quote:
if (created) {
setshape 1,32,48;
GetItem();
}
if (actiongrab) setplayerprop #c,#s(this.message);
if (playerenters || update) GetItem();
if (playerchats && startswith(take,#c)) {
GetOwner();
if (strequals(#s(this.owner),#a)) {
tokenize #c;
if (tokenscount==2 && strtofloat(#t(1))==this.itempad) {
RemoveItem();
if (this.item>0) {
setplayerprop #c,Took item #v(this.itempad) down!;
this.amount+=strtofloat(#I(clientr.itemc#v(this.it em),0));
replacestring clientr.itemc#v(this.item),0,#v(this.amount);
FixItem();
}
this.item = 0;
this.amount = 0;
GetItem();
}
}
}
if (playerchats && startswith(price,#c) && strequals(#a,Mixie)) {
GetOwner();
if (strequals(#s(this.owner),#a)) {
tokenize #c;
if (tokenscount==4 && strtofloat(#t(1))==this.itempad && strequals(#t(2),to)) {
price = strtofloat(#t(3));
if (price>0 && price<=1000000) {
ChangePrice();
setplayerprop #c,Changed price #v(this.itempad) to $#v(price)!;
}
}
}
}
function GetItem() {
store = this.store;
itempad = this.itempad;
with (getnpc(db-mall)) {
item = strtofloat(#I(this.#s(thiso.shop)_#v(store)-item#v(itempad),0));
amount = strtofloat(#I(this.#s(thiso.shop)_#v(store)-item#v(itempad),1));
price = strtofloat(#I(this.#s(thiso.shop)_#v(store)-item#v(itempad),2));
}
this.item = item;
this.amount = amount;
this.price = price;
setstring this.itemdata,;
item = this.item;
with (getnpc(db-items)) {
setstring thiso.itemdata,#s(this.#v(item));
}
setcharprop #P1,#I(this.itemdata,2);
setstring this.name,#I(this.itemdata,1);
//setcharprop #P1,chest.png;
setstring this.itemdata,;
if (amount>1) {
setstring this.message,#s(this.name): $#v(price) (x#v(amount));
} elseif (amount==1) {
setstring this.message,#s(this.name): $#v(price);
} else setstring this.message,;
if (amount>0) show;
else hide;
}
function ChangePrice() {
itempad = this.itempad;
with (getnpc(db-mall)) {
replacestring this.#s(thiso.shop)_#v(store)-item#v(itempad),2,#v(price);
}
this.price = price;
}
function RemoveItem() {
this.item = 0;
this.amount = 0;
itempad = this.itempad;
with (getnpc(db-mall)) {
item = strtofloat(#I(this.#s(thiso.shop)_#v(store)-item#v(itempad),0));
amount = strtofloat(#I(this.#s(thiso.shop)_#v(store)-item#v(itempad),1));
setstring this.#s(thiso.shop)_#v(store)-item#v(itempad),;
}
this.item = item;
this.amount = amount;
}
if (playerchats && startswith(buy,#c)) {
tokenize #c;
if (tokenscount==2 && strtofloat(#t(1))==this.itempad) {
dx = playerx - x + 1.5;
dy = playery - y + 2;
dist = (dx*dx+dy*dy)^0.5;
if (dist<=6) {
GetItem();
if (this.price>0 && this.item>0 && playerrupees>=this.price && this.amount>0) {
GetOwner();
playerrupees-=this.price;
RemoveItem();
//this.amount+=strtofloat(#I(clientr.itemc#v(this.it em),0));
//replacestring clientr.itemc#v(this.item),0,#v(this.amount);
item = this.item; amount = this.amount;
putnpc2 this.itemx+0.5,this.itemy-1,{
join items;
}
with(npcs[npcscount-1]) {
setstring this.owner,#a;
setstring this.owner2,#a;
this.item=item;
this.amount=amount;
this.npclayed = true;
this.market2 = true;
this.newitem = true;
}
lay = true;
with (getplayer(#s(this.owner))) {
if (strequals(#L,#F)) {
lay = false;
playerrupees+=price;
}
}
if (lay==true) {
putnpc2 this.itemx,this.itemy,{
join gralats;
}
price = this.price;
store = this.store;
with(npcs[npcscount-1]) {
rupees=price;
setstring this.owner,(#s(thiso.owner));
this.npclayed = true;
this.market2 = true;
this.newmoney = true;
}
}
setplayerprop #c,Bought item #v(this.itempad) for #v(this.price)g! Collect it outside the store!;
GetItem();
}
}
}
}
function GetOwner() {
store = this.store;
with (getnpc(db-mall)) {
setstring thiso.owner,#s(this.#s(thiso.shop)_#v(store)-owner);
}
}
join systemfunctions2;
//#CLIENTSIDE
if (created) {
setshape 1,32,32;
showimg 200,@Tempus Sans ITC@c@#v(this.itempad),x+1,y+2;
changeimgzoom 200,0.6;
changeimgvis 200,0;
setcharani era_item,#P1(-1);
}
if (playerenters || timeout) {
setcharani era_item,#P1(-1);
timeout = 0.1;
}
|
join systemfunctions2;
Quote:
function FixItem() {
itemnum = this.item;
with(getnpc(db-items)) {
setstring thiso.data,#s(this.#v(itemnum));
}
itemc = strtofloat(#I(clientr.itemc#v(this.item),0));
if (itemc<0) itemc = 0;
replacestring clientr.itemc#v(this.item),0,#v(itemc);
replacestring clientr.itemc#v(this.item),1,#I(thiso.data,1);
replacestring clientr.itemc#v(this.item),2,#I(thiso.data,2);
replacestring clientr.itemc#v(this.item),3,#I(thiso.data,3);
replacestring clientr.itemc#v(this.item),4,#I(thiso.data,4);
replacestring clientr.itemc#v(this.item),5,#I(thiso.data,5);
replacestring clientr.itemc#v(this.item),6,#I(thiso.data,6);
if (!hasweapon(#I(thiso.data,3)) && !strequals(#I(thiso.data,3),(none)))
addweapon #I(thiso.data,3);
}
function CalcSpace() {
this.weight = 0; this.volume = 0;
this.items = getflagkeys(clientr.itemc);
this.items = arraylen(this.items);
this.maxcarry = 150;
this.maxvolume = 6;
for (i=0;i<this.items;i++) {
if (strtofloat(#I(clientr.itemc#v(this.items[i]),0))>0) {
this.amount = strtofloat(#I(clientr.itemc#v(this.items[i]),0));
this.addweight = strtofloat(#I(clientr.itemc#v(this.items[i]),4));
this.addvolume = strtofloat(#I(clientr.itemc#v(this.items[i]),5));
this.addweight *= this.amount;
this.addvolume *= this.amount;
if (this.addweight>0) this.weight+=this.addweight;
if (this.addvolume>0) this.volume+=this.addvolume;
}
}
this.maxcarry += (strtofloat(#s(clientr.strength))*10);
setstring clientr.item_space,#v(this.weight),#v(this.volume) ,#v(this.maxcarry),#v(this.maxvolume);
}
|
Era staff can do the rest.. |
__________________
Contact me on Skype: "skype.sam.lorenz"
James,
Manager of Atrius
|
|