05.03.2013, 16:10
Entгo pessoal, queria fazer um pedido para que esses comandos abaixos funcionassem apenas com o nome, e nгo com o ID. O nome pode ser todo em minusculo, caps lock, contanto que seja o nome da pessoa.
Obrigado a quem me ajudar.
Obrigado a quem me ajudar.
pawn Код:
COMMAND:ban(playerid, params[])
{
new PlayerBTan, Days, Hours, Reason[128], TotalBanTime, Msg[128], Name[24], AdminName[24];
SendAdminText(playerid, "/ban", params);
if (APlayerData[playerid][LoggedIn] == true)
{
if (APlayerData[playerid][PlayerLevel] >= 3)
{
if (sscanf(params, "uiis[128]", PlayerBTan, Days, Hours, Reason))
SendClientMessage(playerid, 0xFF0000AA, "Use: /ban [id] [dias] [horas] [motivo]");
else
{
if (IsPlayerConnected(PlayerBTan))
{
GetPlayerName(playerid, AdminName, sizeof(AdminName));
GetPlayerName(PlayerBTan, Name, sizeof(Name));
APlayerData[PlayerBTan][Bans]++;
TotalBanTime = (Days * 86400) + (Hours * 3600) + gettime();
if (APlayerData[PlayerBTan][Bans] == 5)
APlayerData[PlayerBTan][BanTime] = 2147483640;
else
APlayerData[PlayerBTan][BanTime] = TotalBanTime;
if (APlayerData[PlayerBTan][Bans] == 5)
{
format(Msg, 128, "[ Thunder Truck ]: Vocк foi banido permanentemente por %s, pois ja й o seu 5° banimento.", AdminName);
SendClientMessage(PlayerBTan, 0x808080FF, Msg);
}
else
{
format(Msg, 128, "[ Thunder Truck ]: Vocк foi banido por %s por %i dias e %i horas.", AdminName, Days, Hours);
SendClientMessage(PlayerBTan, 0x808080FF, Msg);
format(Msg, 128, "Reason: %s", Reason);
SendClientMessage(PlayerBTan, 0x808080FF, Msg);
format(Msg, 128, "[ Thunder Truck ]: Vocк jб foi banido %i vezes, a 5° serб permanente.", APlayerData[PlayerBTan][Bans]);
SendClientMessage(PlayerBTan, 0x808080FF, Msg);
}
Kick(PlayerBTan);
format(Msg, 128, "{FF0000}-| O administrador %s %s baniu %s por %i dias e %i horas |-", AdminLevelName[APlayerData[playerid][PlayerLevel]], AdminName, Name, Days, Hours);
SendClientMessageToAll(0x808080FF, Msg);
}
}
}
else
return 0;
}
else
return 0;
return 1;
}
pawn Код:
COMMAND:kick(playerid, params[])
{
new PlayerToKick, Reason[128], ReasonMsg[128], Name[24], AdminName[24];
SendAdminText(playerid, "/kick", params);
if (APlayerData[playerid][LoggedIn] == true)
{
if (APlayerData[playerid][PlayerLevel] >= 1)
{
if (sscanf(params, "us[128]", PlayerToKick, Reason)) SendClientMessage(playerid, 0xFF0000AA, "Use: /kick [id] [motivo]");
else
if (IsPlayerConnected(PlayerToKick))
{
GetPlayerName(playerid, AdminName, sizeof(AdminName));
GetPlayerName(PlayerToKick, Name, sizeof(Name));
format(ReasonMsg, 128, "{FF0000}-| %s foi kickado pelo administrador %s. Motivo: %s |-", Name, AdminName, Reason);
SendClientMessageToAll(0xFF0000FF, ReasonMsg);
Kick(PlayerToKick);
}
else
SendClientMessage(playerid, 0xFF0000FF, "[ Thunder Truck ]: Esse jogador nгo estб online.");
}
else
return 0;
}
else
return 0;
return 1;
}
pawn Код:
COMMAND:banip(playerid, params[])
{
// Setup local variables
new PlayerBTan, Reason[128], Msg[128], Name[24], AdminName[24];
// Send the command to all admins so they can see it
SendAdminText(playerid, "/banip", params);
// Check if the player has logged in
if (APlayerData[playerid][LoggedIn] == true)
{
// Check if the player's admin-level is at least 3
if (APlayerData[playerid][PlayerLevel] >= 3)
{
if (sscanf(params, "us[128]", PlayerBTan, Reason))
SendClientMessage(playerid, 0xFF0000AA, "Use: /banip [id] [motivo]");
else
{
if (IsPlayerConnected(PlayerBTan))
{
// Get the names of the player and the admin who executed the ban
GetPlayerName(playerid, AdminName, sizeof(AdminName));
GetPlayerName(PlayerBTan, Name, sizeof(Name));
// Inform the player about his ban
format(Msg, 128, "{FF0000}[ Thunder Truck ]: Vocк teve o IP banido permanentemente por {FFFF00}%s", AdminName);
SendClientMessage(PlayerBTan, 0xFFFFFFFF, Msg);
format(Msg, 128, "{FF0000}Motivo: {FFFF00}%s", Reason);
SendClientMessage(PlayerBTan, 0xFFFFFFFF, Msg);
// Ban the player with a reason
BanEx(PlayerBTan, Reason);
// Inform everybody else which player was ip-banned
format(Msg, 128, "{808080}[ Thunder Truck ]: %s %s Baniu o ip de {FFFF00}%s", AdminLevelName[APlayerData[playerid][PlayerLevel]], AdminName, Name);
SendClientMessageToAll(0xFFFFFFFF, Msg);
}
}
}
else
return 0;
}
else
return 0;
return 1;
}