Posts: 9
Threads: 5
Joined: Mar 2014
Reputation:
0
Hello, can someone please show me how to make a loop which sends the command to the enumerator value of the person executing the command? So, for example, Player A does /factionmessage and it only sends this message to people whose faction enumerator is == 1 (assuming Player A's is "1")
Thanks.
Posts: 1,241
Threads: 67
Joined: Dec 2013
PHP код:
if(strcmp(cmd,"/p",true)==0) if(Logged[playerid] == 1)
{
GetPlayerName(playerid, sendername, sizeof(sendername));
new length = strlen(cmdtext);
while ((idx < length) && (cmdtext[idx] <= ' '))
{
idx++;
}
new offset = idx;
new result[64];
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: /p (message)");
return 1;
}
if(gTeam[playerid] == TEAM_POLICE)
{
format(string, sizeof(string), "Police officer %s : %s", sendername,result);
SendClientMessageToTeam(TEAM_POLICE,TEAM_POLICE_COLOR,string);
SendClientMessageToTeam(TEAM_SG,TEAM_POLICE_COLOR,string);
SendClientMessageToTeam(TEAM_SWAT,TEAM_POLICE_COLOR,string);
SendClientMessageToTeam(TEAM_MAYOR,TEAM_POLICE_COLOR,string);
SendClientMessageToTeam(TEAM_PD,TEAM_POLICE_COLOR,string);
SendClientMessageToTeam(TEAM_ARMY,TEAM_POLICE_COLOR,string);
SendClientMessageToTeam(TEAM_ARMYG,TEAM_POLICE_COLOR,string);
return 1;
}
return 1;
}
Posts: 9
Threads: 5
Joined: Mar 2014
Reputation:
0
Thank you for the responses.