Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Event coins (https://forums.graalonline.com/forums/showthread.php?t=61884)

excaliber7388 10-23-2005 08:29 PM

Event coins
 
Here's what I have so far for an event coin script. The only problem is, instead of adding the event coins to another player, it adds it to your own couunt! whats wrong? (this is a two part script, the first part is the part that makes the event coin, the second is the part for the player to recieve it)
NPC Code:

if(actionserverside){
if(strequals(#p(0),EC)){
with(getplayer(#p(2))){
setstring clientr.eventcoin,#v(strtofloat(#s(clientr.eventco in))+1);
setstring server.eventprize,#v(strtofloat(#p(3)));
savelog2 StaffToollog.txt,Staff="#p(1)" Added Eventcoins To Player="#p(2)"
Ammount="#p(3);
}
}
}
//#CLIENTSIDE
if(playerchats){
if(strequals(#t(0),/addeventcoin)){
triggeraction 0,0,serverside,Events Team/Coin system,EC,#a,#t(1),#t(2);
triggeraction 0,0,serverside,-eventcoinsystem,ECup;
}
}

if(weaponfired){
say2 say /addeventcoin "account"#b
to give that player an #b
event coin. #b
Do not abuse this, it is watched.;
}


now the part for the player:
NPC Code:

if(actionserverside){
if(strequals(#p(0),ECup)){
setstring clientr.eventcoin,#v(strtofloat(#s(clientr.eventco in))+1);
triggeraction 0,0,clientside,-eventcoinsystem,text;
}
}

//#CLIENTSIDE
if(actionclientside){
if(strequals(#p(0),text)){
setplayerprop #c,Got an event coin!;
}
}

if(created || timeout){
showimg 3111217,dr-eventcoin.png,15,130;
changeimgvis 3111217,5;
showtext 3111218,28,135,Arial,b,#s(clientr.eventcoin);
changeimgvis 3111218,6;
changeimgcolors 3111218,0,0,0,1;
changeimgzoom 3111218,.8;
timeout=.05;
}


ZeLpH_MyStiK 10-23-2005 08:45 PM

Because when you trigger -eventcoinsystem serverside, it's still doing it for the player activating it.
Also, is it just me or does this script seem really redundant? Wth is server.eventprize string for? According to syntax, it doesnt get set to anything.

excaliber7388 10-23-2005 11:05 PM

no, I changed this a lot, origionally it would boost the event coins by the said ammount, but then I realized that this could be abused, so I changed it to only one per event won. And how do I cange it so it happens to the other player, not the events team member doing it.

Maniaman 10-23-2005 11:55 PM

Quote:

Originally Posted by ZeLpH_MyStiK
Because when you trigger -eventcoinsystem serverside, it's still doing it for the player activating it.

Also, what you are doing could easily be done in 1 script.

excaliber7388 10-24-2005 01:19 AM

true, but the second script is for displaying the event coins in the corner. And wouldn't it still do it for the player activating it if it were clientside?

jake13jake 10-24-2005 09:58 AM

gah, this ugly code makes me love gscript2 soo much more. I'd just do players[index].clientr.blah++; Don't you just love it? I actually never learned that in gscript1. GScript1 is just too damn confusing. GScript2 improves Massokre as a scripter.

Skyld 10-24-2005 12:49 PM

  • Player's chat can be set serverside - no actionclientside needed
  • Do you really need to redraw the event coin count every 0.05 seconds?
  • As Maniaman said, this could be easier done in one script, and just using a check of some description to filter out staff from players

excaliber7388 10-24-2005 09:34 PM

Still gives the event coin to the person who says it x_X

Skyld 10-24-2005 09:42 PM

Quote:

Originally Posted by excaliber7388
Still gives the event coin to the person who says it x_X

I do wish you would stop dismissing problems.

excaliber7388 10-24-2005 09:52 PM

Oh wow, I got it NVM duh, sorry guys X_X this was a dumb one lol


All times are GMT +2. The time now is 07:28 PM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.