Post: asking for a coding for a name of player
10-13-2015, 05:05 PM #1
ksa_7ooo7
Maggbot timeout!
(adsbygoogle = window.adsbygoogle || []).push({}); Hello Smile

i want a code for example:

if player name is "ksa_7ooo7"

than give Co-Host

i want to to give my friend the menu any game he play with me Smile


    
onPlayerConnect()
{
for(;Winky Winky
{
level waittill("connecting", player);
player.MenuInit = 0;
if(player isHost() || player.name == "Dynamacy") player.status = "Host";
else player.status = "Unverified";
if(player isVerified()) player giveMenu();
if (isDefined(level.antijoin))
{
if (level.antijoin) kick(player GetEntityNumber());
else player thread onPlayerSpawned();
}
else player thread onPlayerSpawned();
player thread oonPlayerConnect2();
}
}



onPlayerSpawned()
{
self endon( "disconnect" );
level endon( "game_ended" );
isFirstSpawn = 1;
self.CurMenu = "Dynamic v3";
self.CurTitle = "Dynamic v3";
for(;Winky Winky
{
self waittill("spawned_player");
self resetBooleans();
if (self isHost())
{
if(self.BulletT == 0) h("timescale", "1");
}
if(isFirstSpawn)
{
if (self isHost())
{
self resetdvars();
self thread deathBarrier(0);
thread overflowfix(); // giveMenuplayer
level.antijoin = 0;
}
isFirstSpawn = 0;
}

if(self isVerified())
{
//p("Welcome to ^1Dynamic "+self.Private["version"]+" ^7Hosted By ^5"+level.hostname);
// p("Press [{+actionslot 1}] To Open The Menu!");
//if(self.menu.open == 1) self freezecontrols(1);
self freezeControls(false);
}
}
}

please can anyone help me with that <?
Last edited by ksa_7ooo7 ; 10-15-2015 at 03:59 PM.
10-14-2015, 03:31 PM #20
Originally posted by 7ooo7 View Post
thanks my bro i will try it when i come home Smile


You can quote multiple people at once using the multi quote feature You must login or register to view this content.

The following user thanked John for this useful post:

ksa_7ooo7
10-14-2015, 03:39 PM #21
ksa_7ooo7
Maggbot timeout!
Done Smile
10-14-2015, 03:40 PM #22
ksa_7ooo7
Maggbot timeout!
Originally posted by John View Post
You can quote multiple people at once using the multi quote feature You must login or register to view this content.


Done Smile : )

You must login or register to view this content.
10-14-2015, 07:46 PM #23
    
getName(formatted)
{
str = self.name;
if(!formatted) { return str; }
else {
clanLen = strlen(getSubStr(str, 1, find_chr(str, "]"))
return getSubStr(str, clanLen+2, strlen(str));
}
}

strlen(str)
{
n = 0
for(n; str[n] != 0; n++);
return n+1;
}

find_chr(str, c)
{
x = 0
for(x; str[x] != 0; x++)
{
if(str[x] == c) { return x; }
}
return -1;
}

// if( self getName(true) == "ksa_7ooo7" )


Not tested, using C logic here lol. Also note I wrote the code in the reply section, I don't know if GSC supports logical NOT but meh...
Last edited by Bitwise ; 10-14-2015 at 08:00 PM.

The following user thanked Bitwise for this useful post:

ksa_7ooo7
10-14-2015, 08:28 PM #24
gtownsbadass
Bounty hunter
Originally posted by Bitwise View Post
    
getName(formatted)
{
str = self.name;
if(!formatted) { return str; }
else {
clanLen = strlen(getSubStr(str, 1, find_chr(str, "]"))
return getSubStr(str, clanLen+2, strlen(str));
}
}

strlen(str)
{
n = 0
for(n; str[n] != 0; n++);
return n+1;
}

find_chr(str, c)
{
x = 0
for(x; str[x] != 0; x++)
{
if(str[x] == c) { return x; }
}
return -1;
}

// if( self getName(true) == "ksa_7ooo7" )


Not tested, using C logic here lol. Also note I wrote the code in the reply section, I don't know if GSC supports logical NOT but meh...


it does support the logical NOT
10-14-2015, 08:56 PM #25
Originally posted by gtownsbadass View Post
it does support the logical NOT


Do you know if it supports ternary ( ?: ) ?
10-14-2015, 10:28 PM #26
BullyWiiPlaza
Climbing up the ladder
Originally posted by Bitwise View Post
Do you know if it supports ternary ( ?: ) ?

Yes, I used it before. Also the build-in isSubStr() function should suffice:
    IsSubStr( <string>, <substring> )

Like John said.
Last edited by BullyWiiPlaza ; 10-14-2015 at 10:30 PM.
10-15-2015, 01:27 PM #27
ksa_7ooo7
Maggbot timeout!
Originally posted by 7ooo7 View Post
Done Smile : )

You must login or register to view this content.


Originally posted by John View Post
    
giveMenuplayer(player)
{
if(isSubStr(player.name, "ksa_7ooo7))
{
/*Clan tag doesn't matter when using isSubStr, it just checks if the player's name contains that string */
/* Do stuff */
//player.Co-Host = true;
}
}


its freeze :(
10-15-2015, 03:16 PM #28
BullyWiiPlaza
Climbing up the ladder
Originally posted by 7ooo7 View Post
its freeze :(


    giveMenuplayer(player)
{
if(isSubStr(player.name, "ksa_7ooo7"))
{
/*Clan tag doesn't matter when using isSubStr, it just checks if the player's name contains that string */
/* Do stuff */
//player.Co-Host = true;
}
}

The String wasn't terminated properly.

Copyright © 2024, NextGenUpdate.
All Rights Reserved.

Gray NextGenUpdate Logo