Needing a /kick [id] [reason] Command? -
Kyle - 24.08.2009
Hello, I can do a standered /kick [id] command but i cant do like a reason one and i was wondering if you could help me.
Cheers
Re: Needing a /kick [id] [reason] Command? -
krisko - 24.08.2009
i think this should help
delete i dident read thath you dont whantd dcmd
Re: Needing a /kick [id] [reason] Command? -
Ironboy500 - 24.08.2009
I think he said no in DCMD.
Re: Needing a /kick [id] [reason] Command? -
Weirdosport - 24.08.2009
Saying you don't want it as DCMD is a bit like saying I don't want it to be any good.
The command handler is irrelevant here, it's SSCANF you need, and it goes perfectly with DCMD, so being ignorant towards DCMD will only hinder you.
Re: Needing a /kick [id] [reason] Command? -
Kyle - 24.08.2009
If it has to be DCMD then so be it,
I Also need the DCMD function things like caus i have NO DCMD commands or anything to do with it al all
Re: Needing a /kick [id] [reason] Command? -
borisblat - 24.08.2009
here is mine..:
if(strcmp(cmd, "/Kick", true) == 0) // KICK
{
if(PlayerInfo[playerid][Admin] < 3) return DenyMessage(playerid, 3);
tmp = strtok(cmdtext, idx);
new otherplayer = strval(tmp);
if(!IsPlayerConnected(otherplayer)) return SendClientMessage(playerid, WHITEBLUE, "Invalid Player ID.");
new file[256];
new name[MAX_PLAYER_NAME], opname[MAX_PLAYER_NAME];
new string[256];
GetPlayerName(playerid, name, sizeof name);
GetPlayerName(otherplayer, opname, sizeof opname);
if(PlayerInfo[playerid][Admin] < PlayerInfo[otherplayer][Admin]) return SCM(playerid, RED, ".аъд ма йлем мдщъощ бфчегд же тм шод йеъш вебдд ощмк");
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(tmp)) return SCM(playerid, WHITE, "/Kick [playerid] [Reason]");
if(!strlen(result))
{
for (new i = 0; i < MAX_PLAYERS; i++)
{
format(string,sizeof(string),".[%s :сйбд] [ID: %d | %s] дтйу аъ дщзчп %s дагойп", name, otherplayer, opname, name);
SCM(i, RED, string);
}
}
else
{
for (new i = 0; i < MAX_PLAYERS; i++)
{
format(string,sizeof(string),".[%s :сйбд] [ID: %d | %s] дтйу аъ дщзчп %s дагойп", result, otherplayer, opname, name);
SCM(i, RED, string);
}
}
Kick(otherplayer);
new year, month, day;
getdate(year,month,day);
format(file, sizeof(file), "DAR/Users/Kicks/%s.txt", opname);
if(dini_Exists(file))
{
dini_Set(file, "AdminName", name);
dini_Set(file, "KickedName", opname);
dini_Set(file, "reason", result);
dini_IntSet(file, "day", day);
dini_IntSet(file, "month", month);
dini_IntSet(file, "year", year);
}
else
{
dini_Create(file);
dini_Set(file, "AdminName", name);
dini_Set(file, "KickedName", opname);
dini_Set(file, "reason", result);
dini_IntSet(file, "day", day);
dini_IntSet(file, "month", month);
dini_IntSet(file, "year", year);
}
DisconnectReason[otherplayer] = 1;
return 1;
}
Re: Needing a /kick [id] [reason] Command? -
Kyle - 25.08.2009
Anyonee?
Re: Needing a /kick [id] [reason] Command? -
Correlli - 25.08.2009
Quote:
Originally Posted by KyleSmith
Anyonee?
|
Script request topic.
Re: Needing a /kick [id] [reason] Command? -
[LSB]Clinz - 25.08.2009
Код:
if(strcmp(cmd,"/kick",true) == 0)
{
new tmp[256];
tmp = strtok(cmdtext,idx);
if(!strlen(tmp))
{
SendClientMessage(playerid,WHITE,"USAGE: /kick [ID]");
return 1;
}
new reciever = strval(tmp);
if(UserData[playerid][AdminLevel] < 1) return SendClientMessage(playerid,RED," You aren't an admin level 1!");
if(reciever == playerid) return SendClientMessage(playerid,RED," Don't try to ban yourself!");
if(UserData[reciever][AdminLevel] > 1) return SendClientMessage(playerid,RED," You can't kick another admin!");
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;
new string[256],bname[MAX_PLAYER_NAME],aname[MAX_PLAYER_NAME];
GetPlayerName(reciever,bname,sizeof(bname));
GetPlayerName(playerid,aname,sizeof(aname));
format(string,sizeof(string)," Admin %s kicked %s - Reason: %s",aname,bname,result);
SendClientMessageToAll(RED,string);
Kick(reciever);
return 1;
}
Just change the stuff to suit your gamemode. Also, I've tested this on my server, it works.
Re: Needing a /kick [id] [reason] Command? -
Kyle - 25.08.2009
Ive tested it but when i type ANY command it says i aint admin plus trhen wen i login to admin if i type /commands it bans me :S for ANY command on my server