[Help] Multiple Spaces in ZCMD - 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] Multiple Spaces in ZCMD (
/showthread.php?tid=472118)
[Help] Multiple Spaces in ZCMD -
BornHuman - 26.10.2013
Hello, SA:MP community! I have run into a bit of trouble and I've tried searching it up, but I have found absolutely nothing helpful for the situation I am in. I have tried to dig through gamemodes, finding an answer but haven't found one.
After recently starting my new script, I have made it a goal to create an admin system. After creating several ranks I want to obviously make a command to rank someone to a certain admin level.
Something like such:
Код:
/makeadmin [playerid] [adminlevel]
If someone could come up with a bit of a 'help script' so to speak that I could leech off of and make into my own, creating a command like that and making one of the options set their adminlevel to:
Код:
Staff[playerid] = 1;
Just so I can get an idea of how it works, and continue on with my script, I would be most greatful!
Thank you
-Jason
Re: [Help] Multiple Spaces in ZCMD -
Pottus - 26.10.2013
Here is a basic idea.
pawn Код:
// This is a macro function call it will specify the allowed command level of a command
#define CMDLEVEL(%0) if(PlayerData[playerid][p_Level] < %0) return SendClientMessage(playerid, -1, "You are not high enough level to use this command)
// enum of the PlayerData variable
enum PLAYERINFO
{
p_Level,
p_Password[129],
p_Kills,
p_Deaths,
}
// We store the player data in here
new PlayerData[MAX_PLAYERS][PLAYERINFO];
// Make admin example
CMD:makeadmin(playerid, arg[])
{
// Command level must be 3 or greater
CMDLEVEL(3);
new pid, level;
if(sscanf(arg, "ui", pid, level)) return SendClientMessage(playerid, -1, "Usage /makeadmin <id> <level>");
if(pid == INVALID_PLAYER_ID) return SendClientMessage(playerid, -1, "That player is not connected");
if(pid == playerid) return SendClientMessage(playerid, -1, "You can not use this command on yourself");
if(level < 1) return SendClientMessage(playerid, -1, "Level must be greater than zero");
if(level > PlayerData[playerid][p_Level]) return SendClientMessage(playerid, -1, "You can't set some a higher level than yourself");
if(PlayerData[pid][p_Level] >= PlayerData[playerid][p_Level]) return SendClientMessage(playerid, -1, "This player is higher or the same level already");
PlayerData[pid][p_Level] = level;
new line[128];
format(line, sizeof(line), "%s has set your level to %i", ReturnName(playerid), level);
SendClientMessage(pid, -1, line);
format(line, sizeof(line), "You have set %s to level %i", ReturnName(pid), level);
SendClientMessage(playerid, -1 line);
return 1;
}
// Return name stock
stock ReturnName(playerid)
{
new Pname[MAX_PLAYER_NAME];
GetPlayerName(playerid, Pname, sizeof(Pname));
return Pname;
}
Re: [Help] Multiple Spaces in ZCMD -
IDarkness - 08.08.2014
You can try to do something like that
PHP код:
cmd:makeadmin(playerid, params[]) {
if(Value or rank admins which can make the admin -PlayerInfo-)
new,
Adminrank, // the admin rank
iTargetID; //thats showing players id
if(Adminrank > Highest Admin lvl || Adminrank < Lowest admin lvl) { SendClientMessageEx(playerid, COLOR_GREY, " ur error msg "); return 1; } // Add this if u like to put a limit for admin ranks
PlayerInfo[iTargetID][Staff] = Adminrank;
return 1;
}
THere you go