
I have taken over the AdminUtils mutator project
OK, yay im back again. I am so close to release, but I really want partial name check to work. What I'm referring to is the ability to type only part of a players name for the code to recognize it. Just like UAdmin does.
(i.e. mutate UAM_Slap ryth = slap Rythmix). Only UAdmin psuedo-encrypted their code so well I can't tell heads or tails of it. (they replace functions with the name UnknownFunction123())
I have it partially working now, Im using the "InStr" function and searching for the partial name, (PName), within the full name. But it only works for the Player with the last player ID, basically the last person to join the server. I am not sure why tho, It appears as if my For Loop is cycling all the way to the end before testing my arguements. Ive been using log() functions to spot check my way down, but it only displays once, I would assume it would display the number of times as there are people in my server.
below is the code. Currently this code only works for the last PlayerID in the level. for example if nemesis123 joined my server last, I could do "admin loaded nem" and it would find and load him up. But none of the other players work. And as soon as someone else joins, that person gets the priority. I want it to go thru the list and find a match, I thought that was what the FOR loop was supposedly doing.
I assumed Level.ControllerList was the built-in Dynamic Array list of Players in the game, and that nextController would go to the next player in the list and try the loop again, but that doesn't seem to be happening. Can anyone shed some light? I've been searchin the hell out of the wiki and I've posted this in the forums at beyondunreal as well, but figured the more great minds working on it, the better.
(i.e. mutate UAM_Slap ryth = slap Rythmix). Only UAdmin psuedo-encrypted their code so well I can't tell heads or tails of it. (they replace functions with the name UnknownFunction123())
I have it partially working now, Im using the "InStr" function and searching for the partial name, (PName), within the full name. But it only works for the Player with the last player ID, basically the last person to join the server. I am not sure why tho, It appears as if my For Loop is cycling all the way to the end before testing my arguements. Ive been using log() functions to spot check my way down, but it only displays once, I would assume it would display the number of times as there are people in my server.
below is the code. Currently this code only works for the last PlayerID in the level. for example if nemesis123 joined my server last, I could do "admin loaded nem" and it would find and load him up. But none of the other players work. And as soon as someone else joins, that person gets the priority. I want it to go thru the list and find a match, I thought that was what the FOR loop was supposedly doing.
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;
}
}
Rythm is Gonna Get Ya!
Ok I think this is it! I cant try till I get home, but all signs are pointing to yes on this. This will A) check if the PRI.PlayerName is greater than 3 characters and force you to enter more if you wish to affect them but if the PRI.PlayerName is less than 3 characters, it will let you change them (this prevents people from hitting one letter that is common in almost everyone's names, but allows people with 1 or 2 letter names to still be usable). B) Go thru each name on the list and if it finds a match from the partially entered characters it will do the action to that person or persons. Now in the final version I will need to remove the ClientMessage error from there and put it so that I only see the message one time, but functionally, it SHOULD work. (i hope)
The 'return none;' may need to be shifted up one line, I think its meant to return none if the PlayerIsa (Player or xBot) only. I will have to play with it.
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;
}
Rythm is Gonna Get Ya!
I'm happy to say I figured it out on my own
I have also added the ability to protect SuperAdmin's from having other tempadmins disable your admin status. Just enter your super admins in the ini file. I just need to iron out this dynamic array for super admin and I will release it version 1!

Rythm is Gonna Get Ya!
OK, one more little issue. Here is the working code for the partial names:
It works great when you type in a partial name, however, once it finds one match, it exits the loop. So if I wanted to give loaded all people named General.. it would only find the first match and exit the FOR Loop. Now, I understand that its the "return C.Pawn" that is causing that, but how would I go about making it continue on to the rest of the list and the then give the properties to all matches?
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;
}
Rythm is Gonna Get Ya!
sounds like a good idea.. too bad im more vbasic and not enough C++.. i.e. my uscript is still weak.. but growing
I just pasted the same get player code in each function and did the action within the script instead of using an outside function.. it doubled the size of the file almost, but gives me full control for some other things i was working on 
Everything works perfect now, except multiple SuperAdmins, that may require me to make an array of names that are in the superadmin list and not return until it goes thru all the players first. But that can wait. Its releasable now! i will make readme.


Everything works perfect now, except multiple SuperAdmins, that may require me to make an array of names that are in the superadmin list and not return until it goes thru all the players first. But that can wait. Its releasable now! i will make readme.
Rythm is Gonna Get Ya!