forward problem - 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: forward problem (
/showthread.php?tid=348974)
forward problem -
umarmalik - 07.06.2012
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
Re: forward problem -
MadeMan - 07.06.2012
pawn Код:
forward Draw();
public Draw()
Re: forward problem -
umarmalik - 07.06.2012
I did, but I got that error, undefined symbol "RemoveUnderScore"
Re: forward problem -
MadeMan - 07.06.2012
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;
}
Re: forward problem -
Firo - 07.06.2012
So define 'RemoveUnderScore...
/facepalm.