Change your command script to this:
[pawn] else if (strcmp(cmd, "taze", true) == 0) {
new szMsg[256], plr;
tmp = strtok(cmdtext, idx), plr = FindPlayerIDFromString(tmp);
if(PlayerInfo[playerid][Logged] != 1) SendClientMessage(playerid, COLOR_RED, "You need to login first!");
else if (!strlen(tmp)) SendClientMessage(playerid,COLOR_RED,"USAGE: /c taze [Nick/ID]");
else if (PlayerInfo[playerid][cop] != 1) SendClientMessage(playerid, COLOR_ORANGE, "Only officers can taze suspects.");
else if (plr == INACTIVE_PLAYER_ID) SendClientMessage(playerid,COLOR_RED,"Error: Unknown player");
else {
format(szMsg,sizeof(szMsg),"Officer %s tazed suspect %s for 5 seconds",gPlayers[playerid],gPlayers[plr]);
SetTimer("taze",5000,0);
SendClientMessageToAll(COLOR_YELLOW,szMsg);
TogglePlayerControllable(plr,0);
}
return 1;[/pawn]
Add this to the bottom:
[pawn]public taze(playerid)
{
TogglePlayerControllable(playerid,1);
return 1;
}[/pawn]
And then put this at the top of your script.
forward taze(playerid);
I think why you get Spam messages is because
SetTimer("taze",5000,1);. All you have to do is change it to
0 so that it won't repeat again.