#1

hey how i can make it /neon only admins can use .


// This command opens a menu where you can choose neons lights for your vehicle
COMMAND:neon(playerid, params[])
{
// Setup local variables
new OptionsList[200], DialogTitle[200];

// Send the command to all admins so they can see it
SendAdminText(playerid, "/neon", params);


// Check if the player has logged in
if (APlayerData[playerid][LoggedIn] == true)
{
// Check if the player is the driver of a vehicle
if (GetPlayerVehicleSeat(playerid) == 0)
{
format(DialogTitle, sizeof(DialogTitle), "Vali valgustus:");

format(OptionsList, sizeof(OptionsList), "%sPolice lights\n", OptionsList);
format(OptionsList, sizeof(OptionsList), "%sRed lights\n", OptionsList);
format(OptionsList, sizeof(OptionsList), "%sBlue lights\n", OptionsList);
format(OptionsList, sizeof(OptionsList), "%sGreen lights\n", OptionsList);
format(OptionsList, sizeof(OptionsList), "%sYellow lights\n", OptionsList);
format(OptionsList, sizeof(OptionsList), "%sPink lights\n", OptionsList);
format(OptionsList, sizeof(OptionsList), "%sWhite lights\n", OptionsList);
format(OptionsList, sizeof(OptionsList), "%sRemove neons\n", OptionsList);
// Show the neon menu
ShowPlayerDialog(playerid, DialogNeon, DIALOG_STYLE_LIST, DialogTitle, OptionsList, "Vali", "Sule");
}
else
SendClientMessage(playerid, 0xFF0000FF, "Sa pole autojuht");
}
else
return 0;

// Let the server know that this was a valid command
return 1;
}
Reply
#2

pawn Код:
// This command opens a menu where you can choose neons lights for your vehicle
COMMAND:neon(playerid, params[])
{
// Setup local variables
new OptionsList[200], DialogTitle[200];

// Send the command to all admins so they can see it
SendAdminText(playerid, "/neon", params);


// Check if the player has logged in
if (APlayerData[playerid][LoggedIn] == true)
{
    // Check if the player is the driver of a vehicle
    if (GetPlayerVehicleSeat(playerid) == 0)
    {
            if (IsPlayerAdmin(playerid)) //This checks if the player is admin (rcon admin in this case) you can replace it with own admin check
                                         //for instance if(AccInfo[playerid][Level] >= 1)
            {
            format(DialogTitle, sizeof(DialogTitle), "Vali valgustus:");

            format(OptionsList, sizeof(OptionsList), "%sPolice lights\n", OptionsList);
            format(OptionsList, sizeof(OptionsList), "%sRed lights\n", OptionsList);
            format(OptionsList, sizeof(OptionsList), "%sBlue lights\n", OptionsList);
            format(OptionsList, sizeof(OptionsList), "%sGreen lights\n", OptionsList);
            format(OptionsList, sizeof(OptionsList), "%sYellow lights\n", OptionsList);
            format(OptionsList, sizeof(OptionsList), "%sPink lights\n", OptionsList);
            format(OptionsList, sizeof(OptionsList), "%sWhite lights\n", OptionsList);
            format(OptionsList, sizeof(OptionsList), "%sRemove neons\n", OptionsList);
            // Show the neon menu
            ShowPlayerDialog(playerid, DialogNeon, DIALOG_STYLE_LIST, DialogTitle, OptionsList, "Vali", "Sule");
            }
            else
            {
                SendClientMessage(playerid, 0xFF0000FF, "You need to be admin");
            }
    }
    else
    {
        SendClientMessage(playerid, 0xFF0000FF, "Sa pole autojuht");
    }
}
else
{
    return 0;
}

// Let the server know that this was a valid command
return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)