21.01.2010, 00:43
Hello friends I need a code to count how many people there with the variable: "PlayerInfo [playerid] [PlayerStatus] == Waiting" I'm not getting, going to down as the code of the command, grateful. See the "TotalDeathMatchPlayer"...
Код:
else if(strcmp(cmd,"/StartDm",true)==0)
{
new tmp[256],tmp2[256],tmp3[256],tmp4[256],tmp5[256],tmp6[256];
tmp = strtok(cmdtext,idx);
new WP1 = strval(tmp);
tmp2 = strtok(cmdtext,idx);
new WP2 = strval(tmp2);
tmp3 = strtok(cmdtext,idx);
new WP3 = strval(tmp3);
tmp4 = strtok(cmdtext,idx);
new WP4 = strval(tmp4);
tmp5 = strtok(cmdtext,idx);
new WP5 = strval(tmp5);
tmp6 = strtok(cmdtext,idx);
new WP6 = strval(tmp6);
if(PlayerInfo[playerid][Admin] >= 3)
{
if(ServerInfo[RoundType]!=None) SendClientMessage(playerid,ServerColor2,"(ERROR): Um Round jб Esta Sendo Jogado.");
else if(TeamInfo[TeamA][Count]==0||TeamInfo[TeamB][Count]==0) SendClientMessage(playerid,ServerColor2,"(ERROR): Nгo hб Jogadores Suficiente Para iniciar um DM.");
else if(DeathMatch >= 1) SendClientMessage(playerid,ServerColor2,"(ERROR): Jб existe um DeathMatch nese momento.");
else if(!strlen(tmp)||!strlen(tmp2)||!strlen(tmp3)||!strlen(tmp4)||!strlen(tmp5)||!strlen(tmp6)) SendClientMessage(playerid,ServerColor2,"(ERROR): /Startdm [ID Arma 1] [ID Arma 2] [ID Arma 3] [ID Arma 4] [ID Arma 5] [ID Arma 6].");
else if(!IsNumeric(tmp)||!IsNumeric(tmp2)||!IsNumeric(tmp3)||!IsNumeric(tmp4)||!IsNumeric(tmp5)||!IsNumeric(tmp6)) SendClientMessage(playerid,ServerColor2,"(ERROR): /Startdm [ID Arma 1] [ID Arma 2] [ID Arma 3] [ID Arma 4] [ID Arma 5] [ID Arma 6].");
else
{
for(new j = 0; j < MaxPlayers; j++)
{
if(IsPlayerConnected(j) && PlayerInfo[j][PlayerStatus]==Waiting)
{
OnDM[j] = 1;
new randPosD = random(sizeof(RandomPosDM));
SetPlayerPos(j,RandomPosDM[randPosD][0],RandomPosDM[randPosD][1],RandomPosDM[randPosD][2]);
SetPlayerFacingAngle(playerid, 270.0);
TogglePlayerControllable(j,0);
SetPlayerVirtualWorld(j,10);
SetPlayerColor(j,ServerColor4);
DMKills[j] = 0;
GivePlayerWeapon(j,WP1,1);
GivePlayerWeapon(j,WP2,999);
GivePlayerWeapon(j,WP3,999);
GivePlayerWeapon(j,WP4,999);
GivePlayerWeapon(j,WP5,999);
GivePlayerWeapon(j,WP6,5);
new ActivePlayer = PlayerInfo[j][PlayerStatus]==Waiting;
for(new i = 0; i < ActivePlayer ; i++)
TotalDeathMatchPlayers = i;
DMTime = 5;
}
}
}
}
else SendClientMessage(playerid,ServerColor2,"(ERROR): Vocк precisar ser admin para isso.");
return 1;
}

