20.12.2011, 14:29
this i my command
PHP код:
if(strcmp(cmd, "/faction", true) == 0 || strcmp(cmd, "/f", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(PlayerInfo[playerid][pMuted] != 0)
{
SendClientMessage(playerid, COLOR_ADMINCMD, " Ти си заглушен и не можеш да пишеш.");
return 1;
}
if(PlayerInfo[playerid][pMember] == TEAM_CIVILIAN)
{
SendClientMessage(playerid, COLOR_ADMINCMD, " Неможеш да използваш тази команда понеже ти неси в банда или мафия.");
return 1;
}
new length = strlen(cmdtext);
new team = gTeam[playerid];
while ((idx < length) && (cmdtext[idx] <= ' '))
{
idx++;
}
new offset = idx;
new result[256];
while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
{
result[idx - offset] = cmdtext[idx];
idx++;
}
result[idx - offset] = EOS;
if(!strlen(result))
{
SendClientMessage(playerid, COLOR_WHITE, "USAGE: (/f)action [team chat]");
return 1;
}
new ranktext[256];
switch(PlayerInfo[playerid][pRank])
{
case 1: format(ranktext, sizeof(ranktext), "%s", TeamInfo[PlayerInfo[playerid][pMember]][fRank1]);
case 2: format(ranktext, sizeof(ranktext), "%s", TeamInfo[PlayerInfo[playerid][pMember]][fRank2]);
case 3: format(ranktext, sizeof(ranktext), "%s", TeamInfo[PlayerInfo[playerid][pMember]][fRank3]);
case 4: format(ranktext, sizeof(ranktext), "%s", TeamInfo[PlayerInfo[playerid][pMember]][fRank4]);
case 5: format(ranktext, sizeof(ranktext), "%s", TeamInfo[PlayerInfo[playerid][pMember]][fRank5]);
case 6: format(ranktext, sizeof(ranktext), "%s", TeamInfo[PlayerInfo[playerid][pMember]][fRank6]);
}
format(string, sizeof(string), "[ID:%d Rank:%s] %s : %s",playerid, ranktext, PlayerName(playerid), result);
SendFactionMessage(team, COLOR_LIGHTBLUE, string);
}
return 1;
}