SA-MP Forums Archive
Help - 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: Help (/showthread.php?tid=508955)



Help - Protonix - 24.04.2014

Hello i was making an admin command i made it it compiled but i have 1 problem look:

it compiles as i said but when i wasnt admin it doesnt shows [ADMIN] You are not admin. why ? i think i have wrong with elses

Код:
if(strcmp(cmdtext, "/aod", true) == 0)
{
    if(IsPlayerLuxAdmin(playerid))
    {
	if(aaoodd[playerid] == true)
	{
	    aaoodd[playerid] = false;
            label[playerid] = Create3DTextLabel(".:ADMINISTRATOR:.", 0xB8FFABFF, 30.0, 40.0, 50.0, 40.0, 0);
    	    Attach3DTextLabelToPlayer(label[playerid], playerid, 0.0, 0.0, 0.7);
	    SetPlayerHealth(playerid, 1000000);
    	    TextDrawShowForPlayer(playerid, aod);
    	    SetPlayerColor(playerid, 0xB8FFABFF);
    	    SendClientMessage(playerid, 0xB8FFABFF, "[ADMIN] {FFFFFF}You've Enabled Your administrator mode!");
 	    new name[MAX_PLAYER_NAME+1], string[50+MAX_PLAYER_NAME+1];
    	    GetPlayerName(playerid, name, sizeof(name));
    	    format(string, sizeof(string), "[ADMIN] {FFFFFF}%s has enabled his administrator mode.", name);
    	    SendClientMessageToAll(0xB8FFABFF, string);
	}
    	else if(aaoodd[playerid] == false)
	{
    	    aaoodd[playerid] = true;
      	    Delete3DTextLabel(label[playerid]);
	    SetPlayerHealth(playerid, 100);
    	    SetPlayerColor(playerid, 0xFFFFFFFF);
    	    TextDrawHideForPlayer(playerid, aod);
    	    SendClientMessage(playerid, 0xB8FFABFF, "[ADMIN] {FFFFFF}You've Disabled Your administrator mode!");
 	    new name[MAX_PLAYER_NAME+1], string[50+MAX_PLAYER_NAME+1];
    	    GetPlayerName(playerid, name, sizeof(name));
	    format(string, sizeof(string), "[ADMIN] {FFFFFF}%s has disabled his administrator mode.", name);
    	    SendClientMessageToAll(0xB8FFABFF, string);
	}
        else SendClientMessage(playerid, 0xB8FFABFF, "[ADMIN] {FFFFFF}You are not an admin!");
}
    return 1;
}
return 0;
}



Re: Help - Galletziz - 24.04.2014

pawn Код:
else
{
SendClientMessage(playerid, 0xB8FFABFF, "[ADMIN] {FFFFFF}You are not an admin!");
}



Re: Help - Protonix - 24.04.2014

Not worked.


Re: Help - JeaSon - 24.04.2014

your not using right

fixed

pawn Код:
if(strcmp(cmdtext, "/aod", true) == 0)
{
    if(IsPlayerLuxAdmin(playerid))
    {
        if(aaoodd[playerid] == true)
        {
                aaoodd[playerid] = false;
                label[playerid] = Create3DTextLabel(".:ADMINISTRATOR:.", 0xB8FFABFF, 30.0, 40.0, 50.0, 40.0, 0);
                Attach3DTextLabelToPlayer(label[playerid], playerid, 0.0, 0.0, 0.7);
                SetPlayerHealth(playerid, 1000000);
                TextDrawShowForPlayer(playerid, aod);
                SetPlayerColor(playerid, 0xB8FFABFF);
                SendClientMessage(playerid, 0xB8FFABFF, "[ADMIN] {FFFFFF}You've Enabled Your administrator mode!");
                new name[MAX_PLAYER_NAME+1], string[50+MAX_PLAYER_NAME+1];
                GetPlayerName(playerid, name, sizeof(name));
                format(string, sizeof(string), "[ADMIN] {FFFFFF}%s has enabled his administrator mode.", name);
                SendClientMessageToAll(0xB8FFABFF, string);
        }
        else if(aaoodd[playerid] == false)
        {
                aaoodd[playerid] = true;
                Delete3DTextLabel(label[playerid]);
                SetPlayerHealth(playerid, 100);
                SetPlayerColor(playerid, 0xFFFFFFFF);
                TextDrawHideForPlayer(playerid, aod);
                SendClientMessage(playerid, 0xB8FFABFF, "[ADMIN] {FFFFFF}You've Disabled Your administrator mode!");
                new name[MAX_PLAYER_NAME+1], string[50+MAX_PLAYER_NAME+1];
                GetPlayerName(playerid, name, sizeof(name));
                format(string, sizeof(string), "[ADMIN] {FFFFFF}%s has disabled his administrator mode.", name);
                SendClientMessageToAll(0xB8FFABFF, string);
        }
                }
        else
        {
            SendClientMessage(playerid, 0xB8FFABFF, "[ADMIN] {FFFFFF}You are not an admin!");
        }
        return 1;
    }
    return 0;
}