![]() |
onActionClientSide Weirdness
This has happened to me on two seperate occassions, and for the life of me I cannot work out why.
What happens is that when I trigger the client from serverside, the function onActionClientSide appears to execute twice, instead of once from the trigger on the serverside. Normally, this wouldn't be a problem for me, but for functions which add text to a list, this is quite frustrating, as I get double the amount of text that I should. Can anyone explain this? |
Post your code (at least relevant sections, i.e. the triggers).
Also, check that the triggerClient isn't actually being called twice (add an echo near it—if you see it twice, it's something else). |
PHP Code:
|
Quote:
PHP Code:
PHP Code:
|
Not sure if it would be the cause, but you're missing a closing bracket
|
Quote:
Was copying and pasting it out of the middle of a function and adding brackets on the forums. It's okay in my script. |
You should be verifying that params[0] is "GotPlayers" in your onActionClientSide. I question your switch statement as well because it doesn't appear you're using a break for each, which could cause a falling through and adding rows for no reason.
|
Quote:
I was verifying params[0] after that function was called, so that the function would be called no matter what params[0] was, but it seems that placing the function after the verification fixes the problem, so thanks fowlplay. Why would it be called twice in the first place though? |
Quote:
|
Quote:
If you were to make an NPC script of: PHP Code:
So the missing bracket probably is the cause here. |
I remember having a similar problem before with NPCs joined to the same class in one level, and if the player was in that level and executed a block of code with that NPC it'd execute twice. Though, I don't think that's the case here. Probably the missing bracket.
|
All times are GMT +2. The time now is 09:11 PM. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.