Is there a problem with this code -
Mr.Fames - 12.05.2012
hey guys is there a problem in this
pawn Код:
CMD:announce(playerid, params[])
{
if(IsPlayerAdmin(playerid))
return SendClientMessage(playerid, "You are not allowed to use this command");
new text[64], time, style;
if (sscanf(params, "iis[64]", style, time, text)) return
SendClientMessage( playerid,"Usage: /announce <style[0-6]> <time in ms> <text>");
if (strlen(text) > 64) return
SendClientMessage(playerid,"Message too long please shorten it ");
if(style == 2) return SendClientMessage(playerid,"Bug with style 2 don't use it!");
if (style < 0 || style > 6) return
SendClientMessage(playerid,0x854900FF,"Invalid style");
if (time > 20*1000) return
SendClientMessage(playerid,"No longer than 20 seconds");
GameTextForAll(text, time, style);
return true;
}
Re: Is there a problem with this code -
[HiC]TheKiller - 12.05.2012
I don't see any issue with that command, make sure that you're logged in as an RCON admin.
Re: Is there a problem with this code -
CoaPsyFactor - 12.05.2012
And what is the problem? server.log ?
Re: Is there a problem with this code -
MP2 - 12.05.2012
pawn Код:
SendClientMessage(playerid, "You are not allowed to use this command");
You're missing the color parameter.
Typing the function and an opening parenthesis in pawno will pop up the syntax. Type 'SendClientMessage(' in pawno and it will show you the syntax.
Re: Is there a problem with this code -
JaKe Elite - 12.05.2012
[HiC]TheKiller, no its not ok
Few Reasons:
First
pawn Код:
if(IsPlayerAdmin(playerid))
return SendClientMessage(playerid, "You are not allowed to use this command"); <<< you will get error in this line
You will get error because you forget color + when you login as RCON Admin and use this command you will get
'You are not allowed to use this command'
2nd
pawn Код:
if (sscanf(params, "iis[64]", style, time, text)) return
SendClientMessage( playerid,"Usage: /announce <style[0-6]> <time in ms> <text>"); <<< in this line
You will get error in this line because you forget to add color
3rd
pawn Код:
if(style == 2) return SendClientMessage(playerid,"Bug with style 2 don't use it!"); <<< In this line
You will get error in this line because you forget to add color
4th
pawn Код:
if (time > 20*1000) return
SendClientMessage(playerid,"No longer than 20 seconds");
You will get error you forget to add color
Fix Version:
pawn Код:
CMD:announce(playerid, params[])
{
if(!IsPlayerAdmin(playerid))
return SendClientMessage(playerid, 0xFF0000FF, "You are not allowed to use this command");
new text[64], time, style;
if (sscanf(params, "iis[64]", style, time, text)) return
SendClientMessage( playerid, 0xFF0000FF, "Usage: /announce <style[0-6]> <time in ms> <text>");
if (strlen(text) > 64) return
SendClientMessage(playerid, 0xFF0000FF, "Message too long please shorten it ");
if(style == 2) return SendClientMessage(playerid, 0xFF0000FF, "Bug with style 2 don't use it!");
if (style < 0 || style > 6) return
SendClientMessage(playerid,0x854900FF,"Invalid style");
if (time > 20*1000) return
SendClientMessage(playerid, 0xFF0000FF, "No longer than 20 seconds");
GameTextForAll(text, time, style);
return true;
}
Re: Is there a problem with this code -
Mr.Fames - 12.05.2012
Thanks guys the problem seems it was the color solved