![]() |
removeweapon()
Well, there's something weird about it..
lets see PHP Code:
This echoes all the player's weapons on login. However.. If I try to remove all weapons on login, something weird happens.. :( PHP Code:
So to get all weapons removed you have to reconnect like.. >5 times o.o;; Why is this? Anyone knows? |
Happened on Utopia too, is very annoying.
|
There are a lot of weapons that are hidden that are given to the player by the client... stuff like the server list, player list, client RC. I dunno if this is what you're talking about, I'm having a hard time understanding your post.
I don't think they can be removed. Also, your second loop isn't accurate. You should run a loop that removes weapons, then run a separate loop that echos the weapons. |
Quote:
|
When you call player.removeweapon() then its modifying player.weapons[], that's why the loop is only removing 14. Possible solution would be
PHP Code:
|
I do it like this on Mythic, work's like a charm:
PHP Code:
|
Wouldn't this work?
PHP Code:
|
Quote:
|
Quote:
Anyway, similar method, different language but guaranteed to work: PHP Code:
|
Quote:
If you want to delete stuff in an array part by part you need to start at the end so when you delete the element and the array shrinks in size you're not missing anything. When you're deleting a part from an array everything after it is decreasing in index so the for loop misses the element that replaced the one it just deleted while it moves on to the next highest index. Also in your Python code the 'cruux' variable is unnecessary. You're taking the length from the 'foo' array and creating a new array from it but not actually using variable 'i', so you should just do for i in foo: Edit: Quote:
|
Drakilors method would work too. He's using [0], not [temp.i], so it would just delete all first weapons in the list untill nothing's left.
|
Quote:
|
Quote:
|
Quote:
|
Quote:
|
Quote:
|
| All times are GMT +2. The time now is 02:47 AM. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.