Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <a_samp>
- public OnPlayerText(playerid,text[])
- {
- printf("Vyvolán public OnPlayerText");
- new
- len = strlen(text);
- printf("Len = %d",len);
- for(new i=0;i<len;i++)
- {
- printf("Cyklus spuštěn");
- if(text[i] == 'I' && text[i+1] == 'D')
- {
- printf("Nalezeno 'ID'");
- if(!text[i+2]) { printf("V text[i+2] nic neni");continue; }
- else
- {
- printf("V textu je další nejakej char");
- new
- noa = 3,
- str[4],
- id,
- chars;
- while((chars = text[i+noa]) && chars <= '9' && chars >= '0' && noa <= 5)
- {
- noa++;
- printf("Noa++ (%d)",noa);
- }
- printf("Konec, noa = %d",noa);
- if(noa == 1) { printf("Noa = 3, cyklus pokračuje dál ..."); continue; }
- strmid(str,text,i+2,i+noa);
- printf("str = %s",str);
- id = strval(str);
- printf("id = %d",id);
- if(IsPlayerConnected(id))
- {
- printf("Hrac je pripojen");
- new
- name[MAX_PLAYER_NAME];
- GetPlayerName(id,name,sizeof(name));
- printf("Jeho jmeno je %s",name);
- strdel(text,i,i+noa+1);
- printf("Ořezán kus stringu");
- strins(text,name,i,MAX_PLAYER_NAME);
- printf("Přidání jeho jméno");
- }
- else
- {
- printf("Hrac neni pripojen");
- strdel(text,i,i+noa+1);
- }
- }
- }
- }
- SendPlayerMessageToAll(playerid,text);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment