dat frog looks suspicious
- Viewing Profile: Reputation: PcPocket
Community Stats
- Group Members
- Active Posts 12
- Profile Views 2975
- Member Title Member
- Age Age Unknown
- Birthday Birthday Unknown
-
Gender
Not Telling
#52992 Anti WPE - Packet Obfuscation
Posted by PcPocket on 16 March 2015 - 01:57 AM
#52637 [Queue] 2 new commands
Posted by PcPocket on 10 March 2015 - 11:44 AM
Yeah.. the system I'm working is a BG system too.
I use queueremove on everybody on the queue when it is full enough to start the match.
And queueopt to call a function that will remove the player from the queue ( on the 3 options, move from map, die or logout ).
After I player 2 modules, the queue gets to -1. I will do some tests to figure out whats the reason. If I don't find out, I will patch in the source to never get it below 0 haha.
By the way, queue check command:
bool script_hqueue_check(int idx, int var) { if( idx < 0 || idx >= script->hqs || script->hq[idx].size == -1 ) { ShowWarning("script_hqueue_add: unknown queue id %dn",idx); return false; } else { int i; for (i = 0; i < script->hq[idx].size; i++) { if (script->hq[idx].item[i] == var) { return true; } } return false; }}BUILDIN(queuecheck) { int idx = script_getnum(st, 2); int var = script_getnum(st, 3); script_pushint(st,script->queue_check(idx,var)?1:0); return true;}
They may want to invert the 'true' and 'false' returns, as all queue commands return 0 upon success ( why? I don't know )
And of course, the rest.
BUILDIN_DEF(queuecheck,"ii"),
script->queue_check = script_hqueue_check;
script.h
bool (*queue_check) (int idx, int var);
@Edit
I found out the piece of code causing it.
function Players2BG { .@queue01 = queueiterator(getarg(0)); for (.@elem = qiget(.@queue01); qicheck(.@queue01); .@elem = qiget(.@queue01)) { announce "Adding player"+.@elem+" from queue"+getarg(0)+" to BG Team "+getarg(1),8; player2bg(getarg(1),.@elem,$@BG_Status); queueremove(getarg(0),.@elem); // Removes from the queue } return;}
Then, the second time I go to the battleground ( the first one works fine ):
(
( the announce is in portuguese in the picture )
getarg(0) = Queue ID
getarg(1) = BG Team ID
I'm almost sure that I'm missing a qiclear in the end of the function, will test it now, must solve it.
But.. I still think that the number of elements in the queue shouldn't be able to be lower than 0.
@edit2
Yeah.. qiclear didn't solve the problem.
I tested something new, I put 'queueremove($bgTeamQueue01,-1);' in the top of npc script, so everytime I click on it, it attempts to remove a non-existant value from the queue.
Result: After I played one match, every queueremove, lowered the queuecount by 1. So if I click 10 times, npc show that queue has -10 members..
This just works after I play once ( so Players2BG gets called ).
Trying to figure out why.
@edit3
Yeah, there is a bug in queueremove command, trying to fix, post here soon.
@edit4
Aparently, queueremove isn't actually removing a value from the queue, but changing it value to -1?
- Viewing Profile: Reputation: PcPocket
- Privacy Policy
- Hercules Forum Rules ·