PAWN Crash
#1

pawn Код:
if(strcmp(cmd, "/startlottery", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            if(PlayerInfo[playerid][pAdmin] >= 5)
            {
                if(LotteryNumber == 0)
                {
                    tmp = mystrtok(cmdtext,idx);
                    if(!strlen(tmp))
                    {
                        SendClientMessage(playerid,COLOR_GREY,".: Usage: /startlottery [LotteryNumber] [Price] :.");
                        return 1;
                    }
                    new lotnumb,price;
                    lotnumb = strval(tmp);
                    tmp = mystrtok(cmdtext,idx);
                    price = strval(tmp);
                   
                    if(lotnumb < 1 || lotnumb > 150)
                    {
                        SendClientMessage(playerid,COLOR_ERROR,".: Error: You must insert a lottery number between 1 - 150");
                        return 1;
                    }
                    if(price < 1 || price > 500000)
                    {
                        SendClientMessage(playerid,COLOR_ERROR,".: Error: You must insert a price between 1 - 500,000");
                        return 1;
                    }
                   
                    LotteryNumber = lotnumb;
                    LotteryPrice = price;
                    LotterySpent = 0;
                    SendClientMessageToAll(COLOR_LOT1,"[Lottery] The Lottery has been {66CCCC}started.\n {6699CC}Use {66CCCC}/lot [number] {6699CC}to practicipate and get a chance to win !
                }
                else
                {
                    SendClientMessage(playerid,COLOR_ERROR,"
.: Error: A Lottery is already started :.");
                }
            }
        }
    return 1;
    }
Why is this command crashing my pawno?
Reply
#2

pawn Код:
SendClientMessageToAll(COLOR_LOT1,"[Lottery] The Lottery has been {66CCCC}started.\n {6699CC}Use {66CCCC}/lot [number] {6699CC}to practicipate and get a chance to win !
You need to end the client message statement.

Fixed code:
pawn Код:
SendClientMessageToAll(COLOR_LOT1,"[Lottery] The Lottery has been {66CCCC}started.\n {6699CC}Use {66CCCC}/lot [number] {6699CC}to practicipate and get a chance to win !");
Also, I'm not entirely sure you can use '/n' to start a new line in a client message, you might have to send a new client message.
Reply
#3

EDIT: Too slow
Reply
#4

Thanks Calgon !
I didn't notice that I didn't end the statement.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)