Need help with announce command
#1

Me and my friend are trying to make a command announce, but something is going wrong what we dont know so might we need your help the code NOW is:

Код:
// This is a comment
// uncomment the line below if you want to write a filterscript
//#define FILTERSCRIPT

#include <a_samp>

public OnPlayerCommandText(playerid, cmdtext[])
{
        if(strcmp(cmdtext, "/announce", true) && APlayerData[playerid][PlayerLevel] >= 5);
        {
                if(strlen(cmdtext) < 10)
                {
                }

                new gText[128];
                format(gText, sizeof(gText), "%s", cmdtext[10]);
                GameTextForAll(gText, 5000, 3);
        }
		return 1;
}
The errors are:

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

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


4 Errors.
Can someone please help me and my friend?
Reply
#2

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if(strcmp(cmdtext, "/announce", true))
    {
        if(APlayerData[playerid][PlayerLevel] >= 5)
        {
            if(strlen(cmdtext) < 10)
            {
                return 1;
            }
            new gText[128];
            format(gText, sizeof(gText), "%s", cmdtext[10]);
            GameTextForAll(gText, 5000, 3);
        }
    }
    return 1;
}
you dont have 2 put ; at last of an if ... and you have to make the APlayerData enum variable
Reply
#3

I dont get it that what you said but can u make that code for me like it has to be?


EDIT Still got same errors
Reply
#4

edit my code ..
Reply
#5

the point is i can't script my friend is the scripter but he just left and now im just alone trying to fix it whit a little knowledge off pawn so i can't edit yours cous i dont get that .
Reply
#6

i dont know what is your system your gm and your experience i cant help u with that
Reply
#7

gm is PPC_trucking system is just windows experience little bit ..
Reply
#8

system i mean save system ... what error you get now?
i reccomend you to use sscanf with zcmd! its better
Reply
#9

C:\Users\Mitchell\Desktop\server\filterscripts\ann ounce.pwn(13) : error 017: undefined symbol "APlayerData"
C:\Users\Mitchell\Desktop\server\filterscripts\ann ounce.pwn(13) : warning 215: expression has no effect
C:\Users\Mitchell\Desktop\server\filterscripts\ann ounce.pwn(13) : error 001: expected token: ";", but found "]"
C:\Users\Mitchell\Desktop\server\filterscripts\ann ounce.pwn(13) : error 029: invalid expression, assumed zero
C:\Users\Mitchell\Desktop\server\filterscripts\ann ounce.pwn(13) : fatal error 107: too many error messages on one line

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


4 Errors.
still the same and sscanf is now in includes zcmd no expierence with that
Reply
#10

Download here ZCMD, put it in pawno/include and then in pawn
pawn Код:
#include <zcmd>
and then here's your code:
pawn Код:
//Announcer script by Seven_of_Nine :]
COMMAND:announce(playerid,params[]) {
    new
        poster[40],
        mess[128];
    sscanf(params,"s",mess);
    if(PlayerInfo[playerid][pAdminLevel] >= 3) {
        if(!isnull(mess)) {
            new text[128];
            GetPlayerName(playerid,poster,sizeof(poster));
            format(text,sizeof(text),"[Announce] | Administrator \"%s\" has announced his message. (%s)",poster,mess);
            SendClientMessageToAll(COLOR_LIGHTBLUE,text);
            GameTextForAll(mess,5000,3);
        } else {
            return SendClientMessage(playerid,red,"USAGE: /announce [message], and all players will see this message on-screen.");
        }
    } else {
        return SendClientMessage(playerid,red,"Only lvl3 admins can use this command. Looking for a way to announce? Try /message!");
    }
    return 1;
}
tested, it's in my admin script, feel free to edit it.
Make sure it's not in OnPlayerCommandText!

:]

EDIT: I know sscanf() would be better done with 'if' but I didn't know that before
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)