Event Coin Giver / Taker

Ok. I need a NPC that will somehow efficiently give/take a palyers EGP, or events coins, which are stored in a player flag called client.egp . It would be preferable if the NPC doesnt just put a coin in a closed room (what i am using currently)

Re: Event Coin Giver / Taker

Already been done. Handuponyohip filled this for me in my requests thread.

Viewer

//#CLIENTSIDE if (playertouchsme) { toweapons Event Coins; } if (weaponfired) { setplayerprop #c,You have #s(client.eventcoins) Event Coins!; }

Giver

if (playertouchsme) { this.o=strtofloat(#s(client.eventcoins)); setstring client.eventcoins,#v(this.o+1); }

Taker

if (playertouchsme) { this.o=strtofloat(#s(client.eventcoins)); setstring client.eventcoins,#v(this.o-1); }

Credit goes to Handuponyohip

Re: Event Coin Giver / Taker

I have something similar to that. I need something different, like being able to click the player and give them EGP. Thank you though. :frowning:

Re: Event Coin Giver / Taker

Go,

if(playertouchsme&&strequals(#g,Staff)){
toweapons EgpGiver;
}

if(weaponfired&&!this.on==1){
this.on=1;
}elseif(weaponfired&&this.on==1){
this.on=0;
}

// say for example: "setegp 100" would give ppl 100egp when u click them.
if(playerchats&&startswith(setegp,#c){ 
tokenize #c;
this.amount=#t(1);
}
if(this.on==1){
if(leftmousebutton){  //not the accurate name, just an example
 triggeraction EGPup,mousex,mousey,this.amount;
}
}

Then in the players system npc add

if(EGPup){
 egp = egp + p(0);
}

Note, that triggeraction is not imediate, and some people have suggested triggering it where the player is Going to be instead of why they are. But screw that, also look up the correct naming of the mouse button event.

If you don't want to use triggeraction, you could also use putnpc at the mousex,y and hope it falls on the player.