A plea for aid. -
SilencedPistol - 21.03.2013
Okay, so I started a fresh SA:MP script as I am pretty new to scripting although I know the basics. I know that nobody will give me commands forever, and that I will have to work to do them. I will work at it, but I was wondering if you guys could make me these commands in my admin system (ZCMD) that will work. You can use whatever enums that you need to, and I'll change my script accordingly. I learn more from pieces of script that are completed, and I will really appreciate anybody who gives me the help I need as I have tried for weeks, literal weeks.
I've included descriptions with what I want below. I will then script the sufficient commands to go with each admin level. Whoever can do these will be a life saver, and I will not take it for granted. Thank you very much for reading this, but this truely is a plea for aid.
Admin Levels. (1 lowest, 5 highest - I will do teh commands myself.)
/asetadmin <id> <level> - Usable by RCON admin to set people as admins.
/asetlevel <id> <level> - Usable by Level 5 admin to set people from admin level 1 to 5.
/arevokeadmin <id> - Usable by RCON/Level 5 admin to remove peoples admin levels and set them as regular players.
EDIT: Can you guys also include what folders I need to create in my scriptfiles? I have the most basic register system with a dialog box that was featured on the forum somewhere. Thanks again.
Re: A plea for aid. -
Chrillzen - 21.03.2013
I guess you're using Y_INI.
First off..
This checks if you're an admin or RCON admin.
pawn Code:
if(PlayerInfo[playerid][pAdmin] < 1338 && !IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOR_RED, "You're not a admin level 1338 or logged in as a rcon adminstrator.");
Usage of sscanf, this basically means what level you can set them to. 0 - 1338
pawn Code:
if (sscanf(params, "ui", pID, value)) return SendClientMessage(playerid, COLOR_GREY, "Anvдndning: /makeadmin [playerid/partofname] [level 1-1338].");
else if (value < 0 || value > 1338) return SendClientMessage(playerid, COLOR_RED, "Invalid admin level.");
Check if the target id is online.
pawn Code:
if(!IsPlayerConnected(pID)) return SendClientMessage(playerid, COLOR_RED,"That player is not online.");
This will set the Adminlevel to whatever you typed in.
pawn Code:
PlayerInfo[pID][pAdmin] = value;
You'll need this aswell to store the data. Also you'll need to save the data whenever a player logs out and logs in.
Also you'll need this ontop of your command.
Re: A plea for aid. -
sniperwars - 21.03.2013
Here, I have finished it. I have compiled it and no errors.
pawn Code:
//Enums
enum pInfo
{
pAdmin //Whatever your variable is..
}
new PlayerInfo[MAX_PLAYERS][pInfo];
//Stocks
GetAdminLevelName(playerid)
{
new string[64];
if(PlayerInfo[playerid][pAdmin] == 0) string = ("Not Admin"); //Not Admin
if(PlayerInfo[playerid][pAdmin] == 1) string = ("Level 1"); //Change this
if(PlayerInfo[playerid][pAdmin] == 2) string = ("Level 2"); //Change this
if(PlayerInfo[playerid][pAdmin] == 3) string = ("Level 3"); //Change this
if(PlayerInfo[playerid][pAdmin] == 4) string = ("Level 4"); //Change this
if(PlayerInfo[playerid][pAdmin] == 5) string = ("Level 5"); //Change this
return string;
}
//Commands
COMMAND:asetlevel(playerid, params[])
{
new string[128], id, type;
if(PlayerInfo[playerid][pAdmin] == 0) return SendClientMessage(playerid, COLOR_RED, "[ERROR]: You are not an Administrator!");
if(PlayerInfo[playerid][pAdmin] == 1) return SendClientMessage(playerid, COLOR_RED, "[ERROR]: You need to be a Level Five Administrator to use this command!");
if(PlayerInfo[playerid][pAdmin] == 2) return SendClientMessage(playerid, COLOR_RED, "[ERROR]: You need to be a Level Five Administrator to use this command!");
if(PlayerInfo[playerid][pAdmin] == 3) return SendClientMessage(playerid, COLOR_RED, "[ERROR]: You need to be a Level Five Administrator to use this command!");
if(PlayerInfo[playerid][pAdmin] == 4) return SendClientMessage(playerid, COLOR_RED, "[ERROR]: You need to be a Level Five Administrator to use this command!");
if(PlayerInfo[playerid][pAdmin] >= 5)
{
if(sscanf(params, "ui", id, type)) return SendClientMessage(playerid, COLOR_GREY, "Correct Usage: /asetlevel [playerid] [level 0 - 5]");
else
{
if(!IsPlayerConnected(id)) return SendClientMessage(playerid, COLOR_RED, "[ERROR]: This player is not connected to the server.");
if(type < 0 || type > 5) return SendClientMessage(playerid, COLOR_RED, "[ERROR]: Cannot go below 0 or above 5");
{
PlayerInfo[id][pAdmin] = type;
format(string, sizeof(string), "Admin %s (%d) has set %s (%d) level to %d", GetName(playerid), playerid, GetName(id), id, type);
SendClientMessageToAll(COLOR_GREEN, string);
}
}
}
return 1;
}
COMMAND:asetadmin(playerid, params[])
{
new string[128], id, type;
if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOR_RED, "[ERROR]: Login to RCON to use command!");
if(IsPlayerAdmin(playerid))
{
if(sscanf(params, "ui", id, type)) return SendClientMessage(playerid, COLOR_GREY, "Correct Usage: /asetadmin [playerid] [level 0 - 5]");
else
{
if(!IsPlayerConnected(id)) return SendClientMessage(playerid, COLOR_RED, "[ERROR]: This player is not connected to the server.");
if(type < 0 || type > 5) return SendClientMessage(playerid, COLOR_RED, "[ERROR]: Cannot go below 0 or above 5");
{
PlayerInfo[id][pAdmin] = type;
format(string, sizeof(string), "RCON Admin has set %s (%d) level to %d", GetName(id), id, type);
SendClientMessageToAll(COLOR_GREEN, string);
}
}
}
return 1;
}
COMMAND:arevokeadmin(playerid, params[])
{
new string[128], id;
if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOR_RED, "[ERROR]: Login to RCON to use command!");
if(IsPlayerAdmin(playerid))
{
if(sscanf(params, "ui", id)) return SendClientMessage(playerid, COLOR_GREY, "Correct Usage: /arevokeadmin [playerid]");
else
{
if(!IsPlayerConnected(id)) return SendClientMessage(playerid, COLOR_RED, "[ERROR]: This player is not connected to the server.");
{
PlayerInfo[id][pAdmin] = 0;
SendClientMessage(id, COLOR_RED, "RCON Admin has revoked your Admin level");
}
}
}
return 1;
}
Let me know if any problems occur or you can private message me right here on the SA:MP forum. Glad I could help!
Kind regards,
Sean
Re: A plea for aid. -
P3DRO - 22.03.2013
pm me your contact info and i will try to help you out
PS: loved the title XDD
Re: A plea for aid. -
Chrillzen - 22.03.2013
Don't need the revoke command though if you use /setadminlevel 0.