Jump to content
SubSpace Forum Network

Recommended Posts

Posted

ok i got 2 things to say which i found out during programming a ballgame bot.

the EVENT_SoccerGoal is to slow if you want the bot to awnser "!cgive :5000" and you score 2 goals within 4 secs it doesnt count the second goal :angry: :D .

 

Well becouse doesnt seem to work i pimped the event a bit but now i found another problem.

I made it such a way that all the player who are willing to goal need to sign up with a commands so they get setfreqed to a private freq (1v1v1v1 style). now i need to create the plugin such a way that it setfreqs everyone in a diferent frequency.

this is what i came up to:

 

if (c->check("joinball"))
		int i = 100;
		{
			sendPrivate(p, "*setfreq " + String(i));
			sendPrivate(p, "Good luck playing. SCORE THOSE GOALS!");
			i++;
		}

 

The only thing it sais now is:

Bot> *setfreq 100

Bot> Good luck playing. SCORE THOSE GOALS!

 

Its coused becouse of the fact int i = 0; gets repeated every time someone usees !joinball.

Puting "int i = 100;" before "if (c->check("joinball"))" somehow also doesnt work :( :angry: .

 

Does anyone know a solution?

For more scrypting details:

 

MSN: peeps_are_!@#$%^&*@hotmail.com

INGAME: Witchie NL (Probebly in SSCC Desert Storm.)

Posted

If you put i (I suggest renaming it) in spawn.h initialized to 0, you should be able to change your code to:

if (c->check("joinball"))			
{
sendPrivate(p, "*setfreq " + String(100 + (i % 4)));
sendPrivate(p, "Good luck playing. SCORE THOSE GOALS!");
i++;
}

Posted

ok i dont get this dud duno if its me blum.gif . prob me, my english isnt realy well. Ok ill contact you ingame.

dont know what you ment with the spawn.h thing but the only thing it needs to do is send every person who uses !joinball, setfreq to all diferent freq's.

 

Example:

 

Person1> !joinball

bot> *setfreq 101

 

Person2> !joinball

bot> *setfreq 102

 

Person3> !joinball

bot> *setfreq 103

 

etc..

etc..

Posted

no i dont blum.gif now the freqs 100 to 200 are registered, but i got another question:

If i do !stopball everyone is still in that private freq, but they need to be put back to freq 0 and freq 1 to keep them even. anyone an idea how to setfreq half of the players to freq 1 and the other half to freq 0 if you do !stopball?

Posted

Something like this ought to do the trick

if (c->check("stopball"))			
{
//using the same variable as before is an easy way to reset it
i = 1;
//for each player, do this:
{
	if(freq >= 100)
		sendPrivate(p, "*setfreq " + String(i ^= 1);
}
}

Posted

ok dude i created it and this is what i came with in command.cpp:

if (c->check("stopball")) /// check command for stop
{					
	startball = false;
	sendPrivate(p, "Now see what you've done, Now it stoped!"); /// stoped
	sendPublic(SND_Scream, ".*arena Ballgame has now ended. Thank you for playing and enjoy your stay at DS. - DSstaff");
	sendPublic(SND_Scream, ".*arena Ballgame has now ended. Thank you for playing and enjoy your stay. - DSstaff");
	sendPublic(SND_Scream, ".*arena Ballgame has now ended. Thank you for playing and enjoy your stay at DS. - DSstaff");
	int i = 1;
	{
		if(freq >= 100)
		sendPrivate(p, "*setfreq " + String(i ^= 1));
	}
}

 

now when i try to compile it gives the error:

e:\mervbot\src\ballgame\command.cpp(197) : error C2065: 'freq' : undeclared identifier

sounds logical with me coz freq isnt an defined integer... Do i miss something in spawn.h?

Guest
This topic is now closed to further replies.
×
×
  • Create New...