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!");
}
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;
}
|
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 |
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 > 6 || admlvl < 0) return SendClientMessage(playerid, COLOR_RED,"[SYSTEM]: Valid Admin Levels: 1-6!");
PlayerInfo[id][pAdminLevel] = admlvl;
GetPlayerName(id, victimname, sizeof(victimname));
GetPlayerName(playerid, adminname, sizeof(adminname));
new str[128];
format(str,128,"[ADMIN] %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!");
return 1;
}
etadmin) 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.|
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. |
|
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 (CMD etadmin) 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 |
CMD:Test(playerid,params){
#include <zcmd>