Code:
stock SMessage(playerid,color,str[],len=128,lines=20){
if(!len||!str[0])return true;
new c=0,x=0;if(len>128||len<0)len=128;
for(new i=0,j,y=0;i<lines;y=0,i++){
for(j=x+_:!i;j<x+len&&str[j];j++){
if(str[j]<33){if(str[j-1]>32)y=j;}
}if(!str[j])j=-1;else{
if(!y){
if(str[j]>32||str[j-1]<33)c=str[j];else c=0;y=j;
}else c=0;str[y]=0;
}if(playerid<0)SendClientMessageToAll(color,str[x]);
else SendClientMessage(playerid,color,str[x]);
if(j<0)break;str[y]=c;x=y+(c?0:1);
}return true;
}
Sends a client messages to player or all players. The message is divided to reach maximum 'len' characters in one line. That will send ass many lines as needed between 0 and 'lines' parameter.
'playerid' is a player ID, which receive the 'str[]' message. Use -1 for all players.
'color' is color of the message. 'len' : max length of one line , 'lines' : the maximum of allowed lines.
This function should send words separated as their lenght are worse than 'len' parameter.
That's all.
By the way,
Quote:
Originally Posted by Vetle
Get Player ID:
pawn Code:
stock GetPlayerID(playerid) { return playerid; }
|
Yeah! That's very useful. Why didn't I use it so far?