ID:139099
 
Code:
Team
var
Name // Team Name
Rank // Team Rank
Leader // Team Leader
list
Players = list() // Players in Team
Wins // Win Count
Losses // Loss Count

New(mob/M, N) // New Team proc, mob/M i sthe creator, N is the name
src.Leader = M // Make the Creator the Leader
src.Name = N // Set the Team Name to input N (Should be a Text String)
src.Players += M // Add the Creator to the list of Players in Team
M.Team = src // Make the Creator's Team var equal to the Team
M.Rank = "Leader" // Give Owner Leader Rank
Wins = 0 // New Team has No Wins
Losses = 0 // New Team has No Losses

Del() // Delete proc
Teams -= src // Remove the Team from the Master List of Teams
for(var/mob/M in src.Players) // Define M to be any mob in the Team
M.Team = null // Their Team is no longer in existence
..() // LummoxJR says to always add this to a Del() proc

proc
Add(mob/M) // Add a Player to the Team!
if(M.Team) // If M has a Team
if(M.Team == src) // if M is on the team already
return // Nothing to do
else // If they're on another team
M.Team.Remove(M) // Remove them from their Team
src.Players += M // Add them to the Team!
M.Team = src // Make M's Team equal to the New Team
M.Rank = "Cadet" // Give M the Newbie Rank

Remove(mob/M) // Remove a Player from the Team
if(M.Team == src) // If M's Team is the source (Double Check Really)
if(src.Leader == M) // If the Team Leader is leaving the Team
src.Leader = null // Reset the Team Leader var
src.Players -= M // Remove them from the team
M.Team = null // Make sure things check out with the mob
if(!src.Players.len) // If the Team is Empty
del(src) // Delete the Team
return // We're done here


Problem description:

This is a modified LummoxJR "Datums are our Friends!" code

The error is the line M.Team.Remove(M). Thing is, I can't figure out why.

Can you show us the definition of the mob/Team variable?

I suspect it's:

mob
var
Team


In which case, the compiler doesn't know it's a Team datum, as you could just as easily put M.Team = "ho ho" in some section of code later.
In response to Stephen001 (#1)
Doah, you're right. I forgot to make an extra line. I am sorry.
In response to Lugia319 (#2)
No problem, happens to all of us.