15.07.2011, 19:09
This is my /me and /do script:
How do I split the /me's and /do's up so that when they are too long, they go onto the 2nd line?
pawn Код:
public OnPlayerCommandText( playerid, cmdtext[ ] )
{
if ( !strcmp( cmdtext, "/me", true, 3 ) )
{
if ( cmdtext[ 3 ] != ' ' || !cmdtext[ 4 ] )
return SendClientMessage( playerid, -1, "USAGE: /me (action)" );
new
tempString[ 128 ],
pName[ 24 ]
;
GetPlayerName( playerid, pName, sizeof pName );
format( tempString, sizeof tempString, "*%s%s", RemoveUnderScore(playerid), cmdtext[ 3 ] );
SendClosestMessage( playerid, COLOR_PINK, tempString );
return 1;
}
if ( !strcmp( cmdtext, "/do", true, 3 ) )
{
if ( cmdtext[ 3 ] != ' ' || !cmdtext[ 4 ] )
return SendClientMessage( playerid, -1, "USAGE: /do (action)" );
new
tempString[ 128 ],
pName[ 24 ]
;
GetPlayerName( playerid, pName, sizeof pName );
new stringpos;
if (((stringpos = strfind(" ", pName))) != -1)
{
pName[stringpos] = ' ';
}
format( tempString, sizeof tempString, "* (( %s )) %s" , RemoveUnderScore(playerid), cmdtext[ 3 ] );
SendClosestMessage( playerid, COLOR_PINK, tempString );
return 1;
}
return 0;
}