SA-MP Forums Archive
Hide Admin Location? +REP - 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: Hide Admin Location? +REP (/showthread.php?tid=332985)



Hide Admin Location? +REP - TheMightyEddy - 09.04.2012

So here is my /location code. What it does is when I type /location (id) it will show the location of the player in the chatbox to me.
pawn Код:
CMD:information(playerid, params[])
{
    if(isnull(params)) return SendClientMessage(playerid, COLOR_RED, "Usage: /location [id]");
 
    new
        pID = strval(params),
        zName[64] = "Unknown Location",
        iStr[128];

    if(!IsPlayerConnected(pID)) return SendClientMessage(playerid, COLOR_RED, "Invalid ID!");

    GetPlayerInZone(pID, zName, 64);

    format(iStr, sizeof(iStr), "Location of %s(%d): %s", pName(pID), pID, zName);
    SendClientMessage(playerid, G, iStr);
    return 1;
}
How can i make it so when an admin types in /hidelocation , it will show the location San Andreas instead of each specific city?

Now i don't want RCON admin. I have Lux Admin script. So here is the replacement for IsPlayerAdmin for Lux Admin:

Код:
if(IsPlayerLuxAdminLevel(playerid,4))



Re: Hide Admin Location? +REP - ViniBorn - 09.04.2012

pawn Код:
new bool:HideLocation[MAX_PLAYERS];
CMD:hidelocation(playerid, params[])
{
    if(IsPlayerLuxAdminLevel(playerid, 1))
        return true;

    if(HideLocation[playerid])
    {
        HideLocation[playerid] = false;
        SendClientMessage(playerid,-1,"Your Location Is Now Public");
    }
    else
    {
        HideLocation[playerid] = true;
        SendClientMessage(playerid,-1,"Your Location Has Been Hidden");
    }

    return true;
}

CMD:information(playerid, params[])
{
    if(isnull(params)) return SendClientMessage(playerid, COLOR_RED, "Usage: /location [id]");
 
    new
        pID = strval(params),
        zName[64] = "Unknown Location",
        iStr[128];

    if(!IsPlayerConnected(pID)) return SendClientMessage(playerid, COLOR_RED, "Invalid ID!");

    if(HideLocation[playerid])
        format(iStr, sizeof(iStr), "Location of %s(%d): San Andreas", pName(pID), pID);
    else
    {
        GetPlayerInZone(pID, zName, 64);
        format(iStr, sizeof(iStr), "Location of %s(%d): %s", pName(pID), pID, zName);
    }
    SendClientMessage(playerid, G, iStr);
    return 1;
}



Re: Hide Admin Location? +REP - Toreno - 09.04.2012

pawn Код:
new
    bool:HideLocation[MAX_PLAYERS]
;

CMD:hidelocation(playerid, params[])
{
    if(!IsPlayerLuxAdminLevel(playerid, 1))
    {
        return SendClientMessage(playerid, -1, "You are not an admin.");
    }
   
    if(HideLocation[playerid])
    {
        HideLocation[playerid] = false;
    }
    else
    {
        HideLocation[playerid] = true;
    }
   
    return 1;
}

CMD:information(playerid, params[])
{
    if(isnull(params)) return SendClientMessage(playerid, COLOR_RED, "Usage: /location [id]");

    new
        pID = strval(params),
        zName[64] = "Unknown Location",
        iStr[128];

    if(!IsPlayerConnected(pID)) return SendClientMessage(playerid, COLOR_RED, "Invalid ID!");

    if(HideLocation[playerid])
    {
        format(iStr, sizeof(iStr), "Location of %s(%d): San Andreas", pName(pID), pID);
    }
    else
    {
        GetPlayerInZone(pID, zName, 64);
        format(iStr, sizeof(iStr), "Location of %s(%d): %s", pName(pID), pID, zName);
    }
   
    SendClientMessage(playerid, G, iStr);
   
    return 1;
}



Re: Hide Admin Location? +REP - TheMightyEddy - 09.04.2012

Look at my last post.


Re: Hide Admin Location? +REP - TheMightyEddy - 09.04.2012

Quote:
Originally Posted by Toreno
Посмотреть сообщение
pawn Код:
new
    bool:HideLocation[MAX_PLAYERS]
;

CMD:hidelocation(playerid, params[])
{
    if(!IsPlayerLuxAdminLevel(playerid, 1))
    {
        return SendClientMessage(playerid, -1, "You are not an admin.");
    }
   
    if(HideLocation[playerid])
    {
        HideLocation[playerid] = false;
    }
    else
    {
        HideLocation[playerid] = true;
    }
   
    return 1;
}

CMD:information(playerid, params[])
{
    if(isnull(params)) return SendClientMessage(playerid, COLOR_RED, "Usage: /location [id]");

    new
        pID = strval(params),
        zName[64] = "Unknown Location",
        iStr[128];

    if(!IsPlayerConnected(pID)) return SendClientMessage(playerid, COLOR_RED, "Invalid ID!");

    if(HideLocation[playerid])
    {
        format(iStr, sizeof(iStr), "Location of %s(%d): San Andreas", pName(pID), pID);
    }
    else
    {
        GetPlayerInZone(pID, zName, 64);
        format(iStr, sizeof(iStr), "Location of %s(%d): %s", pName(pID), pID, zName);
    }
   
    SendClientMessage(playerid, G, iStr);
   
    return 1;
}
Discard my last post. This one works! Thanks!


AND also, is there a possible way to let it notify when it's hiding. For example when I type in /hidelocation, it will say "Your Location Has Been Hidden" and when I type in /showlocation it will say "Your Location Is Now Public"


Re: Hide Admin Location? +REP - ViniBorn - 09.04.2012

Sorry, replace for playerid

Quote:
Originally Posted by TheMightyEddy
Посмотреть сообщение
Discard my last post. This one works! Thanks!


AND also, is there a possible way to let it notify when it's hiding. For example when I type in /hidelocation, it will say "Your Location Has Been Hidden" and when I type in /showlocation it will say "Your Location Is Now Public"
I added it


Re: Hide Admin Location? +REP - Jack.7331 - 09.04.2012

Send a client message under each command.


Re: Hide Admin Location? +REP - Toreno - 09.04.2012

First of all, I just took Viniborn's quick code he made, and added a simple line which tells whether the player is admin or not. Second, you see there is a command /hidelocation, this command changes, for example; For the first time you type it, and your location isn't hidden, it will set it to TRUE, which means, hidding it. Then, if you type the command once again, your variable is already true, so it will turn to FALSE, which isn't hidding. /showlocation is not needed here.


Re: Hide Admin Location? +REP - TheMightyEddy - 09.04.2012

I have repped Viniborn and Toreno

Also I need this:
is there a possible way to let it notify when it's hiding. For example when I type in /hidelocation, it will say "Your Location Has Been Hidden" and when I type in /showlocation it will say "Your Location Is Now Public"


Re: Hide Admin Location? +REP - TheMightyEddy - 09.04.2012

Quote:
Originally Posted by Toreno
Посмотреть сообщение
First of all, I just took Viniborn's quick code he made, and added a simple line which tells whether the player is admin or not. Second, you see there is a command /hidelocation, this command changes, for example; For the first time you type it, and your location isn't hidden, it will set it to TRUE, which means, hidding it. Then, if you type the command once again, your variable is already true, so it will turn to FALSE, which isn't hidding. /showlocation is not needed here.
Yes I know but it would be easier though it's not needed. And also how do I sendclientmessage telling the admin that the his/her location has been hidden?