Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- stock ChangeIdToName(text[])
- {
- new
- pos = -1;
- while((pos = strfind(text,"ID",true)) != -1)
- {
- if(!text[pos+2]) continue;
- new
- noa = 2,
- str[4],
- id,
- ch;
- while((ch = text[pos+noa]) && ch <= '9' && ch >= '0' && noa < 5)
- {
- noa++;
- }
- if(noa == 2) continue;
- strmid(str,text,pos+2,pos+noa);
- id = strval(str);
- if(IsPlayerConnected(id))
- {
- new
- name[MAX_PLAYER_NAME];
- GetPlayerName(id,name,sizeof(name));
- strdel(text,pos,pos+noa);
- strins(name,text,pos,strlen(text));
- }
- else
- {
- strdel(text,pos-1,pos+noa);
- }
- }
- }
- public OnPlayerText(playerid,text[])
- {
- ChangeIdToName(text);
- SendPlayerMessageToAll(playerid,text);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment