Invalid Command Length (Exceeding 50 characters) - 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: Invalid Command Length (Exceeding 50 characters) (
/showthread.php?tid=266830)
Invalid Command Length (Exceeding 50 characters) -
adrianneow - 06.07.2011
pawn Код:
if(strcmp(cmd, "/me", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(gPlayerLogged[playerid] == 0)
{
SendClientMessage(playerid, COLOR_GREY, " You havent logged in yet !");
return 1;
}
GetPlayerName(playerid, sendername, sizeof(sendername));
new length = strlen(cmdtext);
while ((idx < length) && (cmdtext[idx] <= ' '))
{
idx++;
}
new offset = idx;
new result[MAX_STRING];
while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
{
result[idx - offset] = cmdtext[idx];
idx++;
}
result[idx - offset] = EOS;
if(!strlen(result))
{
SendClientMessage(playerid, COLOR_WHITE, "USAGE: /me [action]");
return 1;
}
if(PlayerInfo[playerid][pMask] == 1) format(string, sizeof(string), "* Stranger %s", result);
else format(string, sizeof(string), "* %s %s", sendername, result);
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
}
return 1;
}
Re: Invalid Command Length (Exceeding 50 characters) -
Basicz - 06.07.2011
wtf? exceeding 50 characters?
Try this :
pawn Код:
if ( !strcmp( cmdtext, "/me", true ) )
{
if ( cmdtext[ 3 ] != ' ' || ! cmdtext[ 4 ] ) // Style from hold-studio by Slice
return SendClientMessage( playerid, -1, "SYNTAX: /me [ message ]" );
new hello[ 24 ]; GetPlayerName( playerid, hello, sizeof ( hello ) );
new string[ 128 ]; format( string, sizeof ( string ), "* %s %s", hello, cmdtext[ 3 ] );
ProxDetector( 30.0, playerid, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE );
return 1;
}
Are you sure that command sends the error?
Re: Invalid Command Length (Exceeding 50 characters) -
adrianneow - 06.07.2011
Yes man.......