-=-
Menu
Tournaments
Profile
Poll
Latest videos
Latest comments
2018-08-15: " ..." -Kyro
2018-08-15: "In that case, I..." -Ragnarok
2018-08-14: "I can be el exp..." -Anubis
2018-08-14: "I can broadcast..." -Toni
2018-08-14: "Do full censors..." -Ragnarok
2018-08-13: "To me, as a pla..." -Artegor
2018-08-13: "Kyro's post was..." -cooba
2018-08-13: "I'm guessing fo..." -Anubis
2018-08-13: "So many deleted..." -cooba
2018-08-12: "I direct a grea..." -ThunDer
Latest matches
flag [GpW] [09:14] CCflag
flag -t3> [06:14] CXflag
flag CC [18:11] [GpW]flag
flag [CDF] [05:22] [GpW]flag
flag not [04:08] -t3>flag
flag [GpW] [07:04] [CDF]flag
flag [GpW] [05:04] [CDF]flag
flag not [08:05] -t3>flag
flag [CDF] [06:02] [GpW]flag
flag -t3> [08:05] notflag
Latest forum posts
By: Kyro, in: Camel: Account system « Camel Servers2018-08-17 01:54
Greetings, We have reverted back to the old ac...
By: ShadowGPW, in: JJNet presents: The JJNet Season 13 CTF Level Making Contest! « JJ2 related2018-08-16 18:05
:goodgame:
By: Kyro, in: Show your desktop « Forum games2018-08-15 18:29
[url]https://camelservers.com/images/desktop.png[/...
By: ThunDer, in: Show your desktop « Forum games2018-08-15 18:20
[url]http://oi66.tinypic.com/2zsy49v.jpg[/url]

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
[GpW]
avatar
JJnet user
Posts: 252
9
#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.