PDA

View Full Version : Help me in this stock [HELP]


Osamakurdi
20/02/2018, 12:08 PM
I have this stock
That shows who is online from admins:
stock ShowAdminsFor(playerid)
{
for(new i=0, j=GetPlayerPoolSize(); i<=j;i++)
{
if(PInfo[i][Adminlevel] > 1)
{
new str[180];
format(str, 180, "%s[%d]", GetPlayerNameEx(i), PInfo[i][Adminlevel]);
SendClientMessage(playerid, COLOR_YELLOW, str);
}

}
}

How I can say that if there is no one admins send a message with there is no admins?

solstice_
20/02/2018, 12:12 PM
stock ShowAdminsFor(playerid)
{
for(new i=0, j=GetPlayerPoolSize(); i<=j;i++)
{
if(PInfo[i][Adminlevel] > 1)
{
new str[180];
format(str, 180, "%s[%d]", GetPlayerNameEx(i), PInfo[i][Adminlevel]);
SendClientMessage(playerid, COLOR_YELLOW, str);
}
else
{
SendClientMessage(playerid, COLOR_YELLOW, "There is no administrators online.");
}

}
}

Osamakurdi
20/02/2018, 12:23 PM
stock ShowAdminsFor(playerid)
{
for(new i=0, j=GetPlayerPoolSize(); i<=j;i++)
{
if(PInfo[i][Adminlevel] > 1)
{
new str[180];
format(str, 180, "%s[%d]", GetPlayerNameEx(i), PInfo[i][Adminlevel]);
SendClientMessage(playerid, COLOR_YELLOW, str);
}
else
{
SendClientMessage(playerid, COLOR_YELLOW, "There is no administrators online.");
}

}
}
This won't work very well.
anyone else please.

solstice_
20/02/2018, 12:24 PM
This won't work very well.
anyone else please.

What does not work there?

AlexMSK
20/02/2018, 12:25 PM
http://forum.sa-mp.com/showthread.php?t=378426
try g00gling before you post, there are a lot useful threads around

Osamakurdi
20/02/2018, 12:26 PM
What does not work there?

First its should be this:
stock ShowAdminsFor(playerid)
{
for(new i=0, j=GetPlayerPoolSize(); i<=j;i++)
{
if(PInfo[i][Adminlevel] > 1)
{
new str[180];
format(str, 180, "%s[%d]", GetPlayerNameEx(i), PInfo[i][Adminlevel]);
SendClientMessage(playerid, COLOR_YELLOW, str);
}
else
{
return SendClientMessage(playerid, COLOR_YELLOW, "There is no administrators online.");
}

}
return 1;
}
second try this and it won't work
with u ar telling that if i < 1 u gonna send there is no admins online.

solstice_
20/02/2018, 12:27 PM
I am trying to help you and you're trying to be rude lmao learn scripting yourself then, fuck off.

Osamakurdi
20/02/2018, 12:30 PM
I am trying to help you and you're trying to be rude lmao learn scripting yourself then, fuck off.
;D:cool:

Mugala
20/02/2018, 12:35 PM
stock ShowAdminsFor(playerid)
{
new admins = 0;
for(new i=0, j=GetPlayerPoolSize(); i<=j;i++)
{
if(PInfo[i][Adminlevel] > 1)
{
new str[180];
format(str, 180, "%s[%d]", GetPlayerNameEx(i), PInfo[i][Adminlevel]);
SendClientMessage(playerid, COLOR_YELLOW, str);
admins ++;
}
}
if(admins < 1) SendClientMessage(playerid,-1,"No Admins online");
}

Osamakurdi
20/02/2018, 12:53 PM
stock ShowAdminsFor(playerid)
{
new admins = 0;
for(new i=0, j=GetPlayerPoolSize(); i<=j;i++)
{
if(PInfo[i][Adminlevel] > 1)
{
new str[180];
format(str, 180, "%s[%d]", GetPlayerNameEx(i), PInfo[i][Adminlevel]);
SendClientMessage(playerid, COLOR_YELLOW, str);
admins ++;
}
}
if(admins < 1) SendClientMessage(playerid,-1,"No Admins online");
}

This !
+REP

RedFusion
20/02/2018, 08:24 PM
I suggest you check if the player ID (i) is connected too.
You're only checking for their admin level.

Example:

IsPlayerConnected(i) && PInfo[i][Adminlevel] > 1