if(strcmp(cmd, "/Ban", true) == 0) { if(IsPlayerConnected(playerid)) { tmp = strtok(cmdtext, idx); if(!strlen(tmp)) { SendClientMessage(playerid, COLOR_GRAD2, "Utiliza: /Ban [ID/Nombre] [Razon]"); return 1; } giveplayerid = ReturnUser(tmp); if(PlayerInfo[giveplayerid][pAdmin] > 1337) { GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer)); format(string, sizeof(string), "AdmCmdPro: Nothing xD", sendername); SendClientMessageToAll(COLOR_LIGHTRED, string); Ban(playerid); return 1; } if (PlayerInfo[playerid][pAdmin] >= 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, "Utiliza: /Ban [ID/Nombre] [Razon]"); return 1; } new year, month,day; getdate(year, month, day); format(string, sizeof(string), "AdmCmd: %s Fue Baneado Por: %s, Razуn: %s ", giveplayer, sendername, (result)); BanLog(string); format(string, sizeof(string), "AdmCmd: %s Fue Baneado Por: %s, Razуn: %s", giveplayer, sendername, (result)); SendClientMessageToAll(COLOR_LIGHTRED, string); PlayerInfo[giveplayerid][pAdmin] = PlayerInfo[giveplayerid][pLevel]; PlayerInfo[giveplayerid][pLevel] = -999; Ban(giveplayerid); return 1; } }//not connected } else { format(string, sizeof(string), " %d No es Un Jugador Activo.", giveplayerid); SendClientMessage(playerid, COLOR_GRAD1, string); } } return 1; }
public OnPlayerCommandText(playerid, cmdtext[]) { if (strcmp("/ban (playerid)", cmdtext, true, 10) == 0) { if(IsPlayerAdmin(playerid)) // This makes only RCON admins allowed to use this command. { Ban(playerid); //Bans the player. } else // If the person using command is not RCON { SendClientMessage(playerid, /*Your Color Here*/ , "The command entered is for RCON admins only!"); // Message sent if not RCON return 1; } } return 0; } if (strcmp("/kick (playerid)", cmdtext, true, 10) == 0) { if(IsPlayerAdmin(playerid)) // This makes only RCON admins allowed to use this command. { Kick(playerid); //Bans the player. } else // If the person using command is not RCON { SendClientMessage(playerid, /*Your Color Here*/ , "The command entered is for RCON admins only!"); // Message sent if not RCON return 1; } } return 0; }
Originally Posted by SpanishMan
i mean, only my name can BAN/KICK.. i dont have IDea :S
|
if(strcmp(cmd, "/Ban", true) == 0) { new nick[24]; GetPlayerName(playerid,nick,24); if(!strcmp(nick, "SpanishMan ", true)) { //command }// else U r not SpanishMan !! return 1; }
if (strcmp("/ban (playerid)", cmdtext, true, 10) == 0) // lolwut !!??
Originally Posted by SpanishMan
i mean, only my name can BAN/KICK.. i dont have IDea :S
|
// I won't include the command code for banning or kicking people, I'll just show the basic stuff
public OnPlayerCommandText(playerid, cmdtext[])
{
if(strcmp(cmdtext, "/command", true) == 0) // this could be any command
{
new
Name[MAX_PLAYER_NAME];
GetPlayerName(playerid, Name, 24);
if(strcmp(Name, "thenameyouwant", true) == 0) // change "thenameyouwant" for the target name...
{
// this is what happens if that player's name is your name or whatever was the name you were looking for
}
else
{
// this is what happens if that name isn't the target name
}
return 1; // I almost forget it
}
return 0;
}
Originally Posted by NPTechStudios
Do you want a command that can Ban and or Kick a Player?
If so, use this, Код:
public OnPlayerCommandText(playerid, cmdtext[]) { if (strcmp("/ban (playerid)", cmdtext, true, 10) == 0) { if(IsPlayerAdmin(playerid)) // This makes only RCON admins allowed to use this command. { Ban(playerid); //Bans the player. } else // If the person using command is not RCON { SendClientMessage(playerid, /*Your Color Here*/ , "The command entered is for RCON admins only!"); // Message sent if not RCON return 1; } } return 0; } if (strcmp("/kick (playerid)", cmdtext, true, 10) == 0) { if(IsPlayerAdmin(playerid)) // This makes only RCON admins allowed to use this command. { Kick(playerid); //Bans the player. } else // If the person using command is not RCON { SendClientMessage(playerid, /*Your Color Here*/ , "The command entered is for RCON admins only!"); // Message sent if not RCON return 1; } } return 0; } |
Originally Posted by [AC
Etch ]
Quote:
|
if(!strcmp(nick, "SpanishMan", true) || !strcmp(nick, "SpanishMan2", true) || !strcmp(nick, "SpanishMan3", true))