if(strcmp(cmd, "/gov", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(PlayerInfo[playerid][pJob] == 77 || IsInFaction(playerid, "LSPD") || IsInFaction(playerid, "GOV") || IsInFaction(playerid, "LSFD") || IsInFaction(playerid, "NG") || IsInFaction(playerid, "FBI") || IsInFaction(playerid, "SASD") || IsInFaction(playerid, "CIA"))
{
format(string, sizeof(string),"|___________________________________Government Announcement___________________________________|");
SendClientMessage(giveplayerid, COLOR_ORANGE, string);
format(string, sizeof(string), "[%s: %s %s] %s",GetPlayerFactionName(playerid),GetPlayerRank(playerid),GetPlayerNameEx(playerid),result);
SendClientMessage(giveplayerid, COLOR_WHITE, string);
format(string, sizeof(string),"|___________________________________Government Announcement___________________________________|");
SendClientMessage(giveplayerid, COLOR_ORANGE, string);
}
}
else SendClientMessage(playerid, COLOR_GRAD1, "You can't use this command!");
return 1;
}
CMD:gov(playerid, params[])
{
if(IsPlayerConnected(playerid))
{
if(PlayerInfo[playerid][pJob] == 77 || IsInFaction(playerid, "LSPD") || IsInFaction(playerid, "GOV") || IsInFaction(playerid, "LSFD") || IsInFaction(playerid, "NG") || IsInFaction(playerid, "FBI") || IsInFaction(playerid, "SASD") || IsInFaction(playerid, "CIA"))
{
new result;
if(sscanf(params, "s", result)) return SendClientMessage(playerid, -1, "USAGE: /gov [message]");
format(string, sizeof(string),"|___________________________________Government Announcement___________________________________|");
SendClientMessage(giveplayerid, COLOR_ORANGE, string);
format(string, sizeof(string), "[%s: %s %s] %s",GetPlayerFactionName(playerid),GetPlayerRank(playerid),GetPlayerNameEx(playerid),result);
SendClientMessage(giveplayerid, COLOR_WHITE, string);
format(string, sizeof(string),"|___________________________________Government Announcement___________________________________|");
SendClientMessage(giveplayerid, COLOR_ORANGE, string);
}
}
else SendClientMessage(playerid, COLOR_GRAD1, "You can't use this command!");
return 1;
}
The result variable is supposed to be the message?
Use sscanf and ZCMD instead, they're faster. zcmd.inc sscanf pawn Код:
|
error 029: invalid expression, assumed zero
error 017: undefined symbol "cmd_gov"
error 029: invalid expression, assumed zero
fatal error 107: too many error messages on one line
CMD:gov(playerid, params[])
{
if(IsPlayerConnected(playerid))
{
if(PlayerInfo[playerid][pJob] == 77 || IsInFaction(playerid, "LSPD") || IsInFaction(playerid, "GOV") || IsInFaction(playerid, "LSFD") || IsInFaction(playerid, "NG") || IsInFaction(playerid, "FBI") || IsInFaction(playerid, "SASD") || IsInFaction(playerid, "CIA"))
{
new Result[64], String[128];
if(sscanf(params, "s[64]", Result)) return SendClientMessage(playerid, -1, "USAGE: /gov [message]");
SendClientMessageToAll(COLOR_ORANGE, "|___________________________________Government Announcement___________________________________|");
format(String, sizeof(String), "[%s: %s %s] %s",GetPlayerFactionName(playerid),GetPlayerRank(playerid),GetPlayerNameEx(playerid), Result);
SendClientMessage(giveplayerid, COLOR_WHITE, String);
SendClientMessageToAll(COLOR_ORANGE, "|___________________________________Government Announcement___________________________________|");
}
}
else SendClientMessage(playerid, COLOR_GRAD1, "You can't use this command!");
return 1;
}