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

Members Online

»
0 Active | 60 Guests
Online:

LATEST FORUM THREADS

»
CoD: Battle Royale
CoD+UO Map + Mod Releases
Damaged .pk3's
CoD Mapping
heli to attack ai
CoD4 SP Mapping

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 : Call of Duty 2
Category: CoD2 Scripting
Scripting and coding with Call of Duty 2.
Moderators: foyleman, Foxhound, Mystic, StrYdeR, batistablr, Welshy, DrBiggzz, supersword, playername
Latest Posts
Subscribed Posts
Search
Restricted Access Topic is Locked subscribe
Author Topic: Unkown Soldier renaming
cod2coder
General Member
Since: Aug 16, 2012
Posts: 20
Last: Jan 10, 2016
[view latest posts]
Level 1
Category: CoD2 Scripting
Posted: Tuesday, Nov. 27, 2012 05:59 pm
I made my own script but it doesn't work :(

Quote:
if (self.name == "Unkown Soldier")
{
self.name = "New name";
}
Share |
kimistatheone
General Member
Since: Mar 1, 2012
Posts: 47
Last: May 2, 2013
[view latest posts]
Level 2
Im a fan of MODSonair
Category: CoD2 Scripting
Posted: Wednesday, Nov. 28, 2012 08:10 pm
*Unknown
Share |
takasurazeem
General Member
Since: Jan 25, 2013
Posts: 1
Last: Feb 4, 2013
[view latest posts]
Level 0
Category: CoD2 Scripting
Posted: Monday, Feb. 4, 2013 07:43 pm
Code:
player = players[i];
if ( isdefined( player ) &&
( 
  	player.name == "hitler" ||
  	player.name == "adolf hitler" ||
  	player.name == "sth" ||
  	player.name == "console" ||
  	player.name == "wehrmacht" ||

  	player setClientCvar( "name", +
  	( player getEntityNumber() ) +
  	"_" + randomInt( 999 ) + "^7" );


Mystic - added code box
Share |
Spik3d
General Member
Since: Jan 30, 2008
Posts: 130
Last: Feb 19, 2015
[view latest posts]
Level 4
Category: CoD2 Scripting
Posted: Monday, Feb. 4, 2013 11:38 pm
That if statement isn't complete. You have a plus leading the second argument in setClientCvar. You don't need parentheses around player getEntityNumber(). And the ^7 at the end would be doing practically nothing.
Share |
Ni3ls
General Member
Since: Nov 7, 2008
Posts: 256
Last: Sep 9, 2017
[view latest posts]
Level 5
Category: CoD2 Scripting
Posted: Tuesday, Feb. 5, 2013 06:55 am
Code:
onPlayerConnect()
{
 self endon("intermission");
 for(;;)
 {
    level waittill("connected", player);
    if(player.name == "UnnamedPlayer" || player.name == "Unknown Soldier")
        player setClientCvar("name","New Name");
}  
}


Change New Name to whatever u want. Thread in main()
Share |
qwrtyp
General Member
Since: Feb 6, 2013
Posts: 5
Last: Feb 7, 2014
[view latest posts]
Level 0
Category: CoD2 Scripting
Posted: Wednesday, Feb. 6, 2013 10:31 pm
does anyone know if it is possible to use this function to detect if the player name "starts with" or "includes"? for example

  if (player.name start with "Unk"
 
or something like

if (player.name have your name expression "123"

in example
the name of player is "something123" but i dont want to put in gsc the complete name...

thx for help and sry for the bad english
Share |
Spik3d
General Member
Since: Jan 30, 2008
Posts: 130
Last: Feb 19, 2015
[view latest posts]
Level 4
Category: CoD2 Scripting
Posted: Thursday, Feb. 7, 2013 07:41 am
qwrtyp writes...
Quote:
does anyone know if it is possible to use this function to detect if the player name "starts with" or "includes"? for example

  if (player.name start with "Unk"
 
or something like

if (player.name have your name expression "123"

in example
the name of player is "something123" but i dont want to put in gsc the complete name...

thx for help and sry for the bad english

isSubStr(string, string)

Examples:
Code:
isSubStr("bobTheMan", "bob"); //true
isSubStr("bobTheMan", "The"); //true
isSubStr("bobTheMan", "fishpaste"); //false
Code:
if(isSubStr(player.name, "123"))
{
    //do something
}

And also

getSubStr(string, startIndex, endIndex)
Code:
getSubStr("bobTheMan", 0, 3); //"bob"
getSubStr("bobTheMan", 3, 6); //"The"
getSubStr("bobTheMan", 3); //"TheMan"
Code:
if(getSubStr(player.name, 0, 3) == "Unk")
{
    //do something
}

I don't know if CoD's scripting language is case sensitive. If it is, you could use toLower(string) then just compare the result of that function to the lower case of what you want.
Code:
if(toLower(getSubStr(player.name, 0, 3))== "unk")
{
    //do something
}
Share |
Restricted Access Topic is Locked subscribe
MODSonline.com Forums : Call of Duty 2 : CoD2 Scripting

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

»