I can only use commands on myself even if i enter a different id -
jblac240 - 25.07.2013
I have a problem that is really bugging me.
I tried to make my friend admin on my server today and I enter /makeadmin 1 5, to make him admin level 5, but it changed me to admin level 5 and did nothing about my friends level. I can only use commands on myself even if I enter 90 as the id to change admin level.
also, im using zcmd if that helps.
Please help.
Re: I can only use commands on myself even if i enter a different id -
JimmyCh - 25.07.2013
Show us your code, I'm half sure you're setting playerid as level 5, which is yourself(Or the person doing the command).
Showing us your code will let us fix your problem.
Re: I can only use commands on myself even if i enter a different id -
jblac240 - 25.07.2013
CMD:makeadmin(playerid, params[]) {
if(PlayerInfo[playerid][pAdmin] >= 9999
{
new
iAdminValue,
iTargetID;
if(sscanf(params, "ui", iTargetID, iAdminValue)) {
SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /makeadmin [playerid] [level]");
}
else if(IsPlayerConnected(iTargetID)) {
if(PlayerInfo[iTargetID][pHelper] >= 1) {
SendClientMessageEx(playerid, COLOR_GRAD1, "You cannot make Community Helpers admins!");
}
else {
new
szMessage[47 + (MAX_PLAYER_NAME * 2)];
PlayerInfo[iTargetID][pAdmin] = iAdminValue;
format(szMessage, sizeof(szMessage), "AdmCmd: %s has promoted %s to a level %d admin.", GetPlayerNameEx(playerid), GetPlayerNameEx(iTargetID), iAdminValue);
ABroadCast(COLOR_LIGHTRED,szMessage, 2);
format(szMessage, sizeof(szMessage), "You have been promoted to a level %d admin by %s.", iAdminValue, GetPlayerNameEx(playerid));
SendClientMessageEx(iTargetID, COLOR_LIGHTBLUE, szMessage);
format(szMessage, sizeof(szMessage), "You have promoted %s to a level %d admin.", GetPlayerNameEx(iTargetID),iAdminValue);
SendClientMessageEx(playerid, COLOR_LIGHTBLUE, szMessage);
}
}
else SendClientMessageEx(playerid, COLOR_GRAD2, "Invalid player specified.");
}
else SendClientMessageEx(playerid, COLOR_GRAD1, "You are not authorized to use that command!");
return 1;
}
I definitely entered /makeadmin 1 5, I checked the chatlogs.
Re: I can only use commands on myself even if i enter a different id -
Threshold - 25.07.2013
pawn Код:
CMD:makeadmin(playerid, params[])
{
if(PlayerInfo[playerid][pAdmin] < 9999) return SendClientMessageEx(playerid, COLOR_GRAD1, "You are not authorized to use that command!");
new iAdminValue, iTargetID;
if(sscanf(params, "ui", iTargetID, iAdminValue)) return SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /makeadmin [playerid] [level]");
if(!IsPlayerConnected(iTargetID) || iTargetID == INVALID_PLAYER_ID) return SendClientMessageEx(playerid, COLOR_GRAD2, "Invalid player specified.");
if(PlayerInfo[iTargetID][pHelper] > 0) return SendClientMessageEx(playerid, COLOR_GRAD1, "You cannot make a Community Helper an Administrator!");
new szMessage[100];
PlayerInfo[iTargetID][pAdmin] = iAdminValue;
//Save Player's Stats here if necessary.
format(szMessage, sizeof(szMessage), "AdmCmd: %s has promoted %s to a level %d admin.", GetPlayerNameEx(playerid), GetPlayerNameEx(iTargetID), iAdminValue);
ABroadCast(COLOR_LIGHTRED,szMessage, 2);
format(szMessage, sizeof(szMessage), "You have been promoted to a level %d admin by %s.", iAdminValue, GetPlayerNameEx(playerid));
SendClientMessageEx(iTargetID, COLOR_LIGHTBLUE, szMessage);
format(szMessage, sizeof(szMessage), "You have promoted %s to a level %d admin.", GetPlayerNameEx(iTargetID),iAdminValue);
SendClientMessageEx(playerid, COLOR_LIGHTBLUE, szMessage);
return 1;
}
If this doesn't work, you need to update your sscanf.
Re: I can only use commands on myself even if i enter a different id -
jblac240 - 25.07.2013
Quote:
Originally Posted by BenzoAMG
pawn Код:
CMD:makeadmin(playerid, params[]) { if(PlayerInfo[playerid][pAdmin] < 9999) return SendClientMessageEx(playerid, COLOR_GRAD1, "You are not authorized to use that command!"); new iAdminValue, iTargetID; if(sscanf(params, "ui", iTargetID, iAdminValue)) return SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /makeadmin [playerid] [level]"); if(!IsPlayerConnected(iTargetID) || iTargetID == INVALID_PLAYER_ID) return SendClientMessageEx(playerid, COLOR_GRAD2, "Invalid player specified."); if(PlayerInfo[iTargetID][pHelper] > 0) return SendClientMessageEx(playerid, COLOR_GRAD1, "You cannot make a Community Helper an Administrator!"); new szMessage[100]; PlayerInfo[iTargetID][pAdmin] = iAdminValue; //Save Player's Stats here if necessary. format(szMessage, sizeof(szMessage), "AdmCmd: %s has promoted %s to a level %d admin.", GetPlayerNameEx(playerid), GetPlayerNameEx(iTargetID), iAdminValue); ABroadCast(COLOR_LIGHTRED,szMessage, 2); format(szMessage, sizeof(szMessage), "You have been promoted to a level %d admin by %s.", iAdminValue, GetPlayerNameEx(playerid)); SendClientMessageEx(iTargetID, COLOR_LIGHTBLUE, szMessage); format(szMessage, sizeof(szMessage), "You have promoted %s to a level %d admin.", GetPlayerNameEx(iTargetID),iAdminValue); SendClientMessageEx(playerid, COLOR_LIGHTBLUE, szMessage); return 1; }
If this doesn't work, you need to update your sscanf.
|
Okay, I will update my sscanf when I wake up tomorrow and will reply with the results tomorrow.
Re: I can only use commands on myself even if i enter a different id -
_Khaled_ - 25.07.2013
Your command doesn't show any errors, you need to update your sscanf2 and it'll work fine
Re: I can only use commands on myself even if i enter a different id -
jblac240 - 26.07.2013
Quote:
Originally Posted by _Khaled_
Your command doesn't show any errors, you need to update your sscanf2 and it'll work fine
|
Thanks, updating my sscanf2 fixed it.
rep'd all of you