Both of these codes use a messy mix of old and new syntax and has uncompleted code (";") They do however have the basis down, try this;
#pragma semicolon 1
#define VERSION "1.0"
public Plugin:myinfo =
name = "block team change",
author = "potatoz",
description = "blocks team changes whilst client is alive",
version = VERSION,
url = ""
public Action Command_JoinTeam(int client, char command, int args)
if(!client || !IsClientInGame(client) || IsFakeClient(client))
ReplyToCommand(client, " \x07You may not switch team whilst alive")