CMD osetadmin - 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: CMD osetadmin (
/showthread.php?tid=524679)
CMD osetadmin -
BryanD - 07.07.2014
someone can help me with the cmd: osetadmin ? for offline players, heres my setadmin cmd:
Код:
CMD:setadmin(playerid, params[])
{
if(PlayerInfo[playerid][pAdmin] >= 6)
{
new
iAdminValue,
iTargetID;
if(sscanf(params, "ui", iTargetID, iAdminValue))
{
SendClientMessage(playerid, COLOR_WHITE, "USAGE: /setadmin [playerid/partofname] [level]");
}
else if(IsPlayerConnected(iTargetID))
{
if(AdminDuty[iTargetID] != 0)
{
SendClientMessage(playerid, COLOR_WHITE, "That admin is currently on-duty. They must go off-duty in order for you to set their admin level.");
return 1;
}
new szMessage[47 + (MAX_PLAYER_NAME * 2)];
format(szMessage, sizeof(szMessage), "AdmCmd: %s has set %s to Level %d Admin.", GetPlayerNameEx(playerid), GetPlayerNameEx(iTargetID), iAdminValue);
ABroadCast(COLOR_LIGHTRED,szMessage, 1);
PlayerInfo[iTargetID][pAdmin] = iAdminValue;
format(szMessage, sizeof(szMessage), "You have been set to Level %d Admin by %s.", iAdminValue, GetPlayerNameEx(playerid));
SendClientMessage(iTargetID, COLOR_LIGHTBLUE, szMessage);
if(PlayerInfo[iTargetID][pHelper] >= 1) {
PlayerInfo[iTargetID][pHelper] = 0;
PlayerInfo[iTargetID][pAcceptReport] = 0;
}
if(iAdminValue == 0)
{
format(PlayerInfo[iTargetID][pAdminName], MAX_PLAYER_NAME, "0");
}
}
else SendClientMessage(playerid, COLOR_GRAD2, "Invalid player specified.");
}
else SendClientMessage(playerid, COLOR_GRAD1, "You're not authorized to use that command!");
return 1;
}
Re: CMD osetadmin -
Stanford - 07.07.2014
It should be something like this:
pawn Код:
CMD:setoadmin(playerid, params[])
{
if(PlayerInfo[playerid][pAdmin] >= 6)
{
new
iAdminValue,
TargetName[MAX_PLAYER_NAME],
string[128];
if(sscanf(params, "us[24]", TargetName, iAdminValue))
{
SendClientMessage(playerid, COLOR_WHITE, "USAGE: /setadmin [playerid/partofname] [level]");
}
format(string, sizeof(string), "users/%s.ini",tmp); // ur path
if(!dini_Exists(string))
{
SendClientMessage(playerid, -1, " That player does not exist.");
return 1;
}
dini_IntSet(string, "AdminThing", iAdminValue); // set the value
SendClientMessage(playerid, -1, "You have set the admin level to that player.");
}
else SendClientMessage(playerid, COLOR_GRAD1, "You're not authorized to use that command!");
return 1;
}
I hope I helped, I just want to show you the way so you can realize the rest of the code so you will learn something yourself.
Good luck, feedback is appreciated.
Re: CMD osetadmin -
BryanD - 08.07.2014
Код:
error 017: undefined symbol "tmp
error 017: undefined symbol "dini_Exists""
error 017: undefined symbol "dini_IntSet
can you help me ?