[HELP!] With /kick and /setlevel CMD please! -
JoelM14 - 23.10.2014
I need help with those commands, i made miself ADMIN from the SERVER FOLDER and well it's done, but the commands [ /setlevel & /kick dont work, it says (you are not an admin)] The ''/kick'' cmd works only with RCON but i have it set for admin lvl 3, idk whats wrong, and the /setlevel wont work not even with RCON. Anyone knoe whats wrong? please help me! :'c
////////////////this is th /kick cmd i have///////////////////
CMD:kick(playerid, params[])
{
if(Informacion[playerid][pAdmin] >= 3) {
new PID; //define the playerid we wanna kick
new reason[64]; //the reason, put into a string
new str[128]; //a new message string
new Playername[MAX_PLAYER_NAME], Adminname[MAX_PLAYER_NAME]; //defines the function with the playername we wanna get
GetPlayerName(playerid, Adminname, sizeof(Adminname)); //defines the function with the adminname we wanna get
GetPlayerName(PID, Playername, sizeof(Playername));
if(sscanf(params, "us[64]", PID,reason)) return SendClientMessage(playerid, COLOR_GREY, "USO: /kick [Jugador] [Razon]"); //tell sscanf if the parameters/the syntax is written wrong to return a message (PID and the reason used here)
if(!IsPlayerConnected(PID)) // if the ID is wrong or not connected, return a message! (PID used here)
return SendClientMessage(playerid, COLOR_GREY, "Ese jugador no esta conectado!");
format(str, sizeof(str), "'%s' Ha sido kickeado por el administrador '%s'. Razon: %s ", Playername, Adminname, reason); //format the string we've defined to send the message, playername and adminname are used to receive the information about the names
SendClientMessageToAll(COLOR_RED, str); //send that message to all
Kick(PID); //kick the playerid we've defined
}
else //if he has not got the permissions
{
SendClientMessage(playerid, COLOR_GREY, "You have to be level 3 to use that command!"); //return this message
}
return 1;
}
///////////////And this is the /setlevel CMD i have/////////////////
COMMAND: setlevel(playerid,params[])
{
new id,level;
if(IsPlayerAdmin(playerid))
{
if(sscanf(params,"ud",id,level)) return SendClientMessage(playerid,COLOR_RED,"[USO]: /setlevel [playerid/name] [level]");
else
{
if(level > 9) return SendClientMessage(playerid, COLOR_RED,"solo de 1-10!");
else
{
new string[64], pName[MAX_PLAYER_NAME];
GetPlayerName(playerid,pName,MAX_PLAYER_NAME);
format(string,sizeof string,"RCON Administrator promoted %s to administrator!",pName);
SendClientMessageToAll(COLOR_GREEN,string);
}
}
}
else
{
return 1;
}
return 1;
}
Respuesta: [HELP!] With /kick and /setlevel CMD please! -
!R1Ch@rD! - 24.10.2014
I work well?
pawn Код:
CMD:kick(playerid, params[])
{
new id, reason[148];
if(Informacion[playerid][pAdmin] < 3) return SendClientMessage(playerid, COLOR_GREY, "You have to be level 3 to use that command!");
if(sscanf(params, "us[128]", id,reason)) return SendClientMessage(playerid, COLOR_GREY, "USO: /kick [Jugador] [Razon]");
if(!IsPlayerConnected(id)) return SendClientMessage(playerid, COLOR_GREY, "Ese jugador no esta conectado!");
format(str, sizeof(str), "'%s' Ha sido kickeado por el administrador '%s'. Razon: %s ", pName(id), pName(playerid), reason);
SendClientMessageToAll(COLOR_RED, str);
Kick(id);
return 1;
}
pawn Код:
CMD:setlevel(playerid,params[])
{
new id,level,string[64];
if(Informacion[playerid][pAdmin] < 3 && IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You have to be level 3 to use that command!");
if(sscanf(params,"ud",id,level)) return SendClientMessage(playerid,COLOR_RED,"[USO]: /setlevel [playerid/name] [level]");
if(level > 10) return SendClientMessage(playerid, COLOR_RED,"solo de 1-10!");
format(string,sizeof string,"RCON Administrator promoted %s to administrator!",pName(id));
SendClientMessageToAll(COLOR_GREEN,string);
return 1;
}
define pName
pawn Код:
stock pName(playerid)
{
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
return name;
}