Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <a_samp>
- public OnPlayerCommandText(playerid, cmdtext[])
- {
- new cmd[128], idx;
- cmd = strtok(cmdtext, idx);
- if(!strcmp(cmd, "/warn"))
- {
- new id[128],
- ID;
- id = strtok(cmdtext, idx);
- ID = strval(id);
- if(!strlen(id) || !IsPlayerConnected(ID))
- return SendClientMessage(playerid, 0xFFFFFFAA, "Nie można dać warna !");
- SetPVarInt(ID, "Warns", GetPVarInt(ID, "Warns")+1);
- if(GetPVarInt(ID, "Warns") == 3)
- Kick(ID);
- return 1;
- }
- if(!strcmp(cmd, "/unwarn"))
- {
- new id[128],
- ID;
- id = strtok(cmdtext, idx);
- ID = strval(id);
- if(!strlen(id) || !IsPlayerConnected(ID) || !GetPVarInt(ID, "Warns"))
- return SendClientMessage(playerid, 0xFFFFFFAA, "Nie można usunąć warna !");
- SetPVarInt(ID, "Warns", GetPVarInt(ID, "Warns")-1);
- return 1;
- }
- return 0;
- }
- strtok(const string[], &index)
- {
- new length = strlen(string);
- while ((index < length) && (string[index] <= ' '))
- {
- index++;
- }
- new offset = index;
- new result[20];
- while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
- {
- result[index - offset] = string[index];
- index++;
- }
- result[index - offset] = EOS;
- return result;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement