Hello.
Код:
if(strcmp(cmd, "/spec", true) == 0)
{
if(IsPlayerConnected(playerid))
{
tmp = strtok(cmdtext, idx);
new Float:X, Float:Y, Float:Z;
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /spec [playerid/PartOfName]" );
SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /spec off" );
return 1;
}
if(AdminDuty[playerid] == 0)
{
SendClientMessage(playerid, COLOR_GREY, "Vous devez кtre en Service Admin !");
return 1;
}
if(strcmp("off", tmp, true, strlen(tmp)) == 0)
{
if(WatchingTV[playerid] > 0)
{
GetPlayerMoney(playerid);
WatchingTV[playerid] = 0;
Spectate[playerid] = 253;
SetPlayerPos(playerid, X, Y, Z);
return 1;
}
else
{
SendClientMessage(playerid, COLOR_GREY, "Vous n'кtes pas en train de spec !");
return 1;
}
}
if(PlayerInfo[playerid][pAdmin] >= 1)
{
giveplayerid = ReturnUser(tmp);
if(IsPlayerConnected(giveplayerid))
{
if(giveplayerid != INVALID_PLAYER_ID)
{
Spectate[playerid] = giveplayerid;
new Float:health;
GetPlayerHealth(Spectate[playerid], health);
new Float:armor;
GetPlayerArmour(Spectate[playerid], armor);
GetPlayerPos(playerid, X, Y, Z);
GetPlayerName(Spectate[playerid], giveplayer, sizeof(giveplayer));
new cash = GetPlayerMoney(Spectate[playerid]);
if (PlayerInfo[playerid][pAdmin] >= 1)
{
format(string, sizeof(string), "(%d) %s $%d H:%.0f A:%.0f",Spectate[playerid],giveplayer,cash,health,armor);
}
SendClientMessage(playerid, COLOR_GREEN, string);
WatchingTV[playerid] = 1;
}
}
else
{
SendClientMessage(playerid, COLOR_GREEN, " Target is not available.");
}
}
else
{
SendClientMessage(playerid, COLOR_GRAD1, " You are not authorized to use that command!");
return 1;
}
}
return 1;
}
It's a SPEC script. But, when i type "/spec off", the script makes me continue to watch the player. What's the problem ?
Thanks.