SA-MP Forums Archive
/announce cmd help - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: /announce cmd help (/showthread.php?tid=421230)



/announce cmd help - S4ba - 08.03.2013

If anyone can tell me what I did wrong here :

Код:
C:\Users\Marko\Desktop\trucking\filterscripts\announce.pwn(12) : error 076: syntax error in the expression, or invalid function call
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.
Код:
//Includes
#include <a_samp>
#include <zcmd>
#include <sscanf2>

//Defines
#define COLOR_WHITE 0xFFFFFFAA

//Command
CMD:announce(playerid, params[])
{
    if(IsPlayerAdmin, playerid, PlayerLevel >= 2)
  return SendClientMessage(playerid, COLOR_WHITE, "You are not allowed to use this command!");

    new text[64], time, style;
    if (sscanf(params, "iis[64]", style, time, text)) return
        SendClientMessage(playerid, COLOR_WHITE, "Usage: /announce <style[0-6]> <time in ms> <text>");
    if (strlen(text) > 64) return
        SendClientMessage(playerid, COLOR_WHITE, "Message too long please shorten it!");
    if(style == 2) return SendClientMessage(playerid, COLOR_WHITE, "Bug with style 2 don't use it!");
    if (style < 0 || style > 6) return
        SendClientMessage(playerid, COLOR_WHITE,"Invalid style!");
    if (time > 20*1000) return
        SendClientMessage(playerid, COLOR_WHITE, "No longer than 20 seconds!");
    GameTextForAll(text, time, style);
    return 1;
}



Re: /announce cmd help - NathNathii - 08.03.2013

Would help if you show line 12.


Re: /announce cmd help - S4ba - 08.03.2013

Код:
    if(IsPlayerAdmin, playerid, PlayerLevel >= 2)



Re: /announce cmd help - NathNathii - 08.03.2013

Try this

pawn Код:
CMD:announce(playerid, params[])
{
    if(APlayerData[playerid][PlayerLevel] < 2 && !IsPlayerAdmin(playerid))return SendClientMessage(playerid,-1,"Error: No command for you!");
    new text[64], time, style;
    if (sscanf(params, "iis[64]", style, time, text)) return
    SendClientMessage(playerid, COLOR_WHITE, "Usage: /announce <style[0-6]> <time in ms> <text>");
    if (strlen(text) > 64) return
    SendClientMessage(playerid, COLOR_WHITE, "Message too long please shorten it!");
    if(style == 2) return SendClientMessage(playerid, COLOR_WHITE, "Bug with style 2 don't use it!");
    if (style < 0 || style > 6) return
    SendClientMessage(playerid, COLOR_WHITE,"Invalid style!");
    if (time > 20*1000) return
    SendClientMessage(playerid, COLOR_WHITE, "No longer than 20 seconds!");
    GameTextForAll(text, time, style);
    return 1;
}



Re: /announce cmd help - S4ba - 08.03.2013

Код:
C:\Users\Marko\Desktop\trucking\filterscripts\announce.pwn(12) : error 017: undefined symbol "APlayerData"
C:\Users\Marko\Desktop\trucking\filterscripts\announce.pwn(12) : warning 215: expression has no effect
C:\Users\Marko\Desktop\trucking\filterscripts\announce.pwn(12) : error 001: expected token: ";", but found "]"
C:\Users\Marko\Desktop\trucking\filterscripts\announce.pwn(12) : error 029: invalid expression, assumed zero
C:\Users\Marko\Desktop\trucking\filterscripts\announce.pwn(12) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Errors.



Re: /announce cmd help - PabloDiCostanzo - 08.03.2013

I`ll give you my command

pawn Код:
dcmd_announce(playerid,params[])
{
    if(AccInfo[playerid][Level] >= 3 || IsPlayerAdmin(playerid))
    {
        if(!strlen(params)) return
        SendClientMessage(playerid, grey, "USAGE: /announce [Text]") &&
        SendClientMessage(playerid, orange, "ATENTION: Function will announce the specified message in screen");
        SendCommandToAdmins(playerid,"Announce");
        return GameTextForAll(params,4000,3);
    }
    else return ErrorMessages(playerid, 7);
}



Re: /announce cmd help - NathNathii - 08.03.2013

Deleted


Re: /announce cmd help - S4ba - 08.03.2013

Quote:
Originally Posted by PabloDiCostanzo
Посмотреть сообщение
I`ll give you my command

pawn Код:
dcmd_announce(playerid,params[])
{
    if(AccInfo[playerid][Level] >= 3 || IsPlayerAdmin(playerid))
    {
        if(!strlen(params)) return
        SendClientMessage(playerid, grey, "USAGE: /announce [Text]") &&
        SendClientMessage(playerid, orange, "ATENTION: Function will announce the specified message in screen");
        SendCommandToAdmins(playerid,"Announce");
        return GameTextForAll(params,4000,3);
    }
    else return ErrorMessages(playerid, 7);
}
thx, but i get this warning, how to fix it ?

Код:
C:\Users\Marko\Desktop\trucking\filterscripts\announce.pwn(21) : warning 203: symbol is never used: "dcmd_announce"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Warning.



Re: /announce cmd help - NathNathii - 08.03.2013

Try this, idk.

pawn Код:
CMD:announce(playerid,params[])
{
    if(AccInfo[playerid][Level] >= 3 || IsPlayerAdmin(playerid))
    {
        if(!strlen(params)) return
        SendClientMessage(playerid, grey, "USAGE: /announce [Text]") &&
        SendClientMessage(playerid, orange, "ATENTION: Function will announce the specified message in screen");
        SendCommandToAdmins(playerid,"Announce");
        return GameTextForAll(params,4000,3);
    }
    else return ErrorMessages(playerid, 7);
}



Re: /announce cmd help - PabloDiCostanzo - 08.03.2013

Quote:
Originally Posted by S4ba
Посмотреть сообщение
thx, but i get this warning, how to fix it ?

Код:
C:\Users\Marko\Desktop\trucking\filterscripts\announce.pwn(21) : warning 203: symbol is never used: "dcmd_announce"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Warning.
You have defined already announce somewhere, delete the other announce and add mine