02.11.2014, 08:12
(
Последний раз редактировалось Quickie; 02.11.2014 в 12:04.
)
Enjoy ![Cheesy](images/smilies/biggrin.png)
NOTE: you will have a problem if you dont set the player's color
current "id's" limit 10
and heres your loop
EDIT: NEW VERSION (bug free)
PM me if you found any bugs
![Cheesy](images/smilies/biggrin.png)
NOTE: you will have a problem if you dont set the player's color
pawn Код:
SetPlayerColor(playerid,color);
and heres your loop
EDIT: NEW VERSION (bug free)
PM me if you found any bugs
pawn Код:
public OnPlayerText(playerid, text[])
{
new findid=strfind(text,"id",true,0);
if(findid!=-1)
{
new msg[20],id,extra,name[MAX_PLAYER_NAME],tempmsg[300],tempmsg2[300],index,success;
format(tempmsg2,sizeof(tempmsg2),"%s",text);
for(new i;i!=10;i++)
{
new pname[MAX_PLAYER_NAME];
findid=strfind(tempmsg2,"id",true,index);
index=findid+5;
if(findid==-1)
{
break;
}
strmid(msg,tempmsg2,findid,findid+5);
if(sscanf(msg,"uu",extra,id))
{
continue;
}
if(id==INVALID_PLAYER_ID)
{
continue;
}
GetPlayerName(id,pname,sizeof(pname));
strdel(tempmsg2,findid,index);
strins(tempmsg2,"{%06x}%s{FFFFFF} ",findid,strlen("{%06x}%s{FFFFFF}"));
format(tempmsg,sizeof(tempmsg),tempmsg2,GetPlayerColor(id) >>> 8,pname);
format(tempmsg2,sizeof(tempmsg2),"%s",tempmsg);
success++;
}
if(success==0)
{
return 1;
}
GetPlayerName(playerid,name,sizeof(name));
format(tempmsg2,sizeof(tempmsg2),"{%06x}%s: {FFFFFF}",GetPlayerColor(playerid) >>> 8,name);
strcat(tempmsg2,tempmsg);
SendClientMessageToAll(-1,tempmsg2);
return 0;
}
return 1;
}