I couldn't find the article I was looking for on the wiki, so I'll summarize for you.
You need to change the player's money serverside. The best way to do this would be to trigger serverside like this
PHP Code:
triggerserver("gui", name, "sellFish", "Salmon");
Then, at the top of your script (on serverside), you need to determine how much salmon the player has, then figure out how much to pay them. Take away the salmon, then pay the player.
PHP Code:
function onActionServerSide(cmd, fish) {
if (cmd == "sellFish") {
if (fish == "Salmon") {
temp.amount = clientr.fish.Salmon;
temp.pricePerFish = 15;
clientr.fish.Salmon = 0;
clientr.money += (pricePerFish * amount);
}
}
}
This is a basic outline of what you want to do. If you were to add the rest of your script, it would look like this:
PHP Code:
function onActionServerSide(cmd, fish) {
if (cmd == "sellFish") {
if (fish == "Salmon") {
temp.amount = clientr.fish.Salmon;
temp.pricePerFish = 15;
clientr.fish.Salmon = 0;
clientr.money += (pricePerFish * amount);
} else if (fish == "Shrimp") {
temp.amount = clientr.fish.Shrimp;
temp.pricePerFish = 10;
clientr.fish.Shrimp = 0;
clientr.money += (pricePerFish * amount);
} // and a long list of else-ifs paying the player
}
}
//#CLIENTSIDE
// insert all your GUI stuff here
function MyGUI_Button1.onAction() {
triggerserver("gui", name, "sellFish", "Salmon");
}
function MyGUI_Button2.onAction() {
triggerserver("gui", name, "sellFish", "Shrimp");
}
// and all the other buttons, etc
However, an easier way to do the serverside bit would be
PHP Code:
function onActionServerSide(cmd, fish) {
if (cmd == "sellFish") {
// now you need to figure out how much to pay for each fish, so
// add it to the list here
temp.price.Salmon = 15;
temp.price.Trout = 10;
temp.price.FlyFish = 5;
temp.price.Shrimp = 10;
// add all the other fish as well here
// now that you did that list, you don't have to add anything else
// down here for each fish
temp.amount = clientr.fish.(fish);
temp.pricePerFish = temp.price.(@ fish);
clientr.money += (amount * pricePerFish);
clientr.fish.(fish) = 0;
}
}
This just saves work, and makes it easier to change things later on. If that method confuses you, use the first one. Remember you're going to have to change the variables around to fit your server (e.g. clientr.money, clientr.fish.name)