20.12.2013, 18:50
Hi guys! I have problem, I got /ban and /kick on my script, Im server owner and If I write /ban or /kick then I got message /kick: You are not admin. /ban: You are not admin.
How I can fix that?
PM! Some things is Translated to My language
Here is /ban:
Here is /kick:
How I can fix that?
PM! Some things is Translated to My language
Here is /ban:
PHP код:
if(strcmp(cmd, "/ban", true) == 0)
{
if(IsPlayerConnected(playerid))
{
new playersip[64];
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, "KASUTUS: /ban [playerid/PartOfName] <reason>");
return 1;
}
giveplayerid = ReturnUser(tmp);
new string3[256];
if (PlayerInfo[playerid][pAdmin] >= 3 || IsPlayerAdmin(playerid))
{
if(IsPlayerConnected(giveplayerid))
{
if(giveplayerid != INVALID_PLAYER_ID)
{
GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
GetPlayerIp(giveplayerid,playersip,sizeof(playersip));
new length = strlen(cmdtext);
while ((idx < length) && (cmdtext[idx] <= ' '))
{
idx++;
}
new offset = idx;
new result[128];
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, "KASUTUS: /ban [playerid/PartOfName] [reason]");
return 1;
}
if(giveplayerid != playerid && Untouchable[giveplayerid]) return SendClientMessage(playerid, COLOR_GREY, " Nice try dude...");
new targetlevel = PlayerInfo[giveplayerid][pAdmin];
new playerlevel = PlayerInfo[playerid][pAdmin];
if(targetlevel > playerlevel) return SendClientMessage(playerid, COLOR_GREY, "[Totaalne-AC] - You can't use this command on that person!");
new y, m, d;
new h,mi,s;
getdate(y,m,d);
gettime(h,mi,s);
format(string3,sizeof(string3), "(%d/%d/%d)[%d:%d:%d] %s Has been banned by %s for: %s",d,m,y,h,mi,s,giveplayer,sendername, (result));
BanLog(string3);
format(string3,sizeof(string3), "(%d/%d/%d)[%d:%d:%d] Banned by %s - Reason: %s",d,m,y,h,mi,s,sendername,(result));
AddPunishment(giveplayerid, string3);
format(string3, sizeof(string3), "%s (%d), Has been Banned by Administrator %s for %s", giveplayer, giveplayerid, sendername, (result));
SendClientMessageToAll(COLOR_NICERED, string3);
format(string3, sizeof(string3), "[ADMIN]: %s Has Been Added to the Ban list by %s", playersip, sendername);
SendAdminMessage(COLOR_WHITE, string3);
format(string3, sizeof(string3), "You have Been Banned by Administrator %s for %s", sendername, (result));
SendClientMessage(giveplayerid,COLOR_NICERED, string3);
SendClientMessage(giveplayerid,COLOR_BLUE, "If You Feel that This has Been an Error, Report the Admin to www.totalroleplay.zxq.net/index.php");
SendClientMessage(giveplayerid,COLOR_BLUE, "To Get Unbanned Post an Unban Request at Our Forums www.totalroleplay.zxq.net/index.php");
SendClientMessage(giveplayerid,COLOR_LIGHTRED, "Don't Evade, Otherwise you wont get unbanned");
SafeSetPlayerPos(giveplayerid,264.6288,77.5742,1001.0391);
SafeSetPlayerInterior(giveplayerid, 6);
PlayerInfo[giveplayerid][pJailTime] = 300;
PlayerInfo[giveplayerid][pJailed] = 1;
PlayerInfo[giveplayerid][pBanned] = 1;
format(string3, sizeof(string3), "~r~~h~Admin Ban: ~n~~r~%s",(result));
GameTextForPlayer(giveplayerid, string3, 6000, 3);
PlayerInfo[giveplayerid][pPending] = 0;
//ScriptBan(giveplayerid,playerid,result);
BanEx(giveplayerid/*,playerid*/,result);
return 1;
}
}//not connected
}
else
{
format(string, sizeof(string), " %d is not an active player.", giveplayerid);
SendClientMessage(playerid, COLOR_ORANGE, string);
}
}
return 1;
}
PHP код:
if(strcmp(cmd, "/kick", true) == 0)
{
if(IsPlayerConnected(playerid))
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, "KASUTUS: /kick [playerid/PartOfName] <reason>");
return 1;
}
giveplayerid = ReturnUser(tmp);
if(giveplayerid != playerid && Untouchable[giveplayerid]) return SendClientMessage(playerid, COLOR_GREY, "* Sa ei saa seda selle mдngijaga teha!");
new targetlevel = PlayerInfo[giveplayerid][pAdmin];
new playerlevel = PlayerInfo[playerid][pAdmin];
if(targetlevel > playerlevel) return SendClientMessage(playerid, COLOR_GREY, "* You can not Kick People that is higher Than You!");
if (PlayerInfo[playerid][pAdmin] >= 1 || IsPlayerAdmin(playerid))
{
if(IsPlayerConnected(giveplayerid))
{
if(giveplayerid != INVALID_PLAYER_ID)
{
GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
new length = strlen(cmdtext);
while ((idx < length) && (cmdtext[idx] <= ' '))
{
idx++;
}
new offset = idx;
new result[128];
while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
{
result[idx - offset] = cmdtext[idx];
idx++;
}
result[idx - offset] = EOS;
if(!strlen(result))
{
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] %s Has been kicked by %s, No Reason Given",d,m,y,h,mi,s,giveplayer,sendername);
KickLog(string);
format(string,sizeof(string), "(%d/%d/%d)[%d:%d:%d] Kicked by %s - No Reason Given.",d,m,y,h,mi,s,sendername);
AddPunishment(giveplayerid, string);
format(string, sizeof(string), "%s (%d), Has been kicked by Administrator %s, No Reason Given", giveplayer, giveplayerid, sendername);
SendClientMessageToAll(COLOR_NICERED, string);
format(string, sizeof(string), "You have Been Kicked by Administrator %s, No Reason Given", sendername);
SendClientMessage(giveplayerid,COLOR_LIGHTBLUE, string);
SafeSetPlayerPos(giveplayerid,1601.8762,-1671.9099,-40.5941);
SafeSetPlayerInterior(giveplayerid, 0);
GameTextForPlayer(giveplayerid, "~r~~h~Admin Kicked: ~n~~r~No Reason Given", 6000, 3);
SetTimerEx("KickOut",500,false,"i",giveplayerid);
return 1;
}
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] %s Has been kicked by %s for: %s",d,m,y,h,mi,s,giveplayer,sendername, (result));
KickLog(string);
format(string,sizeof(string), "(%d/%d/%d)[%d:%d:%d] Kicked by %s - Reason: %s",d,m,y,h,mi,s,sendername,(result));
AddPunishment(giveplayerid, string);
format(string, sizeof(string), "%s (%d), Has been kicked by Administrator %s for: %s", giveplayer, giveplayerid, sendername, (result));
SendClientMessageToAll(COLOR_NICERED, string);
format(string, sizeof(string), "You have Been Kicked by Administrator %s for: %s", sendername, (result));
SendClientMessage(giveplayerid,COLOR_LIGHTBLUE, string);
SafeSetPlayerPos(giveplayerid,1601.8762,-1671.9099,-40.5941);
SafeSetPlayerInterior(giveplayerid, 0);
format(string, sizeof(string), "~r~~h~Admin Kicked: ~n~~r~%s",(result));
GameTextForPlayer(giveplayerid, string, 6000, 3);
SetTimerEx("KickOut",500,false,"i",giveplayerid);
return 1;
}
}
}
else
{
format(string, sizeof(string), "** %d is not an active player.", giveplayerid);
SendClientMessage(playerid, COLOR_GRAD1, string);
}
}
return 1;
}