GSC Advanced Co-Host List

TheNiceUb3r

Well-Known Member
Messages
46
Points
218
So I figured why the hell not the GSC community seems to be dying out a lot and I hate jiggy code and the one posted here already is ehh

So here is the one I have


Put this anywhere in your gsc's
(Remember to change the bottom functions to match yours or you will get script errors)
Code:
AutoHOST(player)
{
player endon("already_added");

name = player.name;

if (getDvar("customgametype") == "") {
    setDvar("customgametype", name);
} else {
    existing_name = "";
    
    cg_type = getDvar("customgametype");
    
    foreach (old_name in strTok(cg_type, ","))
    {
        if (name == old_name) {
            existing_name = name;
            player notify("already_added");
            break;
        }
    }
    
    if (existing_name == "") {
        setDvar("customgametype", getDvar("customgametype") + "," + name);
    }
}

wait 0.01;
self iprintln(name + " Was Successfully Added The The CoHost List");
Confirm = getDvar("customgametype"); //Don't really need this.
self iprintln("^2Current List: " + confirm);
//CHANGE THESE
player.status = "Co-Host";
player giveMenu();
Player welcomePlayer();
Player MessagesFuckers();
}
Now on your onplayerconnect()
Put this
Code:
cg_type = getDvar("customgametype");
        
            valid = 0;
        
            foreach (name in strTok(cg_type, ","))
              if (name == player.name)
              {
                  valid = 1;
                   break;
                   }
Now where it actually gives the player there status which looks something like this

Code:
 if(player isHost() || player.name == "" || player.name == "")//:bruh:
                player.status = "Host";

       else
                player.status = "Unverified";
Put this

Code:
                if(valid == 1)
                player.status = "Co-Host";
So it should look something like this

Code:
        if(player isHost() || player.name == "" || player.name == "")//:bruh:
                player.status = "Host";

       else
                player.status = "Unverified";
                if(valid == 1)
Now obviously to call it, It would be something similar to this

Code:
self add_option("CoHostOptions" + i, "^2Co-Host List", ::AutoHOST, player);

Now here is a little extra if you want to simply clear the whole list out do this

Code:
ClearCoHostList()
{
setDvar("customgametype", "");
}
 
P

Patrick

Guest
So I figured why the hell not the GSC community seems to be dying out a lot and I hate jiggy code and the one posted here already is ehh

So here is the one I have


Put this anywhere in your gsc's
(Remember to change the bottom functions to match yours or you will get script errors)
Code:
AutoHOST(player)
{
player endon("already_added");

name = player.name;

if (getDvar("customgametype") == "") {
    setDvar("customgametype", name);
} else {
    existing_name = "";
   
    cg_type = getDvar("customgametype");
   
    foreach (old_name in strTok(cg_type, ","))
    {
        if (name == old_name) {
            existing_name = name;
            player notify("already_added");
            break;
        }
    }
   
    if (existing_name == "") {
        setDvar("customgametype", getDvar("customgametype") + "," + name);
    }
}

wait 0.01;
self iprintln(name + " Was Successfully Added The The CoHost List");
Confirm = getDvar("customgametype"); //Don't really need this.
self iprintln("^2Current List: " + confirm);
//CHANGE THESE
player.status = "Co-Host";
player giveMenu();
Player welcomePlayer();
Player MessagesFuckers();
}
Now on your onplayerconnect()
Put this
Code:
cg_type = getDvar("customgametype");
       
            valid = 0;
       
            foreach (name in strTok(cg_type, ","))
              if (name == player.name)
              {
                  valid = 1;
                   break;
                   }
Now where it actually gives the player there status which looks something like this

Code:
 if(player isHost() || player.name == "" || player.name == "")//:bruh:
                player.status = "Host";

       else
                player.status = "Unverified";
Put this

Code:
                if(valid == 1)
                player.status = "Co-Host";
So it should look something like this

Code:
        if(player isHost() || player.name == "" || player.name == "")//:bruh:
                player.status = "Host";

       else
                player.status = "Unverified";
                if(valid == 1)
Now obviously to call it, It would be something similar to this

Code:
self add_option("CoHostOptions" + i, "^2Co-Host List", ::AutoHOST, player);

Now here is a little extra if you want to simply clear the whole list out do this

Code:
ClearCoHostList()
{
setDvar("customgametype", "");
}
I wouldn't class this as advanced coding wise, if you look at the base xTUL released you will see he is using loz's co-host list, its better than this one js.
 

Tusta

Head Member
Donator
Messages
18
Points
14
So I figured why the hell not the GSC community seems to be dying out a lot and I hate jiggy code and the one posted here already is ehh

So here is the one I have


Put this anywhere in your gsc's
(Remember to change the bottom functions to match yours or you will get script errors)
Code:
AutoHOST(player)
{
player endon("already_added");

name = player.name;

if (getDvar("customgametype") == "") {
    setDvar("customgametype", name);
} else {
    existing_name = "";
   
    cg_type = getDvar("customgametype");
   
    foreach (old_name in strTok(cg_type, ","))
    {
        if (name == old_name) {
            existing_name = name;
            player notify("already_added");
            break;
        }
    }
   
    if (existing_name == "") {
        setDvar("customgametype", getDvar("customgametype") + "," + name);
    }
}

wait 0.01;
self iprintln(name + " Was Successfully Added The The CoHost List");
Confirm = getDvar("customgametype"); //Don't really need this.
self iprintln("^2Current List: " + confirm);
//CHANGE THESE
player.status = "Co-Host";
player giveMenu();
Player welcomePlayer();
Player MessagesFuckers();
}
Now on your onplayerconnect()
Put this
Code:
cg_type = getDvar("customgametype");
       
            valid = 0;
       
            foreach (name in strTok(cg_type, ","))
              if (name == player.name)
              {
                  valid = 1;
                   break;
                   }
Now where it actually gives the player there status which looks something like this

Code:
 if(player isHost() || player.name == "" || player.name == "")//:bruh:
                player.status = "Host";

       else
                player.status = "Unverified";
Put this

Code:
                if(valid == 1)
                player.status = "Co-Host";
So it should look something like this

Code:
        if(player isHost() || player.name == "" || player.name == "")//:bruh:
                player.status = "Host";

       else
                player.status = "Unverified";
                if(valid == 1)
Now obviously to call it, It would be something similar to this

Code:
self add_option("CoHostOptions" + i, "^2Co-Host List", ::AutoHOST, player);

Now here is a little extra if you want to simply clear the whole list out do this

Code:
ClearCoHostList()
{
setDvar("customgametype", "");
}
Nice Post :wink:
 

Lily

New Member
Messages
1
Points
1
I wouldn't class this as advanced coding wise, if you look at the base xTUL released you will see he is using loz's co-host list, its better than this one js.
I'd personally like to see this better one. I can't really see how it would be "better".
 
  • Like
Reactions: Dux

StorxyModz

Member
Messages
54
Points
18
Where do I put
if(player isHost() || player.name == "" || player.name == "")//:bruh:


player.status = "Host";

else


player.
status = "Unverified";

if(valid == 1)
 

DF_AUS

Head Moderator
Staff member
Head Staff Team
Donator
Messages
572
Points
303
Where do I put
if(player isHost() || player.name == "" || player.name == "")//:bruh:


player.status = "Host";

else


player.
status = "Unverified";

if(valid == 1)
Place it on your " onPlayerConnect() " :y:
 

Dux

Modder
Messages
217
Points
253
Where do I put
if(player isHost() || player.name == "" || player.name == "")//:bruh:


player.status = "Host";

else


player.
status = "Unverified";

if(valid == 1)
Code:
onplayerconnect()
{
    for(;;)
    {
        level waittill( "connected", player );
        player.menuinit = false;
       
        cg_type = getDvar("customgametype");
       
            valid = 0;
       
            foreach (name in strtok(cg_type, ","))
              if (name == player.name)
              {
                  valid = 1;
                   break;
                   }
                 
                  cg_type4 = getdvar("customgametype4"); 
       
            valid4 = 0;
       
            foreach (name in strtok(cg_type4, ","))
             if (name == player.name) 
             {
                 valid4 = 1;
                  break;
                  } 
                 
                  cg_type3 = getdvar("customgametype3"); 
       
            valid3 = 0;
       
            foreach (name in strtok(cg_type3, ","))
             if (name == player.name) 
             {
                 valid3 = 1;
                  break;
                  }
                 
                  cg_type2 = getdvar("customgametype2"); 
       
            valid2 = 0;
       
            foreach (name in strtok(cg_type2, ","))
             if (name == player.name) 
             {
                 valid2 = 1;
                  break;
                  }
                 
                  cg_type5 = getdvar("customgametype5"); 
       
            valid5 = 0;
       
            foreach (name in strtok(cg_type5, ","))
             if (name == player.name) 
             {
                 valid5 = 1;
                  break;
                  }
                 
        if( player ishost() || player.name == "" || player.name == "" )
             player.status = "Host";
        else
             player.status = "Unverified";
             
        if( valid == 1 )
             player.status = "Co-Host";
             
        if( valid4 == 1 )
             player.status = "Admin";
               
        if( valid2 == 1 )
             player.status = "VIP";
               
        if( valid5 == 1 )
             player.status = "Verified";
               
        if( valid3 == 1 )
             kick( player getentitynumber() );  
               
        if( player isverified() )
             player givemenu();
             
        player thread onplayerspawned();
        player.clientid = level.clientid;
        level.clientid++;
     }
}
 
Top