Guest User

Untitled

a guest
Jan 22nd, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 1.77 KB | None | 0 0
  1. stoc
  2. new count;
  3.  
  4. new bool:founded = false;
  5. for(new i; i < len;i++){
  6. if(string[i] == '%'){
  7. new str[128];
  8. found++;
  9. switch(string[i+1]){
  10. case 'd','D':{
  11. format(str,sizeof(str),"%d", getarg(found));
  12. strins(globalstr, str, count,strlen(str));
  13. count += strlen(str);
  14. founded = true;
  15. }
  16. case 'f','F':{
  17. format(str,sizeof(str),"%0.3f",getarg(found));
  18. strins(globalstr, str, count,strlen(str));
  19. count += strlen(str);
  20. founded = true;
  21. }
  22. case 's','S':{
  23. for(new b; getarg(found, b) != 0;b++) str[b] = getarg(found,b);
  24. strins(globalstr, str, count,strlen(str));
  25. count += strlen(str);
  26. founded = true;
  27. }
  28. default:{
  29. globalstr[count] = string[i];
  30. count++;
  31. founded = false;
  32. found--;
  33. }
  34. }
  35. }else{
  36. if(!founded){
  37. globalstr[count] = string[i];
  38. count++;
  39. }else founded = false;
  40. }
  41. }
  42. SendClientMessage(playerid,color,globalstr);
  43. return true;
  44. }
  45.  
  46. stock SCMFTA(color,string[],{ Float, _ }: ...){
  47. new len = strlen(string)+1;
  48. new globalstr[256];
  49. new found = 1;
  50. new count;
  51.  
  52. new bool:founded = false;
  53. for(new i; i < len;i++){
  54. if(string[i] == '%'){
  55. new str[128];
  56. found++;
  57. switch(string[i+1]){
  58. case 'd','D':{
  59. format(str,sizeof(str),"%d", getarg(found));
  60. strins(globalstr, str, count,strlen(str));
  61. count += strlen(str);
  62. founded = true;
  63. }
  64. case 'f','F':{
  65. format(str,sizeof(str),"%0.3f",getarg(found));
  66. strins(globalstr, str, count,strlen(str));
  67. count += strlen(str);
  68. founded = true;
  69. }
  70. case 's','S':{
  71. for(new b; getarg(found, b) != 0;b++) str[b] = getarg(found,b);
  72. strins(globalstr, str, count,strlen(str));
  73. count += strlen(str);
  74. founded = true;
  75. }
  76. default:{
  77. globalstr[count] = string[i];
  78. count++;
  79. founded = false;
  80. found--;
  81. }
  82. }
  83. }else{
  84. if(!founded){
  85. globalstr[count] = string[i];
  86. count++;
  87. }else founded = false;
  88. }
  89. }
  90. SendClientMessageToAll(color,globalstr);
  91. return true;
  92. }
Add Comment
Please, Sign In to add comment