Login x
User Name:
Password:
Social Links Facebook Twitter YouTube Steam RSS News Feeds

Members Online

»
0 Active | 7 Guests
Online:

LATEST FORUM THREADS

»
warfare
CoD4 Map + Mod Releases
Voting menu on maps
CoD+UO General
Hauling 911
CoDBO3 General

Forums

»

Welcome to the MODSonline.com forums. Looking for Frequently Asked Questions? Check out our FAQs section or search it out using the SEARCH link below. If you are new here, you may want to check out our rules and this great user's guide to the forums and the website.
For more mapping and modding information, see our Wiki: MODSonWiki.com

Jump To:
Forum: All Forums : Soldier of Fortune
Category: SoFII Mapping
Mapping, modeling, scripting, skinning and all forms of editing for the game Soldier of Fortune II
Moderators: foyleman, Foxhound, Mystic, StrYdeR, batistablr, Welshy, DrBiggzz, supersword
Latest Posts
Subscribed Posts
Search
Restricted Access Topic is Locked
Page
Next Page
subscribe
Author Topic: Code Help
Battosai~rb
General Member
Since: Dec 23, 2006
Posts: 105
Last: Dec 23, 2006
[view latest posts]
Level 4
Category: SoFII Mapping
Posted: Saturday, Feb. 21, 2004 07:13 am
hey im a noob coder and i know acouple things but i still need alot to learn, my problem is im able to make the command rcon addadmin and sucessfully have an admin file apear but whenever i type rcon addadmin it automaticly adds client 0 wether i type addadmin 1000 or addadmin dsauifhdsui it always adds client 0 can anyone help me make the admin command work. also i added the /adm command from  the tutorial "code dump woo" but any one can use it wether i added them or not i hope some oen can help  :s6:
Share |
ShoT~rb
General Member
Since: Dec 23, 2006
Posts: 24
Last: Dec 23, 2006
[view latest posts]
Level 1
Category: SoFII Mapping
Posted: Saturday, Feb. 21, 2004 09:52 am
I dont know bro, that's not my area, if I was you, Id do LOTS of research, both SoF2 and JK2 because they use the same commands and code, and if you put this and that together you might get it, other than that, keep looking.
Share |
RyanX~rb
General Member
Since: Dec 23, 2006
Posts: 625
Last: Dec 23, 2006
[view latest posts]
Level 6
Category: SoFII Mapping
Posted: Saturday, Feb. 21, 2004 02:43 pm
if (Q_stricmp (cmd, "addadmin" ) == 0 )
{
Svcmd_AddAdmin_f();
return qtrue;
}



void Svcmd_AddAdmin_f( void )
{
gentity_t *ent;
int clientNum;
char str1[MAX_TOKEN_CHARS];

if ( trap_Argc() < 2 ) {
Com_Printf("Usage: AddAdmin <ID>\n");
return;
}

trap_Argv( 1, str1, sizeof( str1 ) );
clientNum = atoi ( str1 );
ent = g_entities + clientNum;

if ( !isIDValid( clientNum ) ) {
trap_SendServerCommand( ent->s.number, va("print \"Invalid client ID: %i\n\"", clientNum ));
return;
}

if ( ent->client->pers.connected == CON_CONNECTED )
{
AddToUserFile( clientNum, "admin", "Admin" );
return;
}
}



void AddToUserFile( int clientNum, char *prefix, char *prefix2 )
{
gentity_t *ent, *tent;
char *name, *string, *ip, str1[MAX_TOKEN_CHARS], userinfo[MAX_INFO_STRING];
int lvlTime, msgTime;
fileHandle_t f;

if ( trap_Argc() < 2 ) {
return;
}

lvlTime = level.time;
msgTime = lvlTime + 5 * 1000;
ent = g_entities + clientNum;

if ( ent->client->pers.connected == CON_CONNECTED )
{
trap_GetUserinfo(ent->s.number, userinfo, sizeof(userinfo));
ip = Info_ValueForKey (userinfo, "ip");
name = ent->client->pers.cnetname;

trap_FS_FOpenFile( g_file.string, &f, FS_APPEND_TEXT );
if ( !f )
{
Com_Printf( "WARNING: Cant open user file!\n" );
return;
}

string = va("%s\n", IPFilter_FilterIP(ent, va("%s!%s",prefix,ip)));
trap_FS_Write( string, strlen( string ), f );
trap_FS_FCloseFile( f );

if ( Q_stricmp ( prefix, "sadmin" ) == 0 ) {
ent->client->sess.sadmin = qtrue;
}
if ( Q_stricmp ( prefix, "admin" ) == 0 ) {
ent->client->sess.admin = qtrue;
}
if ( Q_stricmp ( prefix, "referee" ) == 0 ) {
ent->client->sess.referee = qtrue;
}
if ( Q_stricmp ( prefix, "nokick" ) == 0 ) {
ent->client->sess.nokick = qtrue;
goto NOKICK;
}
if ( Q_stricmp ( prefix, "ban" ) == 0 || Q_stricmp ( prefix2, "ban" ) == 0 ) {
ent->client->sess.ban = qtrue;
return;
}

trap_SetConfigstring ( CS_GAMETYPE_MESSAGE, va("%i,@^3%s^7 is now a %s", msgTime, name, prefix2 ) );
NOKICK:;
trap_SetConfigstring ( CS_GAMETYPE_MESSAGE, va("%i,@^3%s^7 is now %s", msgTime, name, prefix2 ) );
Com_Printf( va("User %s added to file.\n", name ) );
GlobalSound("sound/misc/events/buzz02.wav");
return;
}
}




go play
Share |
Battosai~rb
General Member
Since: Dec 23, 2006
Posts: 105
Last: Dec 23, 2006
[view latest posts]
Level 4
Category: SoFII Mapping
Posted: Sunday, Feb. 22, 2004 01:01 am
hey i added that into my addadmin code in my svcmds section but when i try compiling i get errors, can u explain it alittle?
Share |
RyanX~rb
General Member
Since: Dec 23, 2006
Posts: 625
Last: Dec 23, 2006
[view latest posts]
Level 6
Category: SoFII Mapping
Posted: Sunday, Feb. 22, 2004 03:13 am
u get errors because u have missing prototypes... which i never posted... remove them and change the ip to guid or something. as i said *play*

i dont really have time to explain sorry.
Share |
Battosai~rb
General Member
Since: Dec 23, 2006
Posts: 105
Last: Dec 23, 2006
[view latest posts]
Level 4
Category: SoFII Mapping
Posted: Sunday, Feb. 22, 2004 03:21 am
hmm ok well ill play with it alittle but this all goes into svcmds right?, also if u can add me on msn mine is battosai106@hotmail.com, also do i have to add code in other files? like the header file G_local, i got rid of all the errors by deleting abunch of stuff but the only thing that works is when i type rcon addadmin it says usage addadmin id# but when i type addadmin 1 or 0 it just says addadmin
and nothing more
Share |
RyanX~rb
General Member
Since: Dec 23, 2006
Posts: 625
Last: Dec 23, 2006
[view latest posts]
Level 6
Category: SoFII Mapping
Posted: Sunday, Feb. 22, 2004 02:54 pm
yes. g_local has sadmin, admin, referee, etc in the clients session. add me my list is full

xyz@adminmod.soffiles.com
Share |
Battosai~rb
General Member
Since: Dec 23, 2006
Posts: 105
Last: Dec 23, 2006
[view latest posts]
Level 4
Category: SoFII Mapping
Posted: Monday, Feb. 23, 2004 01:57 am
okay so ive got every thing down i had to do alot of thinking but i figured out most things except, when i addmyself to the admin list and i leave the server and come back i have to re-add myself to the list in order to use admin powers, how do i fix it so that once im on the list im admin untill im removed from the list and also when i add another person plus myself the admin list lists it horizontally how do i make it so the names go undereach other, im pretty sure i need to add the new line command some where but im not sure where:O
Share |
RyanX~rb
General Member
Since: Dec 23, 2006
Posts: 625
Last: Dec 23, 2006
[view latest posts]
Level 6
Category: SoFII Mapping
Posted: Monday, Feb. 23, 2004 09:41 am
when i have time i will make one for gold.

i mod for 1.00 thats why it wont work for you.
Share |
RyanX~rb
General Member
Since: Dec 23, 2006
Posts: 625
Last: Dec 23, 2006
[view latest posts]
Level 6
Category: SoFII Mapping
Posted: Monday, Feb. 23, 2004 09:41 am
also you need to add a read... when the client connects...


did u manage to get it to add something to the file?
Share |
Restricted Access Topic is Locked
Page
Next Page
subscribe
MODSonline.com Forums : Soldier of Fortune : SoFII Mapping

Latest Syndicated News

»
Codutility.com up and runn...
Nice, and there still using the logo and template for the screenshots, which...
Codutility.com up and runn...
dundy writes...Quote:Call of Duty modding and mapping is barly alive only a ...
Codutility.com up and runn...
Mystic writes...Quote:It seems to me the like the site is completely dead? ...
Codutility.com up and runn...
It seems to me the like the site is completely dead?

Partners & Friends

»