*under includes*
new isadmin[MAX_PLAYERS];
new targetplayerid;
// /setadmin command.
CMD:setadmin(playerid, params[])
{
if (IsPlayerAdmin(playerid) == 1)
{
if (isnull(params)) return SendClientMessage(playerid, KLEUR_VOORB, "USAGE: /setadmin [ID] [level]");
{
if(!sscanf(params, "dd", targetplayerid, isadmin[targetplayerid]))
if(isadmin[targetplayerid] > 6 || isadmin[targetplayerid] < 0) return SendClientMessage(playerid, KLEUR_VOORB, "Level: 0-6");
if(isadmin[targetplayerid] == 0)
{
isadmin[targetplayerid] = 0;
new maker[110];
format(maker, sizeof(maker), "You have just removed %s from the Administration team.", pNaam(targetplayerid));
SendClientMessage(playerid, KLEUR_BLAUW, maker);
new krijger[110];
format(krijger, sizeof(krijger), "Administrator %s has just removed you from the Administration team.", pNaam(playerid));
SendClientMessage(targetplayerid, KLEUR_BLAUW, krijger);
}
if(isadmin[targetplayerid] == 1)
{
isadmin[targetplayerid] = 1;
new maker[110];
format(maker, sizeof(maker), "You have just added %s to the Administration team.", pNaam(targetplayerid));
SendClientMessage(playerid, KLEUR_BLAUW, maker);
new krijger[110];
format(krijger, sizeof(krijger), "Administrator %s has just added you to the Administration team.", pNaam(playerid));
SendClientMessage(targetplayerid, KLEUR_BLAUW, krijger);
}
}
return 1;
}
return 1;
}
cmd(setadmin, playerid, params[])
{
new level;
if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, -1, "You are not an admin"); // If the player isn't an admin it will send him the message.
if(!sscanf(params, "ui", targetplayerid, level)) return SendClientMessage(playerid, -1, "/setadmin [playerid] [level]);
if(Level > 6 || 0 > Level) return SendClientMessage(playerid, -1, "Level 0-6");
isadmin[targetplayerid] = level; //isadmin will be the level you wrote in.
switch (isadmin[targetplayerid]
{
case 0: SendClientMessage(playerid, -1, "You have been removed from the admin team."); //If isadmin == 0 it will send him this message
case 1: SendClientMessage(playerid, -1, "You've been added to the admin team."); // If level 1 and so on this message will be set.
case 2: SendClientMessage(playerid, -1, "You've been added to the admin team.");
case 3: SendClientMessage(playerid, -1, "You've been added to the admin team.");
case 4: SendClientMessage(playerid, -1, "You've been added to the admin team.");
case 5: SendClientMessage(playerid, -1, "You've been added to the admin team.");
case 6: SendClientMessage(playerid, -1, "You've been added to the admin team.");
}
return 1;
}
*under includes*
new answer;
// /setadmin command.
CMD:setadmin(playerid, params[])
{
if (IsPlayerAdmin(playerid) == 1)
{
if (isnull(params)) return SendClientMessage(playerid, KLEUR_VOORB, "USAGE: /setadmin [ID] [level]");
{
if(!sscanf(params, "dd", targetplayerid, isadmin[answer]))
if(isadmin[answer] > 6 || isadmin[answer] < 0) return SendClientMessage(playerid, KLEUR_VOORB, "Level: 0-6");
if(isadmin[answer] == 0)
{
isadmin[targetplayerid] = 0;
new maker[110];
format(maker, sizeof(maker), "You have just removed %s from the Administration team.", pNaam(targetplayerid));
SendClientMessage(playerid, KLEUR_BLAUW, maker);
new krijger[110];
format(krijger, sizeof(krijger), "Administrator %s has just removed you from the Administration team.", pNaam(playerid));
SendClientMessage(targetplayerid, KLEUR_BLAUW, krijger);
}
if(isadmin[answer] == 1)
{
isadmin[targetplayerid] = 1;
new maker[110];
format(maker, sizeof(maker), "You have just added %s to the Administration team.", pNaam(targetplayerid));
SendClientMessage(playerid, KLEUR_BLAUW, maker);
new krijger[110];
format(krijger, sizeof(krijger), "Administrator %s has just added you to the Administration team.", pNaam(playerid));
SendClientMessage(targetplayerid, KLEUR_BLAUW, krijger);
}
}
return 1;
}
return 1;
}
|
All right, by the way if (isnull(params)) return SendClientMessage(playerid, KLEUR_VOORB, "USAGE: /setadmin [ID] [level]"); is not needed because you have sscanf.
|
if(sscanf(params, "ui", targetplayerid, level)) return SendClientMessage(playerid, ADD_COLOR_HERE, "/setadmin [playerid] [level]);
if(!sscanf(params, "dd", targetplayerid, isadmin[answer]))
if(!sscanf(params, "dd", targetplayerid, isadmin[answer])) return SCM(playerid, -1, "/setadmin [Playerid] [Level]");
#define SCM SendClientMessage
|
pawn Код:
|
if(sscanf(params, "u", targetplayerid, level)) return SendClientMessage(playerid, ADD_COLOR_HERE, "/setadmin [playerid] [level]);
if(!sscanf(params, "ui", targetplayerid, level)) return SendClientMessage(playerid, ADD_COLOR_HERE, "/setadmin [playerid] [level]);