forward problem
#1

I got a lotto script from my friend. Now I getting problem in forward.
pawn Код:
forward Draw(RemoveUnderScore);
public Draw(RemoveUnderScore)
{
    new Lnum = random(100) + 1;
    new winner = -1;
    for(new i; i<MAX_PLAYERS; i++)
    {
        if(!IsPlayerConnected(i)) continue;
        if(GetPVarInt(i, "LottoNumber") == Lnum) winner = i;
        SetPVarInt(i, "LottoNumber", 0);
    }
    if(winner != -1)
    {
        new str[100];
        format(str, sizeof(str), "{FF3399}The lotto ticket winner today was %s. They won a total of $%d! [Ticket number: %d]", RemoveUnderScore(winner), Jackpot, Lnum);
        SendClientMessageToAll(0x62FF32FF, str);
        Player[winner][Money] += Jackpot;
        Jackpot = LOTTO_START;
    }
    if(winner == -1) //No winner
    {
        new str[100];
        format(str, sizeof(str), "{FF3399}There was no winner for this draw. The jackpot will go up to $%d! [Ticket number: %d]", Jackpot, Lnum);
        SendClientMessageToAll(0x62FF32FF, str);
    }
    for(new s; s<100; s++)
    {
        Numbers[s] = 0;
    }
    return 1;
}
I got this error :[error 012: invalid function call, not a valid address] on that line [format(str, sizeof(str), "{FF3399}The lotto ticket winner today was %s. They won a total of $%d! [Ticket number: %d]", RemoveUnderScore(winner), Jackpot, Lnum);]

Can some one help me.

+ rep
Reply
#2

pawn Код:
forward Draw();
public Draw()
Reply
#3

I did, but I got that error, undefined symbol "RemoveUnderScore"
Reply
#4

You need to define it then

pawn Код:
stock RemoveUnderScore(playerid)
{
    new name[MAX_PLAYER_NAME];
    GetPlayerName(playerid,name,sizeof(name));
    for(new i = 0; i < MAX_PLAYER_NAME; i++)
    {
        if(name[i] == '_') name[i] = ' ';
    }
    return name;
}
Reply
#5

So define 'RemoveUnderScore...
/facepalm.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)