Replace RCON admin with regular admin
#1

Sorry if this has been posted before, but im using NoahF's rickroll script and have a small question.

Is there anyway to adapt it so that admins above level 5 can use it instead of just the RCON admin?

Heres the code

Code:
#include <a_samp>
#include <zcmd>
#include <sscanf2>
#define FILTERSCRIPT
#define COLOR_RED 0xFF0000FF
#define COLOR_GREY 0xAFAFAFAA
#define COLOR_DBLUE 0x00007AFF

public OnFilterScriptInit()
{
	print("*********************************************");
	print("NoahF's RickRoll Filterscript has loaded!");
	print("*********************************************");
	return 1;
}
public OnFilterScriptExit()
{
	print("************************************************");
	print("NoahF's RickRoll Filterscript has unloaded!");
	print("************************************************");
	return 1;
}

CMD:rickroll(playerid, params[])
    {
        if(IsPlayerAdmin(playerid)) {
            new PlayerID; //The variable for the Player ID you put in for the player we want to Rick Roll.
            new reason[64]; //The reason for the Rick Roll.
            new str[128]; //Our variable for a message string.
			new pName[MAX_PLAYER_NAME], adName[MAX_PLAYER_NAME]; //Defines the function with the player name you want to get.
            GetPlayerName(playerid, adName, sizeof(adName)); //Defines the function with the admin name you want to get.
            GetPlayerName(playerid, pName, sizeof(pName));
            if(sscanf(params, "us[64]", PlayerID,reason)) return SendClientMessage(playerid, COLOR_GREY, "USAGE: /rickroll [playerid] [reason]"); //Tell SSCANF if the parameters/the syntax is written wrong to return a message (PlayerID and the reason used here)

            if(!IsPlayerConnected(PlayerID)) //If the ID is wrong or not connected, return the message below:
            return SendClientMessage(playerid, COLOR_GREY, "Player is not connected!");

            format(str, sizeof(str), "'%s' has been Rick Roll'd by Administrator '%s'. Reason: %s ", pName, adName, reason); //format the string we've defined to send the message, playername and adminname are used to receive the information about the names
        	SendClientMessageToAll(COLOR_RED, str); //Send the message we formatted with format using the str variable we declared/made.
        	PlayAudioStreamForPlayer(PlayerID, "http://www.geekspeakradio.us/jocofullinterview41.mp3"); //Play the Rick Roll song. (Never Gonna Give You Up - Rick Astley.)
			GameTextForPlayer(PlayerID, "~r~You have been Rick Roll'd by an Admin!", 4000, 3); //Send a message to the players screen.
			SetPlayerHealth(PlayerID, 0.3); //Set the players health to %30.
		}
        else //If he isn't logged into RCON, then do:
        {
            SendClientMessage(playerid, COLOR_DBLUE, "You need to be an RCON Admin to use that command!"); //Send this message if they are not RCON.
        }
        return 1;
    }
Any help would be appreciated.
Reply
#2

You need to replace IsPlayerAdmin with your own system, supposing it uses an enum, then something like if(PlayerInfo[playerid][pAdminLevel]>5) //do ur thing.
Reply
#3

pawn Code:
CMD:rickroll(playerid, params[])
    {
        if(PlayerInfo[playerid][pAdmin] > 5) { // Need to be added as admin in your player data file
            new PlayerID; //The variable for the Player ID you put in for the player we want to Rick Roll.
            new reason[64]; //The reason for the Rick Roll.
            new str[128]; //Our variable for a message string.
            new pName[MAX_PLAYER_NAME], adName[MAX_PLAYER_NAME]; //Defines the function with the player name you want to get.
            GetPlayerName(playerid, adName, sizeof(adName)); //Defines the function with the admin name you want to get.
            GetPlayerName(playerid, pName, sizeof(pName));
            if(sscanf(params, "us[64]", PlayerID,reason)) return SendClientMessage(playerid, COLOR_GREY, "USAGE: /rickroll [playerid] [reason]"); //Tell SSCANF if the parameters/the syntax is written wrong to return a message (PlayerID and the reason used here)

            if(!IsPlayerConnected(PlayerID)) //If the ID is wrong or not connected, return the message below:
            return SendClientMessage(playerid, COLOR_GREY, "Player is not connected!");

            format(str, sizeof(str), "'%s' has been Rick Roll'd by Administrator '%s'. Reason: %s ", pName, adName, reason); //format the string we've defined to send the message, playername and adminname are used to receive the information about the names
            SendClientMessageToAll(COLOR_RED, str); //Send the message we formatted with format using the str variable we declared/made.
            PlayAudioStreamForPlayer(PlayerID, "http://www.geekspeakradio.us/jocofullinterview41.mp3"); //Play the Rick Roll song. (Never Gonna Give You Up - Rick Astley.)
            GameTextForPlayer(PlayerID, "~r~You have been Rick Roll'd by an Admin!", 4000, 3); //Send a message to the players screen.
            SetPlayerHealth(PlayerID, 0.3); //Set the players health to %30.
        }
        else //If he isn't logged into RCON, then do:
        {
            SendClientMessage(playerid, COLOR_DBLUE, "Error: You are not a Level 5 Administrator!"); //Send this message if they are not RCON.
        }
        return 1;
    }
IsPlayerAdmin is RCON (/rcon)
PlayerInfo[playerid][pAdmin] is the enum set up for your player data (providing you have a "users" or "players" folder in scriptfiles)
It would be better to add this to your game mode rather than use it as a filterscript.
Reply
#4

Cheers for the help guys, sorted and fixed. Thanks again
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)