PDA

View Full Version : Small thing for Ladmin.


Biess
25/08/2012, 11:18 AM
Alright i got a question,
How do i make it so if a player name is connected IG Example Kane_Williams and his name will appear as Owner
In the /admins list.

dcmd_admins(playerid,params[]) {
#pragma unused params
new Count[2], i, string[128];
for(i = 0; i < MAX_PLAYERS; i++) if(IsPlayerConnected(i))
{
if(PlayerInfo[i][Level] > 0) Count[0]++;
if(IsPlayerAdmin(i)) Count[1]++;
}

#if defined HIDE_ADMINS
if(PlayerInfo[playerid][Level] == 0) {
if(Count[0] >= 1) {
format(string, sizeof(string), "There are %d Administrators online. Use /report <id> <reason> if you suspect a player of cheating", Count[0]);
return SendClientMessage(playerid, blue, string);
} else return SendClientMessage(playerid, blue, "No Administrators online");
}
#endif

if( (Count[0] == 0 && Count[1] == 0) || (Count[0] == 0 && Count[1] >= 1 && PlayerInfo[playerid][Level] == 0) ) return SendClientMessage(playerid, blue, "No Administrators online");

if(Count[0] == 1) {
for(i = 0; i < MAX_PLAYERS; i++) if(IsPlayerConnected(i) && PlayerInfo[i][Level] > 0) {
format(string, sizeof(string), "Admin: (%d)%s [%d]", i, PlayerName2(i), PlayerInfo[i][Level] ); SendClientMessage(playerid, blue, string);
}
}

if(Count[0] > 1) {
new x; format(string, sizeof(string), "Admins: ");
for(i = 0; i < MAX_PLAYERS; i++) if(IsPlayerConnected(i) && PlayerInfo[i][Level] > 0)
{
format(string,sizeof(string),"%s(%d)%s [%d]",string,i,PlayerName2(i),PlayerInfo[i][Level]);
x++;
if(x >= 5) {
SendClientMessage(playerid, blue, string); format(string, sizeof(string), "Admins: "); x = 0;
}
else format(string, sizeof(string), "%s, ", string);
}
if(x <= 4 && x > 0) {
string[strlen(string)-3] = '.';
SendClientMessage(playerid, blue, string);
}
}

if( (Count[1] == 1) && (PlayerInfo[playerid][Level] > 0) ) {
for(i = 0; i < MAX_PLAYERS; i++) if(IsPlayerConnected(i) && IsPlayerAdmin(i)) {
format(string, sizeof(string), "RCON Admin: (%d)%s", i, PlayerName2(i)); SendClientMessage(playerid, COLOR_WHITE, string);
}
}
if(Count[1] > 1) {
new x; format(string, sizeof(string), "RCON Admins: ");
for(i = 0; i < MAX_PLAYERS; i++) if(IsPlayerConnected(i) && IsPlayerAdmin(i))
{
format(string,sizeof(string),"%s(%d)%s",string,i,PlayerName2(i));
x++;
if(x >= 5) {
SendClientMessage(playerid, COLOR_WHITE, string); format(string, sizeof(string), "RCON Admins: "); x = 0;
}
else format(string, sizeof(string), "%s, ", string);
}
if(x <= 4 && x > 0) {
string[strlen(string)-3] = '.';
SendClientMessage(playerid, COLOR_WHITE, string);
}
}
return 1;
}

Duck
25/08/2012, 11:50 AM
Just rename RCON Admin to Owner.

Biess
25/08/2012, 11:53 AM
Just rename RCON Admin to Owner.

I dont want to use the Rcon rank really.

DeadLy™
25/08/2012, 12:08 PM
Dude, You have to use for server requirements! :)

Kaperstone
25/08/2012, 12:17 PM
add this under the close bracket of the rcon thingy.
if( (Count[1] == 1) && (PlayerInfo[playerid][Level] > OWNERLEVEL) ) { // change OWNERLEVEL with the current owner level.
for(i = 0; i < MAX_PLAYERS; i++) if(IsPlayerConnected(i)) {
format(string, sizeof(string), "Owner: (%d)%s", i, PlayerName2(i));
SendClientMessage(playerid, COLOR_WHITE, string);
}
}
btw next time post this in scripting help section -
http://forum.sa-mp.com/forumdisplay.php?f=12

Biess
25/08/2012, 01:01 PM
add this under the close bracket of the rcon thingy.
if( (Count[1] == 1) && (PlayerInfo[playerid][Level] > OWNERLEVEL) ) { // change OWNERLEVEL with the current owner level.
for(i = 0; i < MAX_PLAYERS; i++) if(IsPlayerConnected(i)) {
format(string, sizeof(string), "Owner: (%d)%s", i, PlayerName2(i));
SendClientMessage(playerid, COLOR_WHITE, string);
}
}
btw next time post this in scripting help section -
http://forum.sa-mp.com/forumdisplay.php?f=12

Sorry and these errors/warnings

C:\Users\Bichan\Desktop\UKTDM\filterscripts\ladmin 4v2.pwn(3100) : warning 217: loose indentation
C:\Users\Bichan\Desktop\UKTDM\filterscripts\ladmin 4v2.pwn(3106) : warning 217: loose indentation
C:\Users\Bichan\Desktop\UKTDM\filterscripts\ladmin 4v2.pwn(3106) : error 017: undefined symbol "x"
C:\Users\Bichan\Desktop\UKTDM\filterscripts\ladmin 4v2.pwn(3110) : warning 209: function "dcmd_admins" should return a value
C:\Users\Bichan\Desktop\UKTDM\filterscripts\ladmin 4v2.pwn(3111) : error 010: invalid function or declaration
Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase


2 Errors.

Kaperstone
25/08/2012, 01:12 PM
Sorry and these errors/warnings

C:\Users\Bichan\Desktop\UKTDM\filterscripts\ladmin 4v2.pwn(3100) : warning 217: loose indentation
C:\Users\Bichan\Desktop\UKTDM\filterscripts\ladmin 4v2.pwn(3106) : warning 217: loose indentation
C:\Users\Bichan\Desktop\UKTDM\filterscripts\ladmin 4v2.pwn(3106) : error 017: undefined symbol "x"
C:\Users\Bichan\Desktop\UKTDM\filterscripts\ladmin 4v2.pwn(3110) : warning 209: function "dcmd_admins" should return a value
C:\Users\Bichan\Desktop\UKTDM\filterscripts\ladmin 4v2.pwn(3111) : error 010: invalid function or declaration
Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase


2 Errors.

at the end of the command should be -

return 1;
}
the script should look like this -
dcmd_admins(playerid,params[]) {
#pragma unused params
new Count[2], i, string[128];
for(i = 0; i < MAX_PLAYERS; i++) if(IsPlayerConnected(i))
{
if(PlayerInfo[i][Level] > 0) Count[0]++;
if(IsPlayerAdmin(i)) Count[1]++;
}

#if defined HIDE_ADMINS
if(PlayerInfo[playerid][Level] == 0) {
if(Count[0] >= 1) {
format(string, sizeof(string), "There are %d Administrators online. Use /report <id> <reason> if you suspect a player of cheating", Count[0]);
return SendClientMessage(playerid, blue, string);
} else return SendClientMessage(playerid, blue, "No Administrators online");
}
#endif

if( (Count[0] == 0 && Count[1] == 0) || (Count[0] == 0 && Count[1] >= 1 && PlayerInfo[playerid][Level] == 0) ) return SendClientMessage(playerid, blue, "No Administrators online");

if(Count[0] == 1) {
for(i = 0; i < MAX_PLAYERS; i++) if(IsPlayerConnected(i) && PlayerInfo[i][Level] > 0) {
format(string, sizeof(string), "Admin: (%d)%s [%d]", i, PlayerName2(i), PlayerInfo[i][Level] ); SendClientMessage(playerid, blue, string);
}
}

if(Count[0] > 1) {
new x; format(string, sizeof(string), "Admins: ");
for(i = 0; i < MAX_PLAYERS; i++) if(IsPlayerConnected(i) && PlayerInfo[i][Level] > 0)
{
format(string,sizeof(string),"%s(%d)%s [%d]",string,i,PlayerName2(i),PlayerInfo[i][Level]);
x++;
if(x >= 5) {
SendClientMessage(playerid, blue, string); format(string, sizeof(string), "Admins: "); x = 0;
}
else format(string, sizeof(string), "%s, ", string);
}
if(x <= 4 && x > 0) {
string[strlen(string)-3] = '.';
SendClientMessage(playerid, blue, string);
}
}

if( (Count[1] == 1) && (PlayerInfo[playerid][Level] > 0) ) {
for(i = 0; i < MAX_PLAYERS; i++) if(IsPlayerConnected(i) && IsPlayerAdmin(i)) {
format(string, sizeof(string), "RCON Admin: (%d)%s", i, PlayerName2(i)); SendClientMessage(playerid, COLOR_WHITE, string);
}
}
if( (Count[1] == 1) && (PlayerInfo[playerid][Level] > OWNERLEVEL) ) { // change OWNERLEVEL with the current owner level.
for(i = 0; i < MAX_PLAYERS; i++) if(IsPlayerConnected(i)) {
format(string, sizeof(string), "Owner: (%d)%s", i, PlayerName2(i));
SendClientMessage(playerid, COLOR_WHITE, string);
}
}
if(Count[1] > 1) {
new x; format(string, sizeof(string), "RCON Admins: ");
for(i = 0; i < MAX_PLAYERS; i++) if(IsPlayerConnected(i) && IsPlayerAdmin(i))
{
format(string,sizeof(string),"%s(%d)%s",string,i,PlayerName2(i));
x++;
if(x >= 5) {
SendClientMessage(playerid, COLOR_WHITE, string); format(string, sizeof(string), "RCON Admins: "); x = 0;
}
else format(string, sizeof(string), "%s, ", string);
}
if(x <= 4 && x > 0) {
string[strlen(string)-3] = '.';
SendClientMessage(playerid, COLOR_WHITE, string);
}
}
return 1;
}

Biess
25/08/2012, 01:17 PM
at the end of the command should be -

return 1;
}
the script should look like this -
dcmd_admins(playerid,params[]) {
#pragma unused params
new Count[2], i, string[128];
for(i = 0; i < MAX_PLAYERS; i++) if(IsPlayerConnected(i))
{
if(PlayerInfo[i][Level] > 0) Count[0]++;
if(IsPlayerAdmin(i)) Count[1]++;
}

#if defined HIDE_ADMINS
if(PlayerInfo[playerid][Level] == 0) {
if(Count[0] >= 1) {
format(string, sizeof(string), "There are %d Administrators online. Use /report <id> <reason> if you suspect a player of cheating", Count[0]);
return SendClientMessage(playerid, blue, string);
} else return SendClientMessage(playerid, blue, "No Administrators online");
}
#endif

if( (Count[0] == 0 && Count[1] == 0) || (Count[0] == 0 && Count[1] >= 1 && PlayerInfo[playerid][Level] == 0) ) return SendClientMessage(playerid, blue, "No Administrators online");

if(Count[0] == 1) {
for(i = 0; i < MAX_PLAYERS; i++) if(IsPlayerConnected(i) && PlayerInfo[i][Level] > 0) {
format(string, sizeof(string), "Admin: (%d)%s [%d]", i, PlayerName2(i), PlayerInfo[i][Level] ); SendClientMessage(playerid, blue, string);
}
}

if(Count[0] > 1) {
new x; format(string, sizeof(string), "Admins: ");
for(i = 0; i < MAX_PLAYERS; i++) if(IsPlayerConnected(i) && PlayerInfo[i][Level] > 0)
{
format(string,sizeof(string),"%s(%d)%s [%d]",string,i,PlayerName2(i),PlayerInfo[i][Level]);
x++;
if(x >= 5) {
SendClientMessage(playerid, blue, string); format(string, sizeof(string), "Admins: "); x = 0;
}
else format(string, sizeof(string), "%s, ", string);
}
if(x <= 4 && x > 0) {
string[strlen(string)-3] = '.';
SendClientMessage(playerid, blue, string);
}
}

if( (Count[1] == 1) && (PlayerInfo[playerid][Level] > 0) ) {
for(i = 0; i < MAX_PLAYERS; i++) if(IsPlayerConnected(i) && IsPlayerAdmin(i)) {
format(string, sizeof(string), "RCON Admin: (%d)%s", i, PlayerName2(i)); SendClientMessage(playerid, COLOR_WHITE, string);
}
}
if( (Count[1] == 1) && (PlayerInfo[playerid][Level] > OWNERLEVEL) ) { // change OWNERLEVEL with the current owner level.
for(i = 0; i < MAX_PLAYERS; i++) if(IsPlayerConnected(i)) {
format(string, sizeof(string), "Owner: (%d)%s", i, PlayerName2(i));
SendClientMessage(playerid, COLOR_WHITE, string);
}
}
if(Count[1] > 1) {
new x; format(string, sizeof(string), "RCON Admins: ");
for(i = 0; i < MAX_PLAYERS; i++) if(IsPlayerConnected(i) && IsPlayerAdmin(i))
{
format(string,sizeof(string),"%s(%d)%s",string,i,PlayerName2(i));
x++;
if(x >= 5) {
SendClientMessage(playerid, COLOR_WHITE, string); format(string, sizeof(string), "RCON Admins: "); x = 0;
}
else format(string, sizeof(string), "%s, ", string);
}
if(x <= 4 && x > 0) {
string[strlen(string)-3] = '.';
SendClientMessage(playerid, COLOR_WHITE, string);
}
}
return 1;
}

No errors, nor warnings. but it doesn't work

clarencecuzz
25/08/2012, 01:52 PM
So what are you asking for? You want to change it so the admin rank is called 'Owner'?
Or if a player has the name 'Kane_Williams', then he will show up as owner?

Lordzy
25/08/2012, 01:57 PM
So what are you asking for? You want to change it so the admin rank is called 'Owner'?
Or if a player has the name 'Kane_Williams', then he will show up as owner?


If im not wrong,
He/she might be asking for Owner rank in admin list.
Just like LuxAdmin,there are rank wise for each level.
Here he/she might need that.
Example:

Online Admins
Kane_Williams[Lv:10] Owner

Biess
25/08/2012, 02:00 PM
Lordz;2078764']If im not wrong,
He/she might be asking for Owner rank in admin list.
Just like LuxAdmin,there are rank wise for each level.
Here he/she might need that.
Example:

Online Admins
Kane_Williams[Lv:10] Owner


Yes but, i dont want that all people with rank 7 ((Highest admin rank)) have the title Owner:
Only the person that have specific names Example Kane_Williams

clarencecuzz
25/08/2012, 02:13 PM
new pname[MAX_PLAYER_NAME];
GetPlayerName(playerid, pname, MAX_PLAYER_NAME);
if(strcmp(pname, "Kane_Williams", false) == 0)
{

Something like this?

Biess
25/08/2012, 02:58 PM
new pname[MAX_PLAYER_NAME];
GetPlayerName(playerid, pname, MAX_PLAYER_NAME);
if(strcmp(pname, "Kane_Williams", false) == 0)
{

Something like this?

Can you add it in the code where i have to add it?

clarencecuzz
25/08/2012, 03:11 PM
I doubt it. That code is confusing as shit.

Biess
25/08/2012, 03:20 PM
I doubt it. That code is confusing as shit.

It is.. awaiting for further replies:)