![]() |
Quote:
|
Quote:
PHP Code:
|
Yea I know but I am trying to get it to work severside first. If it works severside I can put all the public functions clientside and get the same result clientside only, right? Plus my door script is at the top of this page with no //#CLIENTSIDE, and that's how it is in the script as well.
|
Well for the most part because it is server-side you don't have to do the..
SwitchDB = findnpc("SwitchDB"); because the NPC is accessible via it's name without having to declare a global variable. Following KISS theory... SwitchDB PHP Code:
PHP Code:
PHP Code:
In my own "switch" system I store the main controller object (i.e: the door) and it's respective array of switches, and send a trigger to the main controller when a switch is updated (pressed on and off for instance) and the controller loops through the switches and performs the necessary logic (all switches are pressed down) and acts accordingly. |
That seems easy enough. Thanks for the help, but will it work clientside. I was trying to avoid the trigger because i didn't think i could call one clientside to clientside? I will try it and see! Thanks everyone!
I tried fp4's script and it works just gotta change some of it around. Works clientside as well... |
Quote:
I.e: PHP Code:
Also about your trigger worries, because you're staying on the same side it's really not that big of deal at all and has about the same impact as calling a public function. It's when you're going from client<->server that it becomes important to minimize the amount of triggerserver/clients/actions. |
Quote:
|
Ok so the main reason I was trying to use a public function was to make sure that the script could be done clientside. Here is what I am working with now. It works, once but not twice, and is very very slow. Any pointers here would be great
The Switch: PHP Code:
PHP Code:
|
If you style your script properly you'll see the following..
PHP Code:
Also something about calling onTimeout directly like that is just unsettling to me, the only time I do that is when I'm hacking around with code. Recursion crash example: PHP Code:
|
Quote:
I don't know if that will cause any problems with lag and so forth, but it works fine when sleep and the player.size were removed. Guess i could slow the Timeout down and then speed it up again..lol.. that just came to me as I was typing.... Thanks Again. |
Ok on the same subject still... I place the custom bomb on a switch which opens a door, when the bomb explodes the door closes. This part works great except the door opens serverside. The bomb has an owner, and I transfer that info to the switch which has the acct in the trigger that sends it to the door. When it gets to the door the door still opens for everyone serverside. I want it to work clientside so everyone will have to open the door using their own bomb. The owner of the bomb is stored with a var (this.owner), and I don't know if it needs to be a trigger.
|
Store the owner's account in attr[i]bute and check it like how you're doing it up there..
I.e: (temp.i.isinclass("bomb") && temp.i.attr[1] == player.account) |
| All times are GMT +2. The time now is 06:08 AM. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.