help -
pozitiv4eg - 05.12.2013
Hello everyone. Help solve the problem.
The first code works, the second does not show the player's name. What's the problem?
Using GetPlayerName gave no results
PHP код:
CMD:admins(playerid, params[]){
if(PlayerLogged[playerid] == 0) return true;
if(PlayerInfo[playerid][pAdmin] > 0 || PlayerInfo[playerid][pVIP] == true)
{
new str[256],full = 0;
SendClientMessage(playerid, COLOR_BLUE, "Àäìèíèñòðàöèÿ â ñåòè:");
foreach(new i:Player)
{
if(!IsPlayerConnected(i) || PlayerLogged[i] == 0) continue;
if(PlayerInfo[i][pAdmin] > 0)
{
new admrank[70];
if(PlayerInfo[i][pAdmin] == 1){format(admrank,70,"{FF0000}» {0000ff}Ìë.Àäìèíèñòðàòîð");}
else if(PlayerInfo[i][pAdmin] == 2){format(admrank,70,"{FF0000}» {735184}Àäìèíèñòðàòîð");}
else if(PlayerInfo[i][pAdmin] == 3){format(admrank,70,"{FF0000}» {660099}Ñò.Àäìèíèñòðàòîð");}
else if(PlayerInfo[i][pAdmin] == 4){format(admrank,70,"{FF0000}» {997a8d}Çàì.Ãë.Àäìèíèñòðàòîðà");}
else if(PlayerInfo[i][pAdmin] == 5){format(admrank,70,"{FF0000}» {d53e07}Ãë.Àäìèíèñòðàòîð");}
else if(PlayerInfo[i][pAdmin] == 6){format(admrank,70,"{FF0000}» {FF0000}Ðóêîâîäèòåëü Ïðîåêòà");}
else if(PlayerInfo[i][pAdmin] == 7){format(admrank,70,"{FF0000}» {000000}Developer");}
full++;
format(str,sizeof(str),"%s [ID: %d] - %s\n",PlayerInfo[i][pSendername],i,admrank);
SendClientMessage(playerid, COLOR_WHITE, str);
}
}
if(full == 0) SendClientMessage(playerid, COLOR_WHITE, "Àäìèíèñòðàòîðîâ íåò â ñåòè!");
}
else SendClientMessage(playerid, COLOR_GREY, YouCanNot);
return true;}
PHP код:
CMD:members(playerid, params[]){
if(PlayerLogged[playerid] == 0) return 1;
if(PlayerInfo[playerid][pMember] == 0) return SendClientMessage(playerid, COLOR_GREY, YouCanNot);
SendClientMessage(playerid, 0x33AAFFFF, "×ëåíû îðãàíèçàöèè â ñåòè:");
foreach(new i:Player)
{
if(!IsPlayerConnected(i) || PlayerLogged[i] == 0) continue;
if(PlayerInfo[i][pMember] == PlayerInfo[playerid][pMember]) SendMes(playerid, COLOR_WHITE, "%s » {66ff00}%s",PlayerInfo[i][pSendername], FracRank[PlayerInfo[i][pMember]][PlayerInfo[i][pRank]]);
}
return 1;}
Re: help -
Threshold - 05.12.2013
Try this:
pawn Код:
CMD:admins(playerid, params[])
{
if(PlayerLogged[playerid] == 0) return 1;
if(PlayerInfo[playerid][pAdmin] < 1 && PlayerInfo[playerid][pVIP] == false) return SendClientMessage(playerid, COLOR_GREY, YouCanNot); //I don't know if YouCanNot is defined or not...
new str[100], full = 0;
SendClientMessage(playerid, COLOR_BLUE, "Администрация в сети:");
foreach(new i : Player)
{
if(!IsPlayerConnected(i) || PlayerLogged[i] == 0) continue;
if(PlayerInfo[i][pAdmin] < 1) continue;
new admrank[32];
switch(PlayerInfo[i][pAdmin])
{
case 1: format(admrank,32,"» {0000ff}Мл.Администратор");
case 2: format(admrank,32,"» {735184}Администратор");
case 3: format(admrank,32,"» {660099}Ст.Администратор");
case 4: format(admrank,32,"» {997a8d}Зам.Гл.Администратора");
case 5: format(admrank,32,"» {d53e07}Гл.Администратор");
case 6: format(admrank,32,"» {FF0000}Руководитель Проекта");
case 7: format(admrank,32,"» {000000}Developer");
}
full++;
format(str,sizeof(str),"%s [ID: %d] - {FF0000}%s",PlayerInfo[i][pSendername],i,admrank);
SendClientMessage(playerid, COLOR_WHITE, str);
}
if(full == 0) SendClientMessage(playerid, COLOR_WHITE, "Администраторов нет в сети!");
return true;
}
CMD:members(playerid, params[])
{
if(PlayerLogged[playerid] == 0) return 1;
if(PlayerInfo[playerid][pMember] == 0) return SendClientMessage(playerid, COLOR_GREY, YouCanNot);
SendClientMessage(playerid, 0x33AAFFFF, "Члены организации в сети:");
foreach(new i : Player)
{
if(!IsPlayerConnected(i) || PlayerLogged[i] == 0) continue;
if(PlayerInfo[i][pMember] == PlayerInfo[playerid][pMember])
{
new fstr[150], name[24];
GetPlayerName(i, name, MAX_PLAYER_NAME);
format(fstr, sizeof(fstr),"%s » {66FF00}%s", name, FracRank[PlayerInfo[i][pMember]][PlayerInfo[i][pRank]]);
SendClientMessage(playerid, COLOR_WHITE, fstr);
}
}
return 1;
}
If this doesn't work the way you want it to, please show me your 'SendMes' function.
Re: help -
pozitiv4eg - 05.12.2013
PHP код:
stock SendMes(playerid, color, fstring[], {Float, _}:...)
{
static const
STATIC_ARGS = 3;
new
n = (numargs() - STATIC_ARGS) * BYTES_PER_CELL;
if (n)
{
new
message[128],
arg_start,
arg_end;
#emit CONST.alt fstring
#emit LCTRL 5
#emit ADD
#emit STOR.S.pri arg_start
#emit LOAD.S.alt n
#emit ADD
#emit STOR.S.pri arg_end
do
{
#emit LOAD.I
#emit PUSH.pri
arg_end -= BYTES_PER_CELL;
#emit LOAD.S.pri arg_end
}
while (arg_end > arg_start);
// Push the static format parameters.
#emit PUSH.S fstring
#emit PUSH.C 128
#emit PUSH.ADR message
n += BYTES_PER_CELL * 3;
#emit PUSH.S n
#emit SYSREQ.C format
n += BYTES_PER_CELL;
#emit LCTRL 4
#emit LOAD.S.alt n
#emit ADD
#emit SCTRL 4
return SendClientMessage(playerid, color, message);
}
else
{
return SendClientMessage(playerid, color, fstring);
}
}