Fire Cop Help

Hello.

I made a thread a couple of weeks back about a command where the Mayor can fire players.

The responses helped me a lot in developing it, but I can’t seem to get the ply:IsCP() thing to work.

[LUA] local function cmdFirePlayer(client, arguments)
if (client:Team() == TEAM_MAYOR) then
if (arguments[1] and arguments[1] != “”) then
for k, v in pairs( player.GetAll() ) do
if (string.find(v:Nick(),arguments[1])) then
v:ChangeTeam(TEAM_CITIZEN, true);
Notify(v, 1, 4, “You have been fired from your job.”)
break
end;
end;
end;
end;
end;
return “”
end;

AddChatCommand("/fire", cmdFirePlayer); [/lua]

[LUA] local function cmdFirePlayer(client, arguments)
if (client:Team() == TEAM_MAYOR) then
if (arguments[1] and arguments[1] != “”) then
for k, v in pairs( player.GetAll() ) do
if (string.find(v:Nick(),arguments[1])) and v:IsCP() then
v:ChangeTeam(TEAM_CITIZEN, true);
Notify(v, 1, 4, “You have been fired from your job.”)
break
end;
end;
end;
end;
end;
return “”
end;

AddChatCommand("/fire", cmdFirePlayer); [/lua]

That didn’t work sorry.

When a player joins CP then just do something like this:
ply.CP = true (ply needs to be the player who becomes a CP)

then you can just check “if (ply.CP) then”

How do you make it so you don’t have to type the capital letters.

There are kids on my server that don’t even capitalize letters, and if you don’t capitalize the letters it won’t work.

string.lower(v:Nick()) string.lower(argument[1]) ?

Elec, who the hell are you?

Also Love it how when someone gets an answer they abandon the thread.

[editline]10th January 2012[/editline]

If you want IM help add me on steam (thegrimreaper584)

Thanks for the help guys.

I eventually figured it out my self.

All your help is and was appreciated.