[QUESTION] RCON admin level +REP
#1

Hi,
I'm making an admin filterscript, i made an /setadmin command to set players as an admin, but i need to know how to only allow RCON admins to set players as administrators.
My question is, does this command work with normal players(all) or with only RCON Administrators.
I need a script like this with zcmd to only allow RCON admins to use /setadmin.

Code:
CMD:setadmin(playerid, params[])
{
    new victimname[MAX_PLAYER_NAME], adminname[MAX_PLAYER_NAME], admlvl, id;
    if(IsPlayerAdmin(playerid))
    {
        if (sscanf(params, "ui", id, admlvl)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /setadmin [id] [adminlevel]");
        if (id == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_RED, "[SYSTEM]: Player ID not found.");
        if (admlvl > 10 || admlvl < 0) return SendClientMessage(playerid, COLOR_RED,"[SYSTEM]: Valid Admin Levels: 1-10!");
        PlayerInfo[id][pAdminLevel] = admlvl;
        GetPlayerName(id, victimname, sizeof(victimname));
        GetPlayerName(playerid, adminname, sizeof(adminname));
        new str[128];
        format(str,128,"System: %s [ID %d] has set %s [ID %d] admin level to %i",adminname, playerid, victimname, id, admlvl);
        SendClientMessage(playerid,COLOR_GREEN,str);
        return 1;
    }
    else return SendClientMessage(playerid,COLOR_RED,"[SECURITY] You are not allowed to use this command!");
}
Reply
#2

[EDIT] When compiling the script i'm having this error:
C:\Users\Nelson.Paulo2301-PC\Desktop\CnR.pwn(351) : warning 203: symbol is never used: "ret_memcpy"
C:\Users\Nelson.Paulo2301-PC\Desktop\CnR.pwn(351) : warning 203: symbol is never used: "setadmin"


Should i worry about it, if i should how do i fix it?
Reply
#3

I think that this error is caused becouse of my enum, this is how i'm using it:

Code:
enum pInfo
{
    pPass,
    pCash,
	pScore,
    pAdminLevel,
    pKills,
    pDeaths
}
new PlayerInfo[MAX_PLAYERS][pInfo];

forward LoadUser_data(playerid,name[],value[]);
public LoadUser_data(playerid,name[],value[])
{
    INI_Int("Password",PlayerInfo[playerid][pPass]);
    INI_Int("AdminLevel",PlayerInfo[playerid][pAdminLevel]);
    INI_Int("Cash",PlayerInfo[playerid][pCash]);
	INI_Int("Score",PlayerInfo[playerid][pScore]);
    INI_Int("Kills",PlayerInfo[playerid][pKills]);
    INI_Int("Deaths",PlayerInfo[playerid][pDeaths]);
    return 1;
}
Anyways, i want to fix these warnings, then i want to know how can i make only RCON admins to use this command ( /setadmin )
Reply
#4

use if(IsPlayerAdmin(playerid)) to check whether player is rcon or not
Reply
#5

Quote:
Originally Posted by Sreyas
View Post
use if(IsPlayerAdmin(playerid)) to check whether player is rcon or not
I did, check the script, anyways that isnt a problem anymore, i want to fix the warnings that i'm having, i'l send you pastebin of the full gamemode ( script ) It only has the login/register system, not much, the /setadmin command is below everything, pastebin: pastebin.com/cbvMN0v6

So, would be nice if you fixed /setadmin command and added it only functionable for RCON admins, when you finish it would be nice if you sended it in pastebin.com or something, thanks!

- Regards
Reply
#6

Quote:
Originally Posted by TheBoZ
View Post
I did, check the script, anyways that isnt a problem anymore, i want to fix the warnings that i'm having, i'l send you pastebin of the full gamemode ( script ) It only has the login/register system, not much, the /setadmin command is below everything, pastebin: pastebin.com/cbvMN0v6

So, would be nice if you fixed /setadmin command and added it only functionable for RCON admins, when you finish it would be nice if you sended it in pastebin.com or something, thanks!

- Regards
who am i? your slave?? any way you did not add return 1 in your cmd

try it

PHP Code:
CMD:setadmin(playeridparams[])
{
    new 
victimname[MAX_PLAYER_NAME], adminname[MAX_PLAYER_NAME], admlvlid;
    if(
IsPlayerAdmin(playerid))
    {
        if (
sscanf(params"ui"idadmlvl)) return SendClientMessage(playeridCOLOR_RED"USAGE: /setadmin [id] [adminlevel]");
        if (
id == INVALID_PLAYER_ID) return SendClientMessage(playeridCOLOR_RED"[SYSTEM]: Player ID not found.");
        if (
admlvl || admlvl 0) return SendClientMessage(playeridCOLOR_RED,"[SYSTEM]: Valid Admin Levels: 1-6!");
        
PlayerInfo[id][pAdminLevel] = admlvl;
        
GetPlayerName(idvictimnamesizeof(victimname));
        
GetPlayerName(playeridadminnamesizeof(adminname));
        new 
str[128];
        
format(str,128,"[ADMIN] %s [ID %d] has set %s [ID %d] admin level to %i",adminnameplayeridvictimnameidadmlvl);
        
SendClientMessage(playerid,COLOR_GREEN,str);
        return 
1;
    }
    else return 
SendClientMessage(playerid,COLOR_RED,"[SECURITY] You are not allowed to use this command!");
  return 
1;

Reply
#7

Hello!

I have looked at your code and it compiles with no problem with me.

If you want to style your commands like your setadmin (CMDetadmin) then make sure to include zcmd and I'm not sure if you left it out on the pastebin, or if it wasn#t included but you also need to include a_samp.

Here is a link to the copy I compiled with no issues! - http://pastebin.com/V3KrqUbx

- Jordan
Reply
#8

It didnt work i'm still getting these errors:
Quote:

C:\Users\Nelson.Paulo2301-PC\Desktop\CnR.pwn(155) : warning 217: loose indentation
C:\Users\Nelson.Paulo2301-PC\Desktop\CnR.pwn(157) : warning 217: loose indentation
C:\Users\Nelson.Paulo2301-PC\Desktop\CnR.pwn(320) : warning 217: loose indentation
C:\Users\Nelson.Paulo2301-PC\Desktop\CnR.pwn(357) : warning 203: symbol is never used: "setadmin"
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


4 Warnings.

Reply
#9

Quote:
Originally Posted by JordanDoughty
View Post
Hello!

I have looked at your code and it compiles with no problem with me.

If you want to style your commands like your setadmin (CMDetadmin) then make sure to include zcmd and I'm not sure if you left it out on the pastebin, or if it wasn#t included but you also need to include a_samp.

Here is a link to the copy I compiled with no issues! - http://pastebin.com/V3KrqUbx

- Jordan
Yeah, it worked, i dont know what the problem was, most likely i wrote z_cmd and not zcmd, thanks for the help, i will now test it in-game.
Reply
#10

Quote:
Originally Posted by TheBoZ
View Post
It didnt work i'm still getting these errors:
Do you still get these? then fix them normally when your making a command
PHP Code:
CMD:Test(playerid,params){ 
And its says test has never been used its because u didnt include zcmd
PHP Code:
#include <zcmd> 
at the top of your script
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)