![]() |
small problem
Hello, recently I've been working with a weapon npc which, is supposed to show a gui bitmap button when a player enters certain levels. The problem is that, even thought I manage to display the button when I am on one of those levels, I haven't been able to remove the button when the player leaves the level. I've tried two different approaches and, none worked as expected. My first approach was to loop through an array with the levels and test if the level was in the array. My second approach was using the onPlayerEnters event and check is the player was on one of those levels. The second method worked fine, but I am unable to make it so the button disappears after the player leaves the level. any suggestions?
PHP Code:
|
Just a suggestion, but maybe use the visible flag since you're going to be using the same button over and over.
I remember is GS1 there was the flag 'playerleaves'. You can probably try onPlayerLeaves() and see if that works |
Quote:
edit: D: It didn't work.. apparently onPlayerLeaves() doesn't work as an event... |
Well, why are you doing:
PHP Code:
Also when you start showing a GUI, it'll remain untill it's destroy()ed, and in this script, you're just checking if the GUI should be showed, if yes you show it, if not you don't. Using a TimeOut here is just unnecessary, I'd suggest you do: PHP Code:
|
Quote:
edit: nvm I found an easier way after stopping and thinking about it for second. To fix it I set a variable with the current player.level, and then I just checked onPlayerEnters to see if it's different. Basically: PHP Code:
|
Make sure you're doing
PHP Code:
|
Quote:
|
Maybe better if you did this
HTML Code:
function onPlayerEnters() { |
That seems like really good method, I will try it out.
|
| All times are GMT +2. The time now is 01:11 PM. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.