megaphone
#3

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:

Код:
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;
}
But I'd rather just do this:
Код:
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;
}
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.
Reply


Messages In This Thread
megaphone - by Mattakil - 01.12.2013, 22:47
Re: megaphone - by Wizzy951 - 01.12.2013, 22:49
Re: megaphone - by Hansrutger - 01.12.2013, 22:58
Re: megaphone - by Mattakil - 01.12.2013, 23:06
Re: megaphone - by Hansrutger - 01.12.2013, 23:14
Re: megaphone - by Mattakil - 01.12.2013, 23:18
Re: megaphone - by Hansrutger - 01.12.2013, 23:21
Re: megaphone - by Wizzy951 - 01.12.2013, 23:25
Re: megaphone - by Mattakil - 01.12.2013, 23:49
Re: megaphone - by Hansrutger - 02.12.2013, 09:11

Forum Jump:


Users browsing this thread: 1 Guest(s)