Как сделать команду в лиге,чтоб игрока можно было добавить на арену(Если он ,например был в афк).
pawn Код:
StartMode(baseid)
{
new agame = 0, dgame = 0;
for(new b = 0; b < MAX_PLAYERS; b++)
{
if(IsPlayerConnected(b))
{
switch(Player[b][pTeam])
{
case T_ATT:
{
agame++;
}
case T_DEF:
{
dgame++;
}
}
}
}
if(agame > 0)
{
if(dgame > 0)
{
KillTimer(ModeTimer);
new string[STR], idx, fbase[STR];
Current = baseid;
format(string,STR,"-=[База #%d запустится в течении 5 секунд]=-", baseid);
SendClientMessageToAll(AAD_COLOR_WHITE,string);
fbase = Basefile(baseid);
string = dini_Get(fbase,"home");
BaseCP[0] = floatstr(strtok(string,idx,','));
BaseCP[1] = floatstr(strtok(string,idx,','));
BaseCP[2] = floatstr(strtok(string,idx,','));
for(new c = 0; c < MAX_VEHICLES; c++) SetVehicleToRespawn(c);
for(new i = 0; i < MAX_PLAYERS; i++)
{
Player[i][pVoted] = false;
if(IsPlayerConnected(i) && ((Player[i][pTeam] == T_REF) || (Player[i][pTeam] == T_ATT) || (Player[i][pTeam] == T_DEF)))
{
StopSpectate(i);
TogglePlayerControllable(i,0);
SetPlayerInterior(i,0);
SetPlayerHealth(i,100);
Player[i][pPlaying] = true;
Player[i][pVoted] = false;
SetPlayerPos(i,BaseCP[0]-50+random(100),BaseCP[1]-50+random(100),BaseCP[2]);
SetPlayerCameraLookAt(i,BaseCP[0],BaseCP[1],BaseCP[2]);
//SetPlayerCameraPos(i,BaseCP[0]+1,BaseCP[1],BaseCP[2]+80);
SetPlayerCameraRotate(i,BaseCP[0]+1,BaseCP[1],BaseCP[2]+70,0.0,100.0);
SetPlayerCheckpoint(i,BaseCP[0],BaseCP[1],BaseCP[2],10000);
game[i] =1;
}
else Player[i][pPlaying] = false;
}
StopCounting = 5;
SetTimer("ModeStartTimer",0,0);
for(new i = 0; i < MAX_BASES; i++) Votes[i] = 0;
}
else SendClientMessageToAll(AAD_COLOR_INDIGO, "-=[не стартуй если ты 1 на сервере]=-");
}
else SendClientMessageToAll(AAD_COLOR_INDIGO, "-=[не стартуй если ты 1 на сервере]=-");
}
pawn Код:
if(strcmp(cmd, "/add", true) == 0)
{
if(!IsPlayerAdmin(playerid))
{
SendClientMessage(playerid, AAD_COLOR_RED, "*Âû äîëæíû áûòü àäìèíèñòðàòîðîì äëÿ èñïîëüçîâàíèÿ äàííîé êîìàíäû.");
}
else
{
if(Current == -1){SendClientMessage(playerid, AAD_COLOR_RED, "Íåëüçÿ äîáàâëÿòü èãðîêà ïîêà íå çàïóùåíà áàçà/àðåíà");return 1;}
cmd = strtok(cmdtext, idx);
new id2;
new strin[256];
strin = strtok(cmdtext, idx);
if(!strlen(strin))
{
SendClientMessage(playerid, AAD_COLOR_WHITE, "Server: /add [playerid(0-500)]");
return 1;
}
id2 = strval(strin);
if(id2<0 || id2>500)
{
SendClientMessage(playerid, AAD_COLOR_WHITE, "Server: /add [playerid(0-500)] [teamid] [hp]");
return 1;
}
if(!IsPlayerConnected(id2))
{
SendClientMessage(playerid, AAD_COLOR_WHITE, "Server: /add [playerid(Not Connected)] [teamid] [hp]");
return 1;
}
new teamid;
teamid = strval(strtok(cmdtext, idx));
if(teamid<1 || teamid>2)
{
SendClientMessage(playerid, AAD_COLOR_WHITE, "Server: /add [playerid] [teamid(1-ATT, 2-DEF)] [hp]");
return 1;
}
new hp;
hp = strval(strtok(cmdtext, idx));
if(hp<1 || hp>100)
{
SendClientMessage(playerid, AAD_COLOR_WHITE, "Server: /add [playerid] [teamid] [hp(1-100)]");
return 1;
}
new strok[256], fbase[STR], farena[STR], as[MAX_SPAWNS][tmp_spawns], ds[MAX_SPAWNS][tmp_spawns];
if(GetPlayerState(id2) == 9)
{
StopSpectate(id2);
}
SetPlayerArmour(id2,0);
Player[id2][pPlaying] = true;
Player[id2][pVoted] = false;
if(teamid==1) Player[id2][pTeam] = T_ATT;
else if(teamid==2) Player[id2][pTeam] = T_DEF;
else if(teamid==3) Player[id2][pTeam] = T_REF;
death[id2]=0;
game[id2] =1;
PlayerPlaySound(id2,1057,0.0,0.0,0.0);
if(GAMETYPE==0)
{
fbase = Basefile(Current);
format(strok, STR, "a_%d", 0);
idx = 0;
if(dini_Isset(fbase,strok))
{
strok = dini_Get(fbase,strok);
as[0][sx] = floatstr(strtok(strok,idx,','));
as[0][sy] = floatstr(strtok(strok,idx,','));
as[0][sz] = floatstr(strtok(strok,idx,','));
as[0][sin] = true;
}
else as[0][sin] = false;
format(strok, STR, "d_%d", 0);
idx = 0;
if(dini_Isset(fbase,strok))
{
strok = dini_Get(fbase,strok);
ds[0][sx] = floatstr(strtok(strok,idx,','));
ds[0][sy] = floatstr(strtok(strok,idx,','));
ds[0][sz] = floatstr(strtok(strok,idx,','));
ds[0][sin] = true;
}
else ds[0][sin] = false;
if(Player[id2][pTeam] == T_ATT)
{
SetSpawnInfo(id2,99,ATTACKER_SKIN,0,0,0,0,0,0,0,0,0,0);
SpawnPlayer(id2);
SetPlayerPos(id2,as[0][sx],as[0][sy],as[0][sz]);
mySetPlayerColor(id2,COLOR_ATT);
SetPlayerTeam(id2,2);SetPlayerTeam(id2,1);
}
else if(Player[id2][pTeam] == T_DEF)
{
SetSpawnInfo(id2,99,DEFENDER_SKIN,0,0,0,0,0,0,0,0,0,0);
SpawnPlayer(id2);
SetPlayerPos(id2,ds[0][sx],ds[0][sy],ds[0][sz]);
mySetPlayerColor(id2,COLOR_DEF);
SetPlayerTeam(id2,1);SetPlayerTeam(id2,2);
}
else if(Player[id2][pTeam] == T_REF)
{
SetSpawnInfo(id2,99,REFEREE_SKIN,0,0,0,0,0,0,0,0,0,0);
SpawnPlayer(id2);
SetPlayerPos(id2,BaseCP[0],BaseCP[1],BaseCP[2]);
mySetPlayerColor(id2,COLOR_REF);
SetPlayerTeam(id2,3);
}
}
else if(GAMETYPE==1)
{
farena = Arenafile(Current);
GangZoneShowForPlayer(id2, zione[0], 0x000000AA);
GangZoneShowForPlayer(id2, zione[1], 0x000000AA);
GangZoneShowForPlayer(id2, zione[2], 0x000000AA);
GangZoneShowForPlayer(id2, zione[3], 0x000000AA);
format(strok, STR, "a_%d", 0);
idx = 0;
if(dini_Isset(farena,strok))
{
strok = dini_Get(farena,strok);
as[0][sx] = floatstr(strtok(strok,idx,','));
as[0][sy] = floatstr(strtok(strok,idx,','));
as[0][sz] = floatstr(strtok(strok,idx,','));
as[0][sin] = true;
}
else as[id][sin] = false;
format(strok, STR, "d_%d", 0);
idx = 0;
if(dini_Isset(farena,strok))
{
strok = dini_Get(farena,strok);
ds[0][sx] = floatstr(strtok(strok,idx,','));
ds[0][sy] = floatstr(strtok(strok,idx,','));
ds[0][sz] = floatstr(strtok(strok,idx,','));
ds[0][sin] = true;
}
else ds[0][sin] = false;
if(Player[id2][pTeam] == T_ATT)
{
SetSpawnInfo(id2,99,ATTACKER_SKIN,0,0,0,0,0,0,0,0,0,0);
SpawnPlayer(id2);
SetPlayerPos(id2,as[0][sx],as[0][sy],as[0][sz]);
mySetPlayerColor(id2,COLOR_ATT);
SetPlayerTeam(id2,2);SetPlayerTeam(id2,1);
}
else if(Player[id2][pTeam] == T_DEF)
{
SetSpawnInfo(id2,99,DEFENDER_SKIN,0,0,0,0,0,0,0,0,0,0);
SpawnPlayer(id2);
SetPlayerPos(id2,ds[0][sx],ds[0][sy],ds[0][sz]);
mySetPlayerColor(id2,COLOR_DEF);
SetPlayerTeam(id2,1);SetPlayerTeam(id2,2);
}
else if(Player[id2][pTeam] == T_REF)
{
SetSpawnInfo(id2,99,REFEREE_SKIN,0,0,0,0,0,0,0,0,0,0);
SpawnPlayer(id2);
SetPlayerPos(id2,ArenaCP[0],ArenaCP[1],ArenaCP[2]);
mySetPlayerColor(id2,COLOR_REF);
SetPlayerTeam(id2,3);
}
}
DestroyObject(gWeaponObject[id2]);
gWeaponObject[id2] = -1;
gPlayerDeathWeapon[id2] = -1;
gPlayerDeathWeaponAmmo[id2] = -1;
TogglePlayerControllable(id2,1);
SetCameraBehindPlayer(id2);
SetPlayerInterior(id2,interior);
SetPlayerHealth(id2,hp);
ResetPlayerWeapons(id2);
StrapUp(id2);
MarkerStealth();
TeamFix();
format(strok,256,"%s äîáàâëåí â ðàóíä ñ %dHP",Player[id2][ppName],hp);
if(teamid==1) SendClientMessageToAll(AAD_COLOR_RED,strok);
if(teamid==2) SendClientMessageToAll(AAD_COLOR_GREEN,strok);
}
return 1;
}