SA-MP Forums Archive
[Help] What is this error all about?! - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: [Help] What is this error all about?! (/showthread.php?tid=84345)



[Help] What is this error all about?! - Ace_Menace - 30.06.2009

Код:
error 010: invalid function or declaration

public OnPlayerCommandText(playerid, cmdtext[])
{
dcmd(bcast, 5, cmdtext);
return 0;
}

dcmd_bcast(playerid, params[])
{
new text[40],
time,
font,
style;
if (sscanf(params, "siii", text, time, font, style))
return SendClientMessage(playerid, 0xFF0000AA, "Usage: \"/bcast <text> <time> <font> <style>\""), 1;
else
{
DisplayTextForAll(text[30], time, font, style);
return 1;
}
}
return 0; <-------- Problem Is here!
}


Re: [Help] What is this error all about?! - Grim_ - 30.06.2009

Next time use [ pawn ] and [ /pawn ] tags.
And try deleting the last bracket aswell as the the return 0;


Re: [Help] What is this error all about?! - Ignas1337 - 30.06.2009

no, not that. here's the real deal:
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
dcmd(bcast, 5, cmdtext);
return 0;
}

dcmd_bcast(playerid, params[])
{
new text[40],
time,
font,
style;
if (sscanf(params, "siii", text, time, font, style))
return SendClientMessage(playerid, 0xFF0000AA, "Usage: \"/bcast <text> <time> <font> <style>\""), 1;
else
{
DisplayTextForAll(text[30], time, font, style);
return 1;
}
return 0;
}
a function must return a value... he just had 1 of '}' too much


Re: [Help] What is this error all about?! - Grim_ - 30.06.2009

I knew he had an extra bracket, just wasn't sure about the return 0 either. Too hard to read without pawn tags and indention.