Kaczmi

IdChanger_v2

Mar 17th, 2012
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.37 KB | None | 0 0
  1. #include <a_samp>
  2.  
  3. public OnPlayerText(playerid,text[])
  4. {
  5. printf("Vyvolán public OnPlayerText");
  6. new
  7. len = strlen(text);
  8. printf("Len = %d",len);
  9.  
  10. for(new i=0;i<len;i++)
  11. {
  12. printf("Cyklus spuštěn");
  13. if(text[i] == 'I' && text[i+1] == 'D')
  14. {
  15. printf("Nalezeno 'ID'");
  16. if(!text[i+2]) { printf("V text[i+2] nic neni");continue; }
  17. else
  18. {
  19. printf("V textu je další nejakej char");
  20. new
  21. noa = 3,
  22. str[4],
  23. id,
  24. chars;
  25.  
  26. while((chars = text[i+noa]) && chars <= '9' && chars >= '0' && noa <= 5)
  27. {
  28. noa++;
  29. printf("Noa++ (%d)",noa);
  30. }
  31. printf("Konec, noa = %d",noa);
  32.  
  33. if(noa == 1) { printf("Noa = 3, cyklus pokračuje dál ..."); continue; }
  34.  
  35. strmid(str,text,i+2,i+noa);
  36. printf("str = %s",str);
  37. id = strval(str);
  38. printf("id = %d",id);
  39.  
  40. if(IsPlayerConnected(id))
  41. {
  42. printf("Hrac je pripojen");
  43. new
  44. name[MAX_PLAYER_NAME];
  45.  
  46. GetPlayerName(id,name,sizeof(name));
  47. printf("Jeho jmeno je %s",name);
  48. strdel(text,i,i+noa+1);
  49. printf("Ořezán kus stringu");
  50. strins(text,name,i,MAX_PLAYER_NAME);
  51. printf("Přidání jeho jméno");
  52. }
  53. else
  54. {
  55. printf("Hrac neni pripojen");
  56. strdel(text,i,i+noa+1);
  57. }
  58.  
  59. }
  60. }
  61. }
  62. SendPlayerMessageToAll(playerid,text);
  63. return 0;
  64. }
Advertisement
Add Comment
Please, Sign In to add comment