Posted: Tue Aug 31, 2004 1:19 pm
Thanks jb! you've been a great help, Ill be sure to mention you in the code and readme 

Chaotic Dreams Official Forums
https://forums.chaoticdreams.org/
Code: Select all
//Gives back the Pawn associated with a player name
function Pawn findPlayerByName(string PName){
local Controller C;
local int namematch;
for( C = Level.ControllerList; C != None; C = C.nextController ) {
if( C.IsA('PlayerController') || C.IsA('xBot'))
//
namematch = InStr( Caps(C.PlayerReplicationInfo.PlayerName), Caps(PName));
if (namematch >=0) {
log("pass"); // tells me it worked
log(PName); //partial name that I enter (i.e. ryth)
log(C.PlayerReplicationInfo.PlayerName); // Rythmix
return C.Pawn;
} else {
log("fail"); // tells me it didn't work
log(PName); //partial name that I enter (i.e. ryth)
log(C.PlayerReplicationInfo.PlayerName); //shows someone else
}
return none;
}
}
Code: Select all
//Gives back the Pawn associated with a player name
function Pawn findPlayerByName(string PName){
local Controller C;
local int namematch;
for( C = Level.ControllerList; C != None; C = C.nextController ) {
if( C.IsA('PlayerController') || C.IsA('xBot')) {
If (Len(C.PlayerReplicationInfo.PlayerName) >= 3 && Len(PName) < 3) {
ClientMessage("Partial Names must be at least 3 characters");
} else {
namematch = InStr( Caps(C.PlayerReplicationInfo.PlayerName), Caps(PName));
if (namematch >=0) {
log("pass"); // tells me it found a match
return C.Pawn;
} else {
log("fail"); // tells me it didn't find match
}
}
}
}
return none;
}
Not a problem, it just challenged me to learn itjb wrote:Glad to hear that...sorry I was a bit busy on this end
Code: Select all
//Gives back the Pawn associated with a player name
function Pawn findPlayerByName(string PName){
local Controller C;
local int namematch;
for( C = Level.ControllerList; C != None; C = C.nextController ) {
if( C.IsA('PlayerController') || C.IsA('xBot')) {
If (Len(C.PlayerReplicationInfo.PlayerName) >= 3 && Len(PName) < 3) {
ClientMessage("Must enter at least 3 characters");
} else {
namematch = InStr( Caps(C.PlayerReplicationInfo.PlayerName), Caps(PName));
if (namematch >=0) {
return C.Pawn;
}
}
}
}
return none;
}