Код:
/*
~~~~~~~~~~~~~~~~~~~~~~~
TVC System By - "Roy_Omer / JoeShk / CamelJoe"
~~~~~~~~~~~~~~~~~~~~~~~
*/
//Includes:
#include "a_samp"
#tryinclude "dutils" // try this include dutils
//Unused:
#pragma unused ret_memcpy
//Colors:
#define RED 0xFF0000AA
#define ORANGE 0xFF9900AA
#define WHITE 0xFFFFFFAA
enum Camrea
{
bool:air,cameraman,Float:campostion[4],tup
};
//static's / new's
new bool:player_viewer[200];
new CamreaInfo[Camrea];
static string[128];
new CPU[200];
//forward:
forward public PlayerUpdateCamrea(playerid);
public OnPlayerDisconnect(playerid, reason)
{
if(!player_viewer[playerid]) RemovePlayer(playerid);
return true;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
new cmd[256],
idx;
cmd = strtok(cmdtext, idx);
if (!strcmp(cmd, "/cretv", true)) return SendClientMessage(playerid,WHITE,"� all copyright's about the \"Television Channel\" reserved to \"Roy_Omer (JoeShk / CamelJoe)\"");
if (!strcmp(cmd, "/tv", true))
{
new desctoreide[256];
desctoreide = strtok(cmdtext,idx);
if(!strlen(desctoreide))
{
if(CamreaInfo[cameraman] != playerid)
{
SendClientMessage(playerid,WHITE,"to watch: /tv watch");
SendClientMessage(playerid,WHITE,"to stop watching: /tv stopw");
}
else if(CamreaInfo[cameraman] == playerid)
{
SendClientMessage(playerid,WHITE,"to start TV: /tv onair");
SendClientMessage(playerid,WHITE,"to stop TV: /tv offair");
}
if(IsPlayerAdmin(playerid))
SendClientMessage(playerid,WHITE,"to give camreaman: /tv setcm");
return true;
}
if(!strcmp(desctoreide,"onair") && CamreaInfo[cameraman] == playerid) return
(CamreaInfo[air])? SendClientMessage(playerid,RED,"The TV Is online!"): OnAir(playerid,true);
if(!strcmp(desctoreide,"offair") && CamreaInfo[cameraman] == playerid) return
(!CamreaInfo[air])? SendClientMessage(playerid,RED,"The TV Is'nt Online!"): OffAir();
else if(!strcmp(desctoreide,"stopw")) return
(player_viewer[playerid] && playerid != CamreaInfo[cameraman])? RemovePlayer(playerid) : SendClientMessage(playerid,RED,"you'r not watching at the TV!");
else if(!strcmp(desctoreide,"watch")) return
(playerid != CamreaInfo[cameraman])? Watching(playerid) :SendClientMessage(playerid,RED,"you'r the camrea man, you'r cant can to watch at the TV!");
else if(!strcmp(desctoreide,"setcm"))
{
if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid,RED,"you'r not an admin!");
new cam[256];
cam = strtok(cmdtext, idx);
if(!strlen(cam)) return SendClientMessage(playerid,WHITE,"Usage: /tv setcm [playerid]");
return (strval(cam) == CamreaInfo[cameraman])? SendClientMessage(playerid,RED,"this player is camrea man!") : OnAir(strval(cam),false);
}
return SendClientMessage(playerid,RED,"Error Command TV!");
}
return false;
}
public PlayerUpdateCamrea(playerid)
{
if(!CamreaInfo[air]) return RemovePlayer(playerid);
GetPlayerPos(CamreaInfo[cameraman],CamreaInfo[campostion][0],CamreaInfo[campostion][1],CamreaInfo[campostion][2]);
SetPlayerCameraPos(playerid,CamreaInfo[campostion][0],CamreaInfo[campostion][1],CamreaInfo[campostion][2]);
SetPlayerCameraLookAt(playerid,CamreaInfo[campostion][0],CamreaInfo[campostion][1]+20.0,CamreaInfo[campostion][2]);
return true;
}
OnAir(playerid,bool:ss)
{
if(ss)
{
CamreaInfo[cameraman] = playerid;
CamreaInfo[air] = true;
}
else if(!ss)
{
CamreaInfo[cameraman] = playerid;
format(string,sizeof(string),"The player: %s is the camrea man now!",GetName(playerid));
SendClientMessageToAll(ORANGE,string);
}
return true;
}
OffAir()
{
KillTimer(CamreaInfo[tup]);
CamreaInfo[air] = false;
SendClientMessageToAll(ORANGE,"The TV Is Off Now!");
for(new i = 0; i < GetMaxPlayers(); i++) RemovePlayer(i);
return true;
}
Watching(playerid)
{
if(player_viewer[playerid]) return SendClientMessage(playerid,RED,"to stop the Wathicng: /tv stopw");
if(!CamreaInfo[air]) return SendClientMessage(playerid,RED,"The tv now is off!");
CPU[playerid] = SetTimerEx("PlayerUpdateCamrea",50,true,"d",playerid);
SetPlayerCameraPos(playerid,CamreaInfo[campostion][0],CamreaInfo[campostion][1],CamreaInfo[campostion][2]);
SetPlayerCameraLookAt(playerid,CamreaInfo[campostion][0],CamreaInfo[campostion][1]+20.0,CamreaInfo[campostion][2]);
player_viewer[playerid] = true;
return true;
}
RemovePlayer(playerid)
{
SpawnPlayer(playerid);
player_viewer[playerid] = false;
KillTimer(CPU[playerid]);
return true;
}
stock GetName(playerid)
{
new N[24+1];
GetPlayerName(playerid,N,sizeof(N));
return N;
}
How can i make it set different channels with different cameramans like with command /tvair (channel no) and like that so ppl can watch it in specific channel and how to make the player see the text of the chat at the camera postition?