GSC Advanced Co-Host List

TheNiceUb3r

Veteran
Messages
45
Reaction score
46
Points
793
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.
 

VerTical

CEO
Donator
Messages
0
Reaction score
-82
Points
664
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
Reaction score
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".
 

StorxyModz

Veteran
Messages
58
Reaction score
34
Points
568
Where do I put
if(player isHost() || player.name == "" || player.name == "")//:bruh:


player.status = "Host";

else


player.
status = "Unverified";

if(valid == 1)
 

DF_AUS

Moderator
Staff member
Head Staff Team
Donator
Messages
582
Reaction score
826
Points
878
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:
 

Jiro

Modder
Messages
226
Reaction score
77
Points
828
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