SA-MP Forums Archive
Dcmd_Jail - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Dcmd_Jail (/showthread.php?tid=199171)



Dcmd_Jail - Tessar - 14.12.2010

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.


Re: Dcmd_Jail - WillyP - 14.12.2010

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;
}



Re: Dcmd_Jail - XePloiT - 14.12.2010

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...


Re: Dcmd_Jail - Mean - 14.12.2010

Don't use else if there...

Use if


Re: Dcmd_Jail - Tessar - 14.12.2010

Thanks, This works great!