Dcmd_Jail
#1

Hey. When I type /jail it says "You are not authorized to use that command!".

Код:
dcmd_jail(playerid, params[])
{
	new pID, pName[24], pName2[24], string[128];
	GetPlayerName(pID, pName, sizeof(pName));
	GetPlayerName(pID, pName2, sizeof(pName2));

	if(!sscanf(params, "us", pID)) SendClientMessage(playerid, COLOR_RED, "Usage: /jail [playerid]");
	else if(PlayerInfo[playerid][AdminLevel] >= 1) return SendClientMessage(playerid, COLOR_RED, "You are not authorized to use that command!");
    else if(!IsPlayerConnected(pID)) return SendClientMessage(playerid, COLOR_RED, "Invalid playerid");
	else
	{
		SetPlayerPos(pID,264.0535,77.2942,1001.0391);
		SetPlayerFacingAngle(pID,270.0);
        JailedPlayer[pID] = true;
        format(string, sizeof(string), "**(Admin)** %s [ID: %d] jailed %s [ID: %d]", pName, playerid, pName2, playerid);
       	SendmAdminMsg(COLOR_LIGHTRED, string);
	    PlayerInfo[pID][Jailed] = 1;
	    SetTimerEx("JailTimer", 600000, false, "i", pID);
	}
	return 1;
}
I posted this in the wrong section so i removed and re-posted it here.
Reply
#2

pawn Код:
dcmd_jail(playerid, params[])
{
    new pID, pName[24], pName2[24], string[128];
    GetPlayerName(pID, pName, sizeof(pName));
    GetPlayerName(pID, pName2, sizeof(pName2));

    if(!sscanf(params, "us", pID)) SendClientMessage(playerid, COLOR_RED, "Usage: /jail [playerid]");
    if(PlayerInfo[playerid][AdminLevel] < 0) return SendClientMessage(playerid, COLOR_RED, "You are not authorized to use that command!");
    if(!IsPlayerConnected(pID)) return SendClientMessage(playerid, COLOR_RED, "Invalid playerid");
    else
    {
        SetPlayerPos(pID,264.0535,77.2942,1001.0391);
        SetPlayerFacingAngle(pID,270.0);
        JailedPlayer[pID] = true;
        format(string, sizeof(string), "**(Admin)** %s [ID: %d] jailed %s [ID: %d]", pName, playerid, pName2, playerid);
        SendmAdminMsg(COLOR_LIGHTRED, string);
        PlayerInfo[pID][Jailed] = 1;
        SetTimerEx("JailTimer", 600000, false, "i", pID);
    }
    return 1;
}
Reply
#3

Quote:
Originally Posted by [FU]Victious
Посмотреть сообщение
pawn Код:
dcmd_jail(playerid, params[])
{
    new pID, pName[24], pName2[24], string[128];
    GetPlayerName(pID, pName, sizeof(pName));
    GetPlayerName(pID, pName2, sizeof(pName2));

    if(!sscanf(params, "us", pID)) SendClientMessage(playerid, COLOR_RED, "Usage: /jail [playerid]");
    if(PlayerInfo[playerid][AdminLevel] < 0) return SendClientMessage(playerid, COLOR_RED, "You are not authorized to use that command!");
    if(!IsPlayerConnected(pID)) return SendClientMessage(playerid, COLOR_RED, "Invalid playerid");
    else
    {
        SetPlayerPos(pID,264.0535,77.2942,1001.0391);
        SetPlayerFacingAngle(pID,270.0);
        JailedPlayer[pID] = true;
        format(string, sizeof(string), "**(Admin)** %s [ID: %d] jailed %s [ID: %d]", pName, playerid, pName2, playerid);
        SendmAdminMsg(COLOR_LIGHTRED, string);
        PlayerInfo[pID][Jailed] = 1;
        SetTimerEx("JailTimer", 600000, false, "i", pID);
    }
    return 1;
}
Change the line to this...
pawn Код:
if(PlayerInfo[playerid][AdminLevel] < 1) return SendClientMessage(playerid, COLOR_RED, "You are not authorized to use that command!");
Victious: you did "<0" which mean when the value is under 0 which mean every one can use it cuz im assume the regular players are adminlevel 0...
Reply
#4

Don't use else if there...

Use if
Reply
#5

Thanks, This works great!
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)