![]() |
Fish Selling System Help
Ok, so I have this fish buying system. It's a gui I made with the f6 gui editor. It basically has like 20 buttons and if you have that fish and you want to sell it, you click on the name of the fish and it sells the fish to the npc 1 at a time.
It seems like it's working but right after it adds you money, it takes it away. Example: You fish for a catfish, you click "sell catfish", you get 10 dollars for the fish, then 1 millisecond later, you get it taken away and it goes back to the original amount of money you had before selling it. Here is the script. [/PHP] //#CLIENTSIDE function onCreated() { function onPlayerTouchsme() { MyGUI_Window1.visible = true; } new GuiWindowCtrl("MyGUI_Window1") { profile = GuiBlueWindowProfile; clientrelative = true; clientextent = "303,195"; canmove = true; canresize = true; closequery = false; destroyonhide = false; text = " Selling your Fish!"; x = 341; y = 214; new GuiButtonCtrl("MyGUI_Button1") { profile = GuiBlueButtonProfile; text = "Sell FlyFish"; width = 80; x = 2; y = 10; } new GuiButtonCtrl("MyGUI_Button2") { profile = GuiBlueButtonProfile; text = "Sell Shrimp"; width = 80; x = 2; y = 51; } new GuiButtonCtrl("MyGUI_Button3") { profile = GuiBlueButtonProfile; text = "Sell Bass"; width = 80; x = 2; y = 90; } new GuiButtonCtrl("MyGUI_Button4") { profile = GuiBlueButtonProfile; text = "Sell Salmon"; width = 80; x = 2; y = 132; } new GuiButtonCtrl("MyGUI_Button6") { profile = GuiBlueButtonProfile; text = "Sell StingRay"; width = 80; x = 219; y = 7; } new GuiButtonCtrl("MyGUI_Button7") { profile = GuiBlueButtonProfile; text = "Sell Carp"; width = 80; x = 220; y = 47; } new GuiButtonCtrl("MyGUI_Button8") { profile = GuiBlueButtonProfile; text = "Sell Octopus"; width = 80; x = 220; y = 89; } new GuiButtonCtrl("MyGUI_Button9") { profile = GuiBlueButtonProfile; text = "Sell JellyFish"; width = 80; x = 221; y = 130; } new GuiButtonCtrl("MyGUI_Button10") { profile = GuiBlueButtonProfile; text = "Sell Shark!"; width = 80; x = 112; y = 79; } new GuiTextCtrl("MyGUI_Text1") { profile = GuiBlueTextProfile; height = 20; text = "10$"; width = 18; x = 88; y = 14; } new GuiTextCtrl("MyGUI_Text2") { profile = GuiBlueTextProfile; height = 20; text = "20$"; width = 18; x = 85; y = 55; } new GuiTextCtrl("MyGUI_Text3") { profile = GuiBlueTextProfile; height = 20; text = "60$"; width = 18; x = 85; y = 96; } new GuiTextCtrl("MyGUI_Text4") { profile = GuiBlueTextProfile; height = 20; text = "50$"; width = 18; x = 87; y = 136; } new GuiTextCtrl("MyGUI_Text5") { profile = GuiBlueTextProfile; height = 20; text = "90$"; width = 18; x = 197; y = 10; } new GuiTextCtrl("MyGUI_Text6") { profile = GuiBlueTextProfile; height = 20; text = "30$"; width = 18; x = 197; y = 51; } new GuiTextCtrl("MyGUI_Text7") { profile = GuiBlueTextProfile; height = 20; text = "100$"; width = 24; x = 195; y = 95; } new GuiTextCtrl("MyGUI_Text8") { profile = GuiBlueTextProfile; height = 20; text = "110$"; width = 24; x = 196; y = 133; } new GuiTextCtrl("MyGUI_Text9") { profile = GuiBlueTextProfile; height = 20; text = "200$"; width = 24; x = 141; y = 60; } new GuiTextCtrl("MyGUI_Text10") { profile = GuiBlueTextProfile; height = 20; text = "Click on The button of the fish you would like to sell!"; width = 248; x = 22; y = 172; } } } function MyGUI_Button1.onAction() { // Button "Sell FlyFish" has been pressed if (hasweapon(Fish/FlyFish)) { player.chat = "I have sold (x1) FlyFish!"; player.rupees+=10; Player.removeWeapon("Fish/FlyFish"); } else player.chat = "I do not have a FlyFish!"; } function MyGUI_Button2.onAction() { // Button "Sell Shrimp" has been pressed } function MyGUI_Button3.onAction() { // Button "Sell Bass" has been pressed } function MyGUI_Button4.onAction() { // Button "Sell Salmon" has been pressed } function MyGUI_Button6.onAction() { // Button "Sell StingRay" has been pressed } function MyGUI_Button7.onAction() { // Button "Sell Carp" has been pressed } function MyGUI_Button8.onAction() { // Button "Sell Octopus" has been pressed } function MyGUI_Button9.onAction() { // Button "Sell JellyFish" has been pressed } function MyGUI_Button10.onAction() { // Button "Sell Shark!" has been pressed } [/PHP] check out towards the end to see the script I have. Please someone help me fix it. thanks [; |
Money changes, with other important stats (such as health, magic, etc) can only be changed on the serverside portion of the script.
Look into triggerserver and the onActionServerside() event :) |
Use please
|
On the topic of usability, you may want to consider a simpler dialog with three elements: a quantity, a drop down box (for fix selection) and a confirmation button.
|
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:
PHP Code:
PHP Code:
However, an easier way to do the serverside bit would be PHP Code:
|
Quote:
PHP Code:
|
Quote:
PHP Code:
|
Quote:
|
| All times are GMT +2. The time now is 01:23 PM. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.