Disallowing to buy equipment…
-
I have a general question. From the HkServerImpl routines - most are calling the Server.xxxx routine for several stuff. One that i am using currently is to disallow goods to be bought.
However i have a current implementation where this works the way that i first buy the good, valid the good and if its not valid then i sell the good afterwards.
However somehow i find this too much of what is needed. For example when buying equipment the function ReqAddItem is called. This will then call the Server.ReqAddItem function.I thought that when i check the goods if they are valid and return from this function prior the Server.ReqAddItem call that this item in first instance is not bought. Anyway this seems not to work. Just adding a return before the function call results that the good is bought anyway.
Is there a way to prevent this - in my eyes - long winded procedure to achieve what i want to achieve?
As a hint - i am not working with the plugin version of the hook. Have seen there are PLUGIN returncodes and before the Server.xxx routines are called a return is called. However i thought that it should work also in the non plugin version with the return - but somehow not. Any hints? Thanks in advance - help is much appreciated
-
Ok i got a bit further with this. I am at this point that the items are not added to the cargo - so thats how I want it to be.
But now i have another problem. The “BUY” button afterwards disappears and i have no clue why - and it just appears if i open the equipment dealer again. I return from any server call if the item shall not be added and voila that works. But what has that button to do with that?
Is there something wrong actually by not calling the server functions?
Any hint would be appreciated. So thanks in advance.edited:
I just could limit it to ReqAddItem function. If i return prior to the server call (Server.ReqAddItem) than this button is disappearing. If allow the server call then the item is equipped and mounted (as far as a free mount is available). But the button is left available and i could try to buy other stuff… -
Not sure how to completely supress it, but by returning the reqadditem call you effectively emulate a lag (the client expects a reliable answer). Did you ever have lag during buying something? One of the effects is that the buy button will disappear until the espected message has arrived.
-
Yeah i expect that the server requires this function call. I believe internally something like the following happens:
If player buys the equipment
disable the button
run through the buy routines (that would be ReqAddItem)
if everything is ok enable the button again
further stuff….I have a workaround for this - but thought this workaround could be useless if it directly could be avoided to add the item. Even if i set the count and mount variable to 0/false the item is added - what is a bit strange.
It is just wondering me - because the PluginVersion also returns prior the server.reqadditem routine. And i am asking myself if this never has been an issue before?