01.12.2013, 22:58
Set s to s[128]. In sscanf you need to set all strings to how "big" they are. Also I don't think you need to have message but you can use "string" for everything instead but up to you bud'.
Haven't tested it but according to what I wrote above it should be like this:
But I'd rather just do this:
But I'm not a professional but that's the only wrong thing I find. Test them, one of them should work if not both.
For instance I'm using just one string variable in my "/me" and "/do" commands.
Haven't tested it but according to what I wrote above it should be like this:
Код:
CMD:megaphone(playerid, params[])
{
if(!IsPlayerLEO(playerid)) return ErrorMessage(pid, "You are not LEO.");
new string[128], message[100];
if(sscanf(params,"s[100]", message)) return UsageMessage(pid, "/m(egaphpone) [message]");
format(string, sizeof(string), "[Megaphone]: %s", message);
ProxDetector(50.0, playerid, string, 0xFF8C00AA);
return 1;
}
Код:
CMD:megaphone(playerid, params[])
{
if(!IsPlayerLEO(playerid)) return ErrorMessage(pid, "You are not LEO.");
new string[128];
if(sscanf(params,"s[128]", string)) return UsageMessage(pid, "/m(egaphpone) [message]");
format(string, sizeof(string), "[Megaphone]: %s", string);
ProxDetector(50.0, playerid, string, 0xFF8C00AA);
return 1;
}
For instance I'm using just one string variable in my "/me" and "/do" commands.

