help command - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: help command (
/showthread.php?tid=548570)
help command -
Alvaro89 - 30.11.2014
Hi. and do not use the command /banofflineplayer with no administrator
Sorry. I do not speak English
PHP код:
PlayerInfo[playerid][pAdmin]
PHP код:
CMD:banofflineplayer(playerid, params[])
{
new targetname[24], filestring[79];
if(sscanf(params, "s[24]", targetname)) return SendClientMessage(playerid, -1, "Correct Usage: /banofflineplayer [Player's Name]");
format(filestring, sizeof(filestring), "/Users/%s.ini", targetname);
if(!fexist(filestring)) return SendClientMessage(playerid, -1, "Error: The player name you have chosen was not found in our system.");
else
{
new INI:File = INI_Open(filestring);
INI_SetTag(File, "data");
INI_WriteInt(File, "Banned", 1);
INI_Close(File);
new done[128];
format(done, sizeof(done), "You have banned %s", targetname);
SendClientMessage(playerid,-1 , done);
}
return 1;
}
Re: help command -
Dizzle - 30.11.2014
if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, -1, "You are not an Admin!");
If I understood good, you want only the admin can use this ? With this, only the RCON Admin will be able to use this cmd.
Whole code:
Код:
CMD:banofflineplayer(playerid, params[])
{
new targetname[24], filestring[79];
if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, -1, "You are not an Admin!");
if(sscanf(params, "s[24]", targetname)) return SendClientMessage(playerid, -1, "Correct Usage: /banofflineplayer [Player's Name]");
format(filestring, sizeof(filestring), "/Users/%s.ini", targetname);
if(!fexist(filestring)) return SendClientMessage(playerid, -1, "Error: The player name you have chosen was not found in our system.");
else
{
new INI:File = INI_Open(filestring);
INI_SetTag(File, "data");
INI_WriteInt(File, "Banned", 1);
INI_Close(File);
new done[128];
format(done, sizeof(done), "You have banned %s", targetname);
SendClientMessage(playerid,-1 , done);
}
return 1;
}
Respuesta: help command -
Alvaro89 - 30.11.2014
do not use this command with an admin
Код:
CMD:banofflineplayer(playerid, params[])
{
new targetname[24], filestring[79];
if(playerinfo[targetname][pAdmin] >= 6)return SendClientMessage(playerid,-1,"do not use this command with an admin"); <<--- ERROR: array must be indexed (variable "targetname")
if(sscanf(params, "s[24]", targetname)) return SendClientMessage(playerid, -1, "Correct Usage: /banofflineplayer [Player's Name]");
format(filestring, sizeof(filestring), "/Users/%s.ini", targetname);
if(!fexist(filestring)) return SendClientMessage(playerid, -1, "Error: The player name you have chosen was not found in our system.");
else
{
new INI:File = INI_Open(filestring);
INI_SetTag(File, "data");
INI_WriteInt(File, "Banned", 1);
INI_Close(File);
new done[128];
format(done, sizeof(done), "You have banned %s", targetname);
SendClientMessage(playerid,-1 , done);
}
return 1;
}