02.07.2016, 14:39
paste below OnPlayerCommandText
Код:
if(strcmp(cmdtext, "/tmute", true) == 0) { if(IsPlayerConnected(playerid)) { tmp = strtok(cmdtext, idx); if(!strlen(tmp)) { SendClientMessage(playerid, COLOR_WHITE, "Използвай: /tmute [playerid/PartOfName] [time][Reason]"); return 1; } new playa; playa = ReturnUser(tmp); tmp = strtok(cmdtext, idx); new time = strval(tmp); if (PlayerInfo[playerid][pAdmin] >= 2) { if(IsPlayerConnected(playa)) { if(PlayerInfo[playa][pAdmin] > PlayerInfo[playerid][pAdmin]) { SendClientMessage(playerid, COLOR_GREY, "Не можеш да заглушиш по висок админ левел!"); return 1; } new length = strlen(cmdtext); while ((idx < length) && (cmdtext[idx] <= ' ')) { idx++; } new offset = idx; new result[256]; while ((idx < length) && ((idx - offset) < (sizeof(result) - 1))) { result[idx - offset] = cmdtext[idx]; idx++; } result[idx - offset] = EOS; if(!strlen(result)) { } if(playa != INVALID_PLAYER_ID) { PlayerInfo[playa][ptMuted] = time*60; PlayerInfo[playa][pMuted] = 1; } if(playa != INVALID_PLAYER_ID) { PlayerInfo[playa][ptMuted] = time*60; PlayerInfo[playa][pMuted] = 1; format(string, sizeof(string), "ADMIN:%s беше заглушен от администратор %s за %d минути.[Причина: %s]",PlayerName(playa), PlayerName(playerid), time, (result)); SendClientMessageToAll(COLOR_RED,string); } } } else { SendClientMessage(playerid, COLOR_GRAD1, " Нямаш права за да ползваш командата!"); } } return 1; }