[Help] What is this error all about?!
#1

Код:
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!
}
Reply
#2

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

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
Reply
#4

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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)