[Help] Player Command - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: [Help] Player Command (
/showthread.php?tid=661089)
[Help] Player Command -
ApolloScripter - 21.11.2018
Someone know why it does't working?, he compiles, but ingame it just do not work
PHP код:
CMD:adminlist(playerid, params[])
{
new nomeadmintrabalho[MAX_PLAYER_NAME];
new nomeadminjogo[MAX_PLAYER_NAME];
new admlevel;
new admtrabalhando;
new count = 0;
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if((IsPlayerAdmin(i)) && (GetPlayerAdminLevel(i) >= 2))
{
GetPlayerName(i, nomeadmintrabalho, sizeof(nomeadmintrabalho));
GetPlayerAdminLevel(i);
if(IsPlayerOnAdminDuty(i))
{
admtrabalhando = 1;
}
else
{
admtrabalhando = 2;
}
new rank[24];
new checagem[50];
switch(admlevel)
{
case 1: rank = "Ajudante";
case 2: rank = "Admin 1";
case 3: rank = "Admin 2";
case 4: rank = "Admin 3";
case 5: rank = "Admin Master";
case 6: rank = "CEO Servidor";
}
switch(admtrabalhando)
{
case 1: checagem = "Trabalhando";
case 2: checagem = "Jogador";
}
new str[1000];
format(str, sizeof(str), "[%s] %s (%s)", rank, nomeadmintrabalho, checagem);
SendClientMessage(playerid, -1, str);
count++;
}
}
}
return 1;
}
Re: [Help] Player Command -
d3Pedro - 21.11.2018
pawn Код:
CMD:adminlist(playerid, params[])
{
new nomeadmintrabalho[MAX_PLAYER_NAME];
new nomeadminjogo[MAX_PLAYER_NAME];
new count = 0;
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if((IsPlayerAdmin(i)) && (GetPlayerAdminLevel(i) >= 2))
{
GetPlayerName(i, nomeadmintrabalho, sizeof(nomeadmintrabalho));
new rank[24];
new checagem[50];
switch(GetPlayerAdminLevel(i))
{
case 1: rank = "Ajudante";
case 2: rank = "Admin 1";
case 3: rank = "Admin 2";
case 4: rank = "Admin 3";
case 5: rank = "Admin Master";
case 6: rank = "CEO Servidor";
}
switch(IsPlayerOnAdminDuty(i))
{
case 1: checagem = "Trabalhando";
case 2: checagem = "Jogador";
}
new str[1000];
format(str, sizeof(str), "[%s] %s (%s)", rank, nomeadmintrabalho, checagem);
SendClientMessage(playerid, -1, str);
count++;
}
}
}
return 1;
}
Can you please provide IsPlayerOnAdminDuty and GetPlayerAdminLevel code, i just want to make sure i didn't do it wrong.
Also what have you used
for?
Re: [Help] Player Command -
ApolloScripter - 21.11.2018
Here:
PHP код:
stock IsPlayerOnAdminDuty(playerid)
{
if(!IsPlayerConnected(playerid))
return 0;
return admin_OnDuty[playerid];
}
And:
PHP код:
stock GetPlayerAdminLevel(playerid)
{
if(!IsPlayerConnected(playerid))
return 0;
return admin_Level[playerid];
}
I had made a count to indicate when there are no admins online, but I did not and forgot to remove the "count ++"
Re: [Help] Player Command -
d3Pedro - 21.11.2018
Try the command i provided, also you just need to use that count++ before you send the client message and then you do
pawn Код:
if(count == 0)
{
return SendClientMessage(playerid, -1, "There's no admin online at the moment.");
}
else
{
new str[1000];
format(str, sizeof(str), "[%s] %s (%s)", rank, nomeadmintrabalho, checagem);
SendClientMessage(playerid, -1, str);
count = 0; //we set this back to 0 so it won't duplicate the value next /adminlist usage.
}
Re: [Help] Player Command -
ApolloScripter - 22.11.2018
It doesn't works, i put the command and just nothing happens