Posts: 166
Threads: 39
Joined: May 2016
Reputation:
0
can someone teach me how to make a ban command? with ZCMD please.
Posts: 1,939
Threads: 11
Joined: Oct 2015
Reputation:
0
No one taught anyone here most of them learned by themselves. Like that you should also try. This isn't a herculean task.
Posts: 1,147
Threads: 109
Joined: Jul 2013
Reputation:
0
This section is to help you with the code you've scripted yourself. I'd suggest you to learn the basics first. Read/Watch tutorials, that's how you can learn.
Posts: 775
Threads: 78
Joined: Dec 2014
PHP код:
// Open a command ofc
CMD:ban(playerid, params[]) { // Notice the "params[]", they're needed.
if(IsPlayerAdmin(playerid)) { // check if player is rcon
new targetid; // empty int
if(sscanf(params, "i", targetid)) { // check if the input was like /ban 0
Ban(playerid); // ban him using the samp func
}
else
SendClientMessage(playerid, -1, "SYNTAX: /ban playerid");
}
return 1;
}
Posts: 1,219
Threads: 51
Joined: Jul 2012
Quote:
Originally Posted by ISmokezU
are you an idiot? why would you ban the "playerid" instead of the targetid,lol.
Do what the others said and try and understand by yourself and if you get any problems,check back here, List Of Bans Commands.
|
No need to call him an idiot, everyone makes mistakes.
Posts: 1,219
Threads: 51
Joined: Jul 2012
Quote:
Originally Posted by ISmokezU
Yeah true my bad,sorry but isn't he a girl "luicy" what kind of guy has a girl name?
|
Er .... why the hell would anyone care about his/her gender
I don't get your point.
Posts: 11
Threads: 1
Joined: Oct 2017
Reputation:
0
CMD:ban(playerid, params[])
{
new targetid, reason[128];
if(PlayerInfo[playerid][pAdmin] < 2)
{
return SendClientMessage(playerid, COLOR_IVORY, "You are not authorized to use this command.");
}
if(sscanf(params, "us[128]", targetid, reason))
{
return SendClientMessage(playerid, COLOR_IVORY, "USAGE: /ban [playerid] [reason]");
}
if(!IsPlayerConnected(targetid))
{
return SendClientMessage(playerid, COLOR_IVORY, "The player specified is disconnected.");
}
if(PlayerInfo[targetid][pAdmin] > PlayerInfo[playerid][pAdmin])
{
return SendClientMessage(playerid, COLOR_IVORY, "The player specified has a higher admin level than you. They cannot be banned.");
}
Log_Write("log_punishments", "%s (uid: %i) banned %s (uid: %i), reason: %s", GetPlayerNameEx(playerid), PlayerInfo[playerid][pID], GetPlayerNameEx(targetid), PlayerInfo[targetid][pID], reason);
SendClientMessageToAllEx(COLOR_IVORY, "AdmCmd: %s was banned by %s, reason: %s", GetPlayerRPName(targetid), GetPlayerRPName(playerid), reason);
BanPlayer(targetid, GetPlayerNameEx(playerid), reason);
return 1;
}