#define POLICE 2
#define AP 3
if(strcmp(cmd, "/dr", true) == 0 || strcmp(cmd, "/dept", true) == 0)
{
new length = strlen(cmdtext);
while ((idx < length) && (cmdtext[idx] <= ' '))
{
idx++;
}
new offset = idx;
new DeptName[10];
new name[24];
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: (/dr) [team chat]");
return 1;
}
if(gTeam[playerid] == POLICE) DeptName = "SASP";
else if(gTeam[playerid] == AP) DeptName = "Agency";
GetPlayerName(playerid, name, 24);
SendFactionMessage(result, POLICE, AP); // <------The error line
return 1;
}
stock SendFactionMessage(DeptName,name,result[],faction2, faction3)
{
for(new i=0; i < MAX_PLAYERS ;i++)
{
if(IsPlayerConnected(i))
{
if(gTeam[i] == faction2 || gTeam[i] == faction3)
{
SendClientMessage(i,COLOR_ORANGE,gstr);
format(gstr, sizeof(gstr), "[%s] %s says: %s", DeptName, name, result);
}
}
}
}
stock SendFactionMessage(DeptName[], name[], result[], faction2, faction3)
SendFactionMessage(DeptName, name, result, POLICE, AP);
You should to declare "DeptName" and "Name" as array.
pawn Код:
pawn Код:
|
stock SendFactionMessage(DeptName,name,result[],faction2, faction3)
Glad you fixed it but for future
When you are making stock like this PHP код:
Good luck ![]() |
Glad you fixed it but for future
When you are making stock like this PHP код:
Good luck ![]() |
I just found a problem, when I turn the server on and type the command and something for the chat, the first line will be empty and each time you type something new in the command it would go invisible until you decide to type a new thing. Simply said, when you write something with the command, you don't see the current one and the previously said thing shows up. For example, if I say /dr 1 then /dr 2 then /dr 3, it will show up as "blank space | /dr 1 and /dr 2."
Is there any way to fix this? |