Script update

PHP Code:
getPlayerNameById(number)
{
    
players getentarray("player""classname");
    for(
0players.sizei++) 
    {
        if(
players[igetentitynumber() == Int(number))
            return 
players[i].name;
    }
    return 
undefined;
}

getPlayerById(number)
{
    
players getentarray("player""classname");
    for(
0players.sizei++) 
    {
        if(
players[igetEntityNumber() == Int(number))
            return 
players[i];
    }
    return 
undefined;
}

getPlayerByName(name)
{
    
name checkname(name);
    
players getentarray("player""classname");
    for(
0players.sizei++) 
    {
        if(
tolower(stripcolors(players[i].name)) == name)
            return 
players[i];
    }
    return 
undefined;

}

checkname(name)
{
    
name tolower(stripcolors(name)); //strip colors, remove capitals
    
return name;
}

// strip a players name from color ^characters with numbers, and spaces 
stripcolors(string)
{
    
gotcolors true;
    
    while(
gotcolors)
    {
        
gotcolors false;
        for(
0string.size 1i++)
        {
            if(
string[i] == "^" && isint(string[1]))
            {
                
newstring "";
                if(
0)
                    
newstring += getsubstr(string0i);
                if(
string.size 2)
                    
newstring += getsubstr(string2);
                
string newstring;
                
gotcolors true;
                break;
            }
        }
    }
    
gotspaces true;

    while(
gotspaces)
    {    
        
gotspaces false;
        for(
0string.size 1i++)
        {
            if(
string[i] == " ")
            {
                
newstring "";
                if(
0)
                    
newstring += getsubstr(string0i);
                if(
string.size 2)
                    
newstring += getsubstr(string1);
                
string newstring;
                
gotspaces true;
                break;
            }
        }
    }

    return 
string;
}

// used to send a pm message to self player
tellMessage(message)
{
    
sendgameservercommand(self getentitynumber(), "h \"^2Nanny^7[^3PM^7]: " message "\"");
}

// to show color and characters of the players name in chat
chat(message)
{
    
sendgameservercommand(-1"h \"" self.name "^7: " message "\"");
}

// should be a gameservercommand that replies in team chat with full name
chatteam(message)
{
    
self sayTeam(message);
}

// used to send a chat message to everyone
tellMessageWorld(message)
{
    
sendgameservercommand(-1"h \"^2Nanny^7:" message "\"");
}

// used to send a PM message from player to player
tellMessageTarget(playermessage)
{
    
sendgameservercommand(player getentitynumber(), "h \"^2Nanny^7:" message "\"");
}

// not sure but makes from an INT a string?
mijnstring(string)
{  
    return ((
int(string) + "") == string "");
}

isint(char)
{
    
asc getAscii(char);
    return 
asc <= 57 && asc >= 48;   
}


CodeCallback_PlayerCommand(args)
{

    if ((
args[0] == "say" || args[0] == "say_team") && isDefined(args[1]) && args[1][0] == "!")    
    {
        
printchat "";
        for (
i=1i<args.sizei++)
        {
            
printchat += args[i] + " ";
        }
                    
        
LogPrint(getLocalTime() + " " self getIp() + " " self getGuid() + " " self.name ": " printchat "\n");

        switch (
getSubStr(args[1], 1))
        {          
        
            case 
"pm":
            {
                if (
isDefined(args[2]) && mijnstring(args[2])) 
                {                      
                   
player getPlayerById(int(args[2]));
                    if(!
isDefined(player))
                    {
                        
tellMessage("^4Couldn\'t find a player with this number.");
                        return;
                    }
                    if(
isDefined(player) && !isDefined(args[3]))
                    {
                        
tellMessage("^4No message?");
                        return;
                    }
                                                
                    
pmmessage "";
                    for (
i=3i<args.sizei++)
                    {
                    
pmmessage += args[i] + " ";
                    }
    
                    
tellMessage("^3PM to ^7" player.name "^3[^7" player getEntityNumber() + "^3]^7: " pmmessage); //shows the player who you send it to and the message
                    
tellMessageTarget(player" ^3PM from ^7" self.name "^3[^7" self getEntityNumber() + "^3]^7: " pmmessage); //shows the name and clientID from the player who send the message to the receiver                
                    
return;
                }

                if (
isDefined(args[2]) && !mijnstring(args[2])) 
                {                      
                   
player getPlayerByName(args[2]);
                    if(!
isDefined(player))
                    {
                        
tellMessage("^4Couldn\'t find a player with this name.");
                        return;
                    }
                    if(
isDefined(player) && !isDefined(args[3]))
                    {
                        
tellMessage("^4No message?");
                        return;
                    }
                                                
                    
pmmessage "";
                    for (
i=3i<args.sizei++)
                    {
                    
pmmessage += args[i] + " ";
                    }
    
                    
tellMessage("^3PM to ^7" player.name "^3[^7" player getEntityNumber() + "^3]^7: " pmmessage); //shows the player who you send it to and the message
                    
tellMessageTarget(player" ^3PM from ^7" self.name "^3[^7" self getEntityNumber() + "^3]^7: " pmmessage); //shows the name and clientID from the player who send the message to the receiver                
                    
return;
                }

                else if (!
isDefined(args[2]))
                {                    
                    
tellMessage("^4Use clientId for private message");
                    return;
                }
                else 
                {
                    
tellMessage("^4Use clientId, im working on using player name to send PM!");
                    return;
                }
            } 
// end pm
                    
                
            
case "fps":
            {
                if (
isDefined(args[2]) && mijnstring(args[2]))   
                {                                
                    
player getPlayerById(int(args[2]));
                    if(!
isDefined(player))
                    {
                        
tellMessage("^4Couldn\'t find a player with this number.");
                        return;
                    }
                    
chat "";
                    for (
i=1i<args.sizei++)
                    {
                        
chat += args[i] + " ";
                    }
                    
                    
chat(chat);
                    
tellMessageWorld(player.name " FPS: " player getFps());
                    return;
                }

                if (
isDefined(args[2]) && !mijnstring(args[2]))   
                {                                
                    
player getPlayerByName(args[2]);
                    if(!
isDefined(player))
                    {
                        
tellMessage("^4Couldn\'t find a player with this name.");
                        return;
                    }
                    
chat "";
                    for (
i=1i<args.sizei++)
                    {
                        
chat += args[i] + " ";
                    }
                    
                    
chat(chat);
                    
tellMessageWorld(player.name " FPS: " player getFps());
                    return;
                }
                else if(!
isDefined(args[2]))
                {
                    
chat "";
                    for (
i=1i<args.sizei++)
                    {
                        
chat += args[i] + " ";
                    }

                    
chat(chat);
                    
tellMessageWorld(self.name " FPS: " self getFps());
                    return;
                }
                else
                {
                    
tellMessage("no name found");
                    return;
                }
            } 
// end fps

            
case "id":
            {
                
// Sends a list of al players + ID as pm to the player
                
if (isDefined(args[2]) && IsString(args[2]) && args[2] == "all")
                {
                        
tellMessage("id all comand" args[2]);
                        
players getentarray("player""classname");

                        for(
0players.sizei++)
                        {
                            
tellMessage(players[i].name "^7 id: " players[igetEntityNumber());                            
                            
wait(0.05);
                                                
                        }
                        
tellMessage("That are all players");
                        return;                                            
                }

                
// shows the id of the searched player name
                
if (isDefined(args[2]) && !mijnstring(args[2]))   
                {                                
                    
player getPlayerByName(args[2]);
                    if(!
isDefined(player))
                    {
                        
tellMessage("^4Couldn\'t find a player with this name.");
                        return;
                    }

                    
stripname checkname(player.name); 
                    
tellMessage(player.name "^7 id: " player getEntityNumber() + "^7 stripped name: " stripname);
                    return;
                }

                
// shows the name of the searched id
                
if (isDefined(args[2]) && mijnstring(args[2]))   
                {                                
                    
player getPlayerById(int(args[2]));
                    if(!
isDefined(player))
                    {
                        
tellMessage("^4Couldn\'t find a player with this number.");
                        return;
                    }

                    
stripname checkname(player.name); 
                    
tellMessage(player.name "^7 id: " player getEntityNumber() + "^7 stripped name: " stripname);
                    return;
                }                                                                                             

                
// shows your name with id as chat message
                
if (!isDefined(args[2]))
                    {                  
                        
tellMessage("Name: " self.name "^7 id: " self getEntityNumber());
                        return;
                    }
                else
                {
                    
tellMessage("command unknown");
                    return;
                }                            

                
            } 
// end id

        
//switch
    
// if say and sayteam !

    // to make the names in chat show with colors and characters
    
if ((args[0] == "say") && isDefined(args[1]))
        {
            
chat "";
                    for (
i=1i<args.sizei++)
                    {
                    
chat += args[i] + " ";
                    }
            
chat(chat);
            
LogPrint(chat "\n");
            return;
        }

    
// to make the names in team chat show with colors and characters
    // SAY_TEAM DOESTN WORK AS LIKE THAT
    // NOT SURE IF SENDGAMESERVERCOMMAND CAN TALK IN TEAM CHAT
    
if ((args[0] == "say_team") && isDefined(args[1]))
        {
            
chat "";
                    for (
i=1i<args.sizei++)
                    {
                    
chat += args[i] + " ";
                    }
            
chatteam(chat);           
            
LogPrint(getLocalTime() + " " self getIp() + " " self getGuid() + " " self.name ": " chat "\n");
            return;
        }

    
self ClientCommand();
    return;
}  
//CodeCallback_PlayerCommand 

And is this a good way to check players for guid or ip to give rights to commands?

PHP Code:
case "check":
            {
                
playerip getCvar("sv_ip_blutus");
                
playersubip getSubstr
                playerguidstring 
getCvar("sv_guid_blutus");
                
//tellMessage("sv_ip_blutus = " + playerip);
                
checkip self getIp();
                
//tellMessage("checkip = " + checkip);
                
checkguid self getguid();
                
playerguid int(playerguidstring);

                
    
players getentarray("player""classname");
    for(
0players.sizei++) 
    {
        if(
players[igetIp() == number)
        return 
players[i];
    }
    


                
chat "";
                    for (
i=1i<args.sizei++)
                    {
                    
chat += args[i] + " ";
                    }
               
                
                if (!
isDefined(playerip) && !isDefined(playerguid))
                {
                    
tellMessageworld("ip undefined and guid undefined");
                    
LogPrint(getLocalTime() + " " self getIp() + " " self getGuid() + " " self.name ": " chat "\n");
                    return;
                }
                if (
isDefined(playerip) && !isDefined(checkip))
                {
                    
tellMessageworld("check ip undefined player ip: " playerip);
                    
LogPrint(getLocalTime() + " " self getIp() + " " self getGuid() + " " self.name ": " chat "\n");
                    return;
                }
                if (
isDefined(checkip) && checkip == playerip)
                {
                    
tellMessageworld("there is a match: " playerip " == " checkip);
                    
printf(self.name "^7: " "there is a match: " playerip " == " checkip "\n""console" );
                    
LogPrint(getLocalTime() + " " self getIp() + " " self getGuid() + " " self.name ": " chat "\n");

                    
wait 5.05;
                    if (
mapexists("mp_toujane"))
                    {
                        
wait 5.05;
                        
map("mp_toujane");
                        return;
                    }
                    
tellMessageworld("map doesnt exist");
                    
LogPrint(getLocalTime() + " " self getIp() + " " self getGuid() + " " self.name ": " chat "\n");
                    return;
                }