Advertisement
Guest User

cmdparam v2

a guest
Oct 16th, 2011
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 0.48 KB | None | 0 0
  1. stock cmdparam(string[]) // version 2
  2. {
  3.     #define MAX_PARAM_LEN 24 // Valid only to parameters it cuts, meaning all except the last one e.g. </pay[24]> <ID[24]> <money[128]>
  4.     new first[MAX_PARAM_LEN] = "-1";
  5.     if(!string[0]) return first;
  6.     new space = strfind(string, " ");
  7.     if(space == -1)
  8.     {
  9.         format(first, MAX_PARAM_LEN, string);
  10.         string[0] = 0;
  11.     }
  12.     else
  13.     {
  14.         strmid(first, string, 0, space, MAX_PARAM_LEN);
  15.         strdel(string, 0, space + 1);
  16.     }
  17.     return first;
  18. }
  19.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement