I can only use commands on myself even if i enter a different id
#1

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.
Reply
#2

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.
Reply
#3

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.
Reply
#4

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.
Reply
#5

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.
Reply
#6

Your command doesn't show any errors, you need to update your sscanf2 and it'll work fine
Reply
#7

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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)