16.04.2013, 13:21
how can I make like this so I cant kick the player "DarkNighter" ??
public OnPlayerConnect(playerid)
{
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid,name,sizeof(name));
if(!strcmp(name,"DarkNighter",true))
{
Kick(playerid);
}
return 1;
}
if(strcmp(cmd, "/kick", true) == 0) { if(IsPlayerConnected(playerid)) { tmp = strtok(cmdtext, idx); if(!strlen(tmp)) { SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /kick [playerid/PartOfName] [motiv]"); return 1; } giveplayerid = ReturnUser(tmp); if (PlayerInfo[playerid][pAdmin] >= 1 || PlayerInfo[playerid][pGm] >= 3) { 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] [motiv]"); return 1; } if(giveplayerid == playerid) { SendClientMessage(playerid, COLOR_RED,"AdmCmd: Nu iti poti da kick singur."); return 1; } new year, month,day; getdate(year, month, day); new Hour, Min, Sec; gettime(Hour, Min, Sec); new targetlevel = PlayerInfo[giveplayerid][pAdmin]; new playerlevel = PlayerInfo[playerid][pAdmin]; if(targetlevel > playerlevel) return SendClientMessage(playerid, COLOR_GREY, "* Are functie mai mare decat tine !"); format(string, sizeof(string), "AdmCmd: %s a primit kick de la %s, Motiv: %s!",giveplayer, sendername,(result)); SendClientMessageToAll(COLOR_RED, string); format(string, sizeof(string), "AdmCmd: %s a primit kick pe data de : | %d/%d/%d | ora | %02d:%02d:%02d | ",giveplayer,day,month,year,Hour, Min, Sec); SendClientMessageToAll(COLOR_RED, string); new y, m, d; new h,mi,s; getdate(y,m,d); gettime(h,mi,s); format(string, sizeof(string), "[%d/%d/%d](%d:%d:%d) AdmCmd: %s a primit kick de la %s, Motiv: %s!",d,m,y,h,mi,s,giveplayer, sendername,(result)); KickLog(string); Kick(giveplayerid); return 1; } } } else { format(string, sizeof(string), " %d is not an active player.", giveplayerid); SendClientMessage(playerid, COLOR_GRAD1, string); } } return 1; } |
if(strcmp(cmd, "/kick", true) == 0)
{
if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, 0xFF0000, "* Only Admins can use this comamnd!");
{
if(IsPlayerConnected(playerid))
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /kick [playerid/PartOfName] [motiv]");
return 1;
}
giveplayerid = ReturnUser(tmp);
if (PlayerInfo[playerid][pAdmin] >= 1 || PlayerInfo[playerid][pGm] >= 3)
{
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] [motiv]");
return 1;
}
if(giveplayerid == playerid)
{
SendClientMessage(playerid, COLOR_RED,"AdmCmd: Nu iti poti da kick singur.");
return 1;
}
new year, month,day;
getdate(year, month, day);
new Hour, Min, Sec;
gettime(Hour, Min, Sec);
new targetlevel = PlayerInfo[giveplayerid][pAdmin];
new playerlevel = PlayerInfo[playerid][pAdmin];
if(targetlevel > playerlevel) return SendClientMessage(playerid, COLOR_GREY, "* Are functie mai mare decat tine !");
format(string, sizeof(string), "AdmCmd: %s a primit kick de la %s, Motiv: %s!",giveplayer, sendername,(result));
SendClientMessageToAll(COLOR_RED, string);
format(string, sizeof(string), "AdmCmd: %s a primit kick pe data de : | %d/%d/%d | ora | %02d:%02d:%02d | ",giveplayer,day,month,year,Hour, Min, Sec);
SendClientMessageToAll(COLOR_RED, string);
new y, m, d;
new h,mi,s;
getdate(y,m,d);
gettime(h,mi,s);
format(string, sizeof(string), "[%d/%d/%d](%d:%d:%d) AdmCmd: %s a primit kick de la %s, Motiv: %s!",d,m,y,h,mi,s,giveplayer, sendername,(result));
KickLog(string);
Kick(giveplayerid);
return 1;
}
}
}
else
{
format(string, sizeof(string), " %d is not an active player.", giveplayerid);
SendClientMessage(playerid, COLOR_GRAD1, string);
}
}
return 1;
}