![]() |
Buy System Help!
Class:
PHP Code:
PHP Code:
PHP Code:
Whenever I use the system this.item, this.price, and this.weapon ALWAYS = 0 in the actual GUI when you use it! Now I dont really know how to get that to say the NPCs variables, please help! |
You have to use thiso. instead of just this because of where you're using the variables.
|
Quote:
I finally got it to work!!! |
Quote:
Reason: this. when used in the scope of another object refers to that object, so you have to get the values from the origin "thiso." object. If you look at the output you'll see what's going on. PHP Code:
|
Do you know how to fix the problem when gralats go down then back up?
Like player.rupees -= this.price; The players rupees go down for .5 of a second then back up to the original rupees! |
Quote:
|
Is this the same as addweapon();?
|
Quote:
|
New Script Still Needs help, now it doesnt view the gui, and it hides on clicked. Nothing happens... I need major help...
Class: PHP Code:
NPC: PHP Code:
|
OOPS LMAO!!!
I put... } and //#CLIENTSIDE on the same line... xD! |
Quote:
|
The variables are only accessible on the client-side in your script above.
You can simply just place them on the server-side. PHP Code:
|
That Class still doesnt add the weapon and substract the gralats...
I tried your NPC as well... |
Quote:
PHP Code:
|
Quote:
|
Quote:
Quote:
You also really shouldn't define the weapon name and cost on the clientside since it opens it up for all sorts of abuse. |
Quote:
Also there's no problem with defining it client-side (saves a trip for sending the data via triggerclient, attribute or similar), the problem comes into play when you're not validating it on the server-side or when you don't keep them in sync (the same). So we can setup a weapon system to do this or use the simple triggeraction method which is a little more newbie friendly. Syntax: triggeraction(x, y, actionName, param0, param1, [...]) x - The x coordinate to trigger y - The y coordinate to trigger actionName - The actionEvent to hit. I.e: Passing "Buy" will trigger onActionBuy on the server-side param0, param1, ... - Parameter data/message to send to the server. Example usage: PHP Code:
|
Quote:
|
Quote:
|
Suggestion: Have one DB NPC named something like "ShopControl" and trigger that using triggerserver. Triggering serverside to level NPCs is a pain in the ass.
|
Quote:
|
I still dont understand x_X
|
Triggering a DB-NPC with triggerserver.
DB-NPC (The dragon button): ShopControl PHP Code:
PHP Code:
|
Quote:
|
Quote:
|
Quote:
PHP Code:
Instead of using the params array, you should usually assign parameters a name, like so: PHP Code:
|
Quote:
|
Okay so I have this and it seems to be working, other then the part that the DB NPC only supports the item name custom to the script, I tried thiso.weapon for a, and thiso.price for b.
Current DB NPC: "Buy" PHP Code:
PHP Code:
PHP Code:
|
Quote:
PHP Code:
|
Quote:
NPC, DBNPC Name, param... Should I include thiso.weapon, and thiso.price? |
Add an echo into the onActionSeverSide event in the DB NPC and see if the trigger is being received.
|
Quote:
PHP Code:
|
Quote:
|
The problem is that the weapon and the price aren't defined. You'll need to have the client send information on the weapon when it sends the trigger. You could also have it send the price but that's a security risk.
My suggestion (since I doubt you want to use NPC registration, which is what I would do) is to have a list of prices for each weapon: PHP Code:
|
| All times are GMT +2. The time now is 11:40 PM. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.