CMD:ban(playerid, params[]) { if(pInfo[playerid][AL] < 2) return SCM(playerid, red, "[ERROR] No allow!"); { new PID; new reason[64]; new str[128]; new Playername[MAX_PLAYER_NAME], Adminname[MAX_PLAYER_NAME]; GetPlayerName(playerid, Adminname, sizeof(Adminname)); GetPlayerName(PID, Playername, sizeof(Playername)); if(sscanf(params, "us[64]", PID,reason)) return SCM(playerid, red, "[U]: /ban playerid) reason)"); if(!IsPlayerConnected(PID)) return SCM(playerid, -1, "[ERROR]: no player!"); format(str, sizeof(str), "%s has been banned by Administrator %s Reason: %s", Playername, Adminname, reason); SCMToAll(-1, str); Ban(PID); } return 1; }
CMD:ban(playerid, params[])
{
if(pInfo[playerid][AL] < 2) return SCM(playerid, red, "[ERROR] No allow!");
{
new PID;
new reason[64];
new str[128];
new Playername[MAX_PLAYER_NAME], Adminname[MAX_PLAYER_NAME];
if(sscanf(params, "us[64]", PID,reason)) return SCM(playerid, red, "[U]: /ban playerid) reason)");
if(!IsPlayerConnected(PID)) return SCM(playerid, -1, "[ERROR]: no player!");
GetPlayerName(playerid, Adminname, sizeof(Adminname));
GetPlayerName(PID, Playername, sizeof(Playername));
format(str, sizeof(str), "%s has been banned by Administrator %s Reason: %s", Playername, Adminname, reason);
SCMToAll(-1, str);
Ban(PID);
}
return 1;
}
CMD:ban(playerid, params[])
{
if(pInfo[playerid][AL] < 2) return SCM(playerid, red, "[ERROR] No allow!");
{
new PID;
new reason[64];
new str[128];
if(sscanf(params, "us[64]", PID,reason)) return SCM(playerid, red, "[U]: /ban playerid) reason)");
if(!IsPlayerConnected(PID)) return SCM(playerid, -1, "[ERROR]: no player!");
format(str, sizeof(str), "%s has been banned by Administrator %s Reason: %s", GetName(PID), GetName(playerid), reason);
SCMToAll(-1, str);
Ban(PID);
}
return 1;
}
GetName(playerid)
{
new itsPlayerName[MAX_PLAYER_NAME];
GetPlayerName(playerid, itsPlayerName, sizeof(itsPlayerName));
return itsPlayerName;
}
You are using the command with someone or on yourself? lol
It should work. |
To save the banned play you should make a variable and stuffs, I may be able to help if you show,
On TOpic:It might be because there are no other players, If there are SCM may be bugged , use SendClientMessageToAll , don't be lazy to type the whole thing! Well i'll give you the version of mine PHP код:
|
CMD:ban(playerid, params[])
{
if(pInfo[playerid][AL] < 2) return SendClientMessage(playerid, red, "[ERROR] No allow!");
{
new PID;
new reason[64];
new str[128];
new Aname[MAX_PLAYER_NAME],Pname[MAX_PLAYER_NAME];
GetPlayerName(playerid,Aname,sizeof(Aname));
GetPlayerName(PID,Pname,sizeof(Pname));
if(sscanf(params,"us[64]",PID,reason)) return SendClientMessage(playerid, red, "[U]: /ban playerid) reason)");
if(!IsPlayerConnected(PID)) return SendClientMessage(playerid, -1, "[ERROR]: no player!");
format(str,sizeof(str),"%s has been banned by Administrator %s Reason: %s",Pname,Aname,reason);
SendClientMessageToAll(-1,str);
Ban(PID);
//Rest part when I get your variables!
}
return 1;
}
To save the banned play you should make a variable and stuffs, I may be able to help if you show,
On TOpic:It might be because there are no other players, If there are SCM may be bugged , use SendClientMessageToAll , don't be lazy to type the whole thing! Well i'll give you the version of mine PHP код:
|
CMD:ban(playerid, params[])
{
if(pInfo[playerid][AL] < 2) return SCM(playerid, red, "[ERROR] No allow!");
{
new PID;
new reason[64];
new str[128];
new Playername[MAX_PLAYER_NAME], Adminname[MAX_PLAYER_NAME];
if(sscanf(params, "us[64]", PID,reason)) return SCM(playerid, red, "[U]: /ban playerid) reason)");
if(!IsPlayerConnected(PID)) return SCM(playerid, -1, "[ERROR]: no player!");
printf("all condition passed");
GetPlayerName(playerid, Adminname, sizeof(Adminname));
GetPlayerName(PID, Playername, sizeof(Playername));
printf("user =%s target=%s",Adminname,Playername);
format(str, sizeof(str), "%s has been banned by Administrator %s Reason: %s", Playername, Adminname, reason);
SCMToAll(-1, str);
printf("message = %s",str);
Ban(PID);
}
printf("out of if");
return 1;
}
GetPlayerName(PID, Playername, sizeof(Playername));
if(sscanf(params, "us[64]", PID,reason)) return SCM(playerid, red, "[U]: /ban playerid) reason)");
CMD:ban(playerid, params[])
{
if(pInfo[playerid][AL] < 2) return SCM(playerid, red, "[ERROR] No allow!");
{
if(sscanf(params, "us[64]", PID,reason)) return SCM(playerid, red, "[U]: /ban playerid) reason)");
if(!IsPlayerConnected(PID))
return SCM(playerid, -1, "[ERROR]: no player!");
new PID;
new reason[64];
new str[128];
new Playername[MAX_PLAYER_NAME], Adminname[MAX_PLAYER_NAME];
GetPlayerName(playerid, Adminname, sizeof(Adminname));
GetPlayerName(PID, Playername, sizeof(Playername));
format(str, sizeof(str), "%s has been banned by Administrator %s Reason: %s", Playername, Adminname, reason);
SCMToAll(-1, str);
Ban(PID);
}
return 1;
}