-=-
Menu
Tournaments
Profile
Poll
Latest videos
Latest comments
2017-10-22: "Gauntlet is onl..." -MasterSven
2017-10-22: "Throw elmsuper ..." -Jelly Jam
2017-10-22: "WW is relativel..." -KRSplatinum
2017-10-22: "Or Epitome/ww/b..." -MasterSven
2017-10-22: "bblair/je???you..." -KRSplatinum
2017-10-22: "No bblair, no l..." -Jelly Jam
2017-10-21: "No Urbs, no win..." -MasterSven
2017-10-21: "Haha good job M..." -Slaz
2017-10-21: "haha, well play..." -[GpW]Urbs
2017-10-20: "CDF was on the ..." -Slaz
Latest matches
flag [CDF] [10:04] [GpW]flag
flag [GpW] [07:05] [CDF]flag
flag CX [09:02] -t3>flag
flag CC [13:06] [GpW]flag
flag [GpW] [06:03] [CDF]flag
flag CX [18:00] [GpW]flag
flag -t3> [07:06] [GpW]flag
flag -t3> [03:02] CXflag
flag CX [08:00] -t3>flag
flag -t3> [11:04] [GpW]flag
Latest forum posts
By: pirate, in: Funniest moments! « Forum games2017-12-16 22:07
[22:04:50] TreyLina: ah yeah i think i know why i ...
By: pirate, in: Funniest moments! « Forum games2017-12-16 21:08
[21:01:46] Smoke[NC]: there was supposed to be a s...
By: Jelly Jam, in: Who is the best Serbian player?!? « JJ2 related2017-11-20 03:18
lol welcome back xd
By: Ahmo, in: Who is the best Serbian player?!? « JJ2 related2017-11-20 01:43
Hordy Anyday !! also Arte with radar was hard to ...

JJnet's forum

«Latest posts» «Latest threads» «Search» «User CP»

     Need help with some angelscript coding! | [q]2015-06-09 17:59
Gigoavatar
JJnet user

Posts: 2
0
Hello!

So i just joined this forum. But you may recognize me from playing at puke nukem tests since last few months.

Anyway i've been trying to write some sort of test manager in angel script. The problem im stuck at is using the jjSendPacket() and onReceive().

Heres the part of the code that ruins my TM:
Code:

void wyslij()
{
        jjSTREAM plikNicks("GigoNicks.asdat");
        if(!plikNicks.isEmpty()) jjSendPacket(plikNicks);
}
void onReceive(jjSTREAM &in plikDane, int fromClientID)
{
        int dataType;
        plikDane.pop(dataType);
        if(dataType >= 0)
        {
                dlugoscPliku = dataType;
                for(int i = 0; i < dlugoscPliku; i++)
                {
                        plikDane.push(userNicks[i]emo;
                }
        }
        if(dataType == -1)
        {
                for(int i = 0; i < dlugoscPliku; i++)
                {
                        plikDane.push(userPoints[i]emo;
                }
        }
        if(dataType == -2)
        {
                for(int i = 0; i < dlugoscPliku; i++)
                {
                        plikDane.push(userProgress[i]emo;
                }
        }
}


(few things and variables are named in polish, sorry for that)

EDIT: lol part of the code got changed to emoticons ( those parts: " ) ;" without space)

You can probably ignore the whole content of "void onReceive()" as I even tried removing it and still got the same issue.
Its the jjSendPacket itself that causes problems: When another player joins my server, he gets instantly kicked with the "server denied you" error.
By instantly I mean he can stay in the server for up to 2 seconds - but thats becouse the function wyslij() is called every 2 seconds (every 140 frames). And btw. this function is only called by host (dunno if it has anything to do with my issue)
I've been stuck at this problem for some longer time and cant quite figure it out - angelscript debug says nothing about that. As soon as i remove jjSendPacket() those errors stop occuring - but thats not quite how I want my TM to work...

I hope there are some angelscript experts on this forum.
Thanx in advance
Replies
KRSplatinum
CC
avatar
JJnet user
Posts: 240
8
#1 | [q]2015-06-09 23:24
Why the semicolons just before the closing brackets? Is that needed? To me, a semicolon would indicate there will be another line of code before the closing brackets. I mean like instead of

Code:

{
 xyz;
 abc;
}


try:

Code:

{
 xyz;
 abc
}


Maybe that's just a mainstream tactic that doesn't apply in J2AS. Also it probably makes no difference
Gigo
avatar

JJnet user
Posts: 2
0
#2 | [q]2015-06-10 21:59
Well nevermind. I got it to work. The problem was caused by the packets being too big. Thanks to SE for help emo Thread can be closed now.