- 0
Problema KICK/BAN
-
Similar Content
-
Recently Browsing 0 members
- No registered users viewing this page.
We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more details you can also review our Terms of Use and Privacy Policy.
Question
d@rK
La comenzile Kick/Ban cand ii dau sa zicem ban unui player, apare la tot serveru ca i-am dat ban, DAR celui caruia i-am dat ban Nu ii Arata, ii Arata doar "Server Closed Connection". As vrea sa ii apara si playerului care a luat ban...
Pawno(in GM):
1.Kick
[pawn]if(strcmp(cmd, "/kick", true) == 0)
{
if(IsPlayerConnected(playerid))
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /kick [playerid/PartOfName] [reason]");
return 1;
}
giveplayerid = ReturnUser(tmp);
if (PlayerInfo[playerid][pAdmin] >= 1 || PlayerInfo[playerid][pAgent] >= 1)
{
if(IsPlayerConnected(giveplayerid))
{
if(giveplayerid != INVALID_PLAYER_ID)
{
GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
GetPlayerName(playerid, sendername, sizeof(sendername));
new length = strlen(cmdtext);
while ((idx < length) && (cmdtext[idx] <= ' '))
{
idx++;
}
new offset = idx;
new result[64];
while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
{
result[idx - offset] = cmdtext[idx];
idx++;
}
result[idx - offset] = EOS;
if(!strlen(result))
{
SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /kick [playerid/PartOfName] [reason]");
return 1;
}
if(kicktime[playerid] == 1) return SendClientMessage(playerid, COLOR_GRAD2, "Wait 10 seconds!");
new year, month,day;
getdate(year, month, day);
format(string, sizeof(string), "AdmCmd: %s a primit kick de la Adminul %s. Motiv: %s (%d-%d-%d)", giveplayer, sendername, (result),month,day,year);
KickLog(string);
format(string, sizeof(string), "SERVER: {FF0000}%s {00FF00}a primit kick de la Adminul {FF0000}%s. {00FF00}Motiv: {FF00D9}%s", giveplayer, sendername, (result));
SendClientMessageToAll(COLOR_CAPONE, string);
format(string, sizeof(string), "Ai primit kick de la Adminul %s. Motiv: %s",sendername,(result));
SendClientMessage(giveplayerid, COLOR_RED, string);
kicktime[playerid] = 1;
SetTimerEx("kickt", 10000, 0, "%d", playerid);
Kick(giveplayerid);
return 1;
}
}
}
else
{
format(string, sizeof(string), "%d is not an active player.", giveplayerid);
SendClientMessage(playerid, COLOR_GRAD1, string);
}
}
return 1;
}[/pawn]
2. Ban
[pawn]if(strcmp(cmd, "/ban", true) == 0)
{
if(IsPlayerConnected(playerid))
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /ban [playerid/PartOfName] [reason]");
return 1;
}
giveplayerid = ReturnUser(tmp);
if (PlayerInfo[playerid][pAdmin] >= 5)
{
if(IsPlayerConnected(giveplayerid))
{
if(giveplayerid != INVALID_PLAYER_ID)
{
GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
GetPlayerName(playerid, sendername, sizeof(sendername));
new length = strlen(cmdtext);
while ((idx < length) && (cmdtext[idx] <= ' '))
{
idx++;
}
new offset = idx;
new result[64];
while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
{
result[idx - offset] = cmdtext[idx];
idx++;
}
result[idx - offset] = EOS;
if(!strlen(result))
{
SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /ban [playerid/PartOfName] [reason]");
return 1;
}
if(bantime[playerid] == 1) return SendClientMessage(playerid, COLOR_GRAD2, "Are you trying to ban this server?");
new year, month,day;
getdate(year, month, day);
format(string, sizeof(string), "AdmCmd: %s a fost banat de catre Adminul %s. Motiv: %s (%d-%d-%d)", giveplayer, sendername, (result),month,day,year);
BanLog(string);
format(string, sizeof(string), "SERVER: {FF0000}%s {00FF00}a fost banat de catre Adminul {FF0000}%s. {00FF00}Motiv: {FF00D9}%s", giveplayer, sendername, (result));
SendClientMessageToAll(COLOR_CAPONE, string);
new playersip[256];
GetPlayerIp(giveplayerid,playersip, sizeof(playersip));
SendClientMessage(giveplayerid,COLOR_GREEN,"|___________[bAN INFO]___________|");
format(string, sizeof(string), "Numele tau este: %s.",giveplayer);
SendClientMessage(giveplayerid, COLOR_RED, string);
format(string, sizeof(string), "IP-ul tau este: %s.",playersip);
SendClientMessage(giveplayerid, COLOR_RED, string);
format(string, sizeof(string), "Ai fost banat de: %s.",sendername);
SendClientMessage(giveplayerid, COLOR_RED, string);
format(string, sizeof(string), "Motiv: %s.",(result));
SendClientMessage(giveplayerid, COLOR_RED, string);
format(string, sizeof(string), "Data: %d/%d/%d",day,month,year);
SendClientMessage(giveplayerid, COLOR_RED, string);
SendClientMessage(giveplayerid,COLOR_GREEN,"|___________[bAN INFO]___________|");
bantime[playerid] = 1;
SetTimerEx("bant", 10000, 0, "%d", playerid);
Ban(giveplayerid);
return 1;
}
}
}
else
{
format(string, sizeof(string), "%d is not an active player.", giveplayerid);
SendClientMessage(playerid, COLOR_GRAD1, string);
}
}
return 1;
}[/pawn]
7 answers to this question
Recommended Posts