SHARE
TWEET

Untitled

a guest Jun 26th, 2017 102 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <a_samp>
  2.  
  3. public OnPlayerCommandText(playerid, cmdtext[])
  4. {
  5.     new cmd[128], idx;
  6.     cmd = strtok(cmdtext, idx);
  7.  
  8.     if(!strcmp(cmd, "/warn"))
  9.     {
  10.         new id[128],
  11.             ID;
  12.  
  13.         id = strtok(cmdtext, idx);
  14.         ID = strval(id);
  15.  
  16.         if(!strlen(id) || !IsPlayerConnected(ID))
  17.             return SendClientMessage(playerid, 0xFFFFFFAA, "Nie można dać warna !");
  18.  
  19.         SetPVarInt(ID, "Warns", GetPVarInt(ID, "Warns")+1);
  20.  
  21.         if(GetPVarInt(ID, "Warns") == 3)
  22.             Kick(ID);
  23.  
  24.         return 1;
  25.     }
  26.  
  27.     if(!strcmp(cmd, "/unwarn"))
  28.     {
  29.         new id[128],
  30.             ID;
  31.  
  32.         id = strtok(cmdtext, idx);
  33.         ID = strval(id);
  34.  
  35.         if(!strlen(id) || !IsPlayerConnected(ID) || !GetPVarInt(ID, "Warns"))
  36.             return SendClientMessage(playerid, 0xFFFFFFAA, "Nie można usunąć warna !");
  37.  
  38.         SetPVarInt(ID, "Warns", GetPVarInt(ID, "Warns")-1);
  39.         return 1;
  40.     }
  41.     return 0;
  42. }
  43.  
  44. strtok(const string[], &index)
  45. {
  46.     new length = strlen(string);
  47.     while ((index < length) && (string[index] <= ' '))
  48.     {
  49.         index++;
  50.     }
  51.  
  52.     new offset = index;
  53.     new result[20];
  54.     while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
  55.     {
  56.         result[index - offset] = string[index];
  57.         index++;
  58.     }
  59.     result[index - offset] = EOS;
  60.     return result;
  61. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top