Problem with Command -
Dark Crow - 24.06.2012
I have a prolem with these two command
Код:
//===============================================ADMINI================================================================
CMD:admins(playerid, params[])
{
#pragma unused params
new string[1024];
new sendername[MAX_PLAYER_NAME];
if(IsPlayerConnected(playerid))
{
SendClientMessage(playerid, COLOR_LIGHTBLUE, "|_________DarkLife Administrators™_________|");
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if(PlayerInfo[i][pAdmin] == 1)
{
if(AdminDuty[playerid] == 1)
{
GetPlayerName(i, sendername, sizeof(sendername));
format(string, 256, "Administrator: %s | Level: 1 | {37F906}On Duty", sendername);
SendClientMessage(playerid, COLOR_WHITE, string);
}
else if(AdminDuty[playerid] == 0)
{
GetPlayerName(i, sendername, sizeof(sendername));
format(string, 256, "Administrator: %s | Level: 1 | {F81414}Off Duty", sendername);
SendClientMessage(playerid, COLOR_WHITE, string);
}
}
if(PlayerInfo[i][pAdmin] == 2)
{
if(AdminDuty[playerid] == 1)
{
GetPlayerName(i, sendername, sizeof(sendername));
format(string, 256, "Administrator: %s | Level: 2 | {37F906}On Duty", sendername);
SendClientMessage(playerid, COLOR_WHITE, string);
}
else if(AdminDuty[playerid] == 0)
{
GetPlayerName(i, sendername, sizeof(sendername));
format(string, 256, "Administrator: %s | Level: 2 | {F81414}Off Duty", sendername);
SendClientMessage(playerid, COLOR_WHITE, string);
}
}
if(PlayerInfo[i][pAdmin] == 3)
{
if(AdminDuty[playerid] == 1)
{
GetPlayerName(i, sendername, sizeof(sendername));
format(string, 256, "Administrator: %s | Level: 3 | {37F906}On Duty", sendername);
SendClientMessage(playerid, COLOR_WHITE, string);
}
else if(AdminDuty[playerid] == 0)
{
GetPlayerName(i, sendername, sizeof(sendername));
format(string, 256, "Administrator: %s | Level: 3 | {F81414}Off Duty", sendername);
SendClientMessage(playerid, COLOR_WHITE, string);
}
}
if(PlayerInfo[i][pAdmin] == 4)
{
if(AdminDuty[playerid] == 1)
{
GetPlayerName(i, sendername, sizeof(sendername));
format(string, 256, "Administrator: %s | Level: 4 | {37F906}On Duty", sendername);
SendClientMessage(playerid, COLOR_WHITE, string);
}
else if(AdminDuty[playerid] == 0)
{
GetPlayerName(i, sendername, sizeof(sendername));
format(string, 256, "Administrator: %s | Level: 4 | {F81414}Off Duty", sendername);
SendClientMessage(playerid, COLOR_WHITE, string);
}
}
if(PlayerInfo[i][pAdmin] == 5)
{
if(AdminDuty[playerid] == 1)
{
GetPlayerName(i, sendername, sizeof(sendername));
format(string, 256, "Admin za Lideri: %s | Level: 5 | {37F906}On Duty", sendername);
SendClientMessage(playerid, COLOR_WHITE, string);
}
else
{
GetPlayerName(i, sendername, sizeof(sendername));
format(string, 256, "Admin za Lideri: %s | Level: 5 | {F81414}Off Duty", sendername);
SendClientMessage(playerid, COLOR_WHITE, string);
}
}
if(PlayerInfo[i][pAdmin] == 1337)
{
if(AdminDuty[playerid] == 1)
{
GetPlayerName(i, sendername, sizeof(sendername));
format(string, 256, "Z.HeadAdmin: %s | {37F906}On Duty", sendername);
SendClientMessage(playerid, COLOR_WHITE, string);
}
else
{
GetPlayerName(i, sendername, sizeof(sendername));
format(string, 256, "Z.HeadAdmin: %s | {F81414}Off Duty", sendername);
SendClientMessage(playerid, COLOR_WHITE, string);
}
}
}
}
}
return 1;
}
Код:
//==================================GAMEMASTERI====================================================================
CMD:gamemasteri(playerid, params[])
{
#pragma unused params
new string[1024];
new sendername[MAX_PLAYER_NAME];
if(IsPlayerConnected(playerid))
{
SendClientMessage(playerid, COLOR_LIGHTBLUE, "|_________DarkLife GameMasters™_________|");
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if(PlayerInfo[i][pGm] == 1 && PlayerInfo[i][pGm] == 1)
{
if(GmDuty[playerid] == 1)
{
GetPlayerName(i, sendername, sizeof(sendername));
format(string, 256, "GameMaster: {FFFFFF}%s | Level: {FFFFFF}1 | {37F906}On Duty", sendername);
SendClientMessage(playerid, COLOR_WHITE, string);
}
else if(GmDuty[playerid] == 0)
{
GetPlayerName(i, sendername, sizeof(sendername));
format(string, 256, "GameMaster: {FFFFFF}%s | Level: 1 |{F81414}Off Duty", sendername);
SendClientMessage(playerid, COLOR_WHITE, string);
}
}
if(PlayerInfo[i][pGm] == 2 && PlayerInfo[i][pGm] == 2)
{
if(GmDuty[playerid] == 1)
{
GetPlayerName(i, sendername, sizeof(sendername));
format(string, 256, "GameMaster: {FFFFFF}%s | Level: {FFFFFF}2 | {37F906}On Duty", sendername);
SendClientMessage(playerid, COLOR_WHITE, string);
}
else if(GmDuty[playerid] == 0)
{
GetPlayerName(i, sendername, sizeof(sendername));
format(string, 256, "GameMaster: {FFFFFF}%s | Level: {FFFFFF}2 | {F81414}Off Duty", sendername);
SendClientMessage(playerid, COLOR_WHITE, string);
}
}
if(PlayerInfo[i][pGm] == 3 && PlayerInfo[i][pGm] == 3)
{
if(GmDuty[playerid] == 1)
{
GetPlayerName(i, sendername, sizeof(sendername));
format(string, 256, "GameMaster: {FFFFFF}%s | Level: {FFFFFF}3 | {37F906}On Duty", sendername);
SendClientMessage(playerid, COLOR_WHITE, string);
}
else if(GmDuty[playerid] == 0)
{
GetPlayerName(i, sendername, sizeof(sendername));
format(string, 256, "GameMaster: {FFFFFF}%s | Level: {FFFFFF}3 | {F81414}Off Duty", sendername);
SendClientMessage(playerid, COLOR_WHITE, string);
}
}
if(PlayerInfo[i][pGm] == 4 && PlayerInfo[i][pGm] == 4)
{
if(GmDuty[playerid] == 1)
{
GetPlayerName(i, sendername, sizeof(sendername));
format(string, 256, "GameMaster: {FFFFFF}%s | Level: {FFFFFF}1 | {37F906}On Duty", sendername);
SendClientMessage(playerid, COLOR_WHITE, string);
}
else if(GmDuty[playerid] == 0)
{
GetPlayerName(i, sendername, sizeof(sendername));
format(string, 256, "GameMaster: {FFFFFF}%s | {00C0FF}Level: {FFFFFF}4 | {F81414}Off Duty", sendername);
SendClientMessage(playerid, COLOR_WHITE, string);
}
}
}
}
}
return 1;
}
When an Admin or Gamemaster goes On Duty, when i type /admins it shows only that he is Off Duty but when the player that is the GameMaster/Admin the one who went On Duty types /admins it works for him How can i fix it?
Re: Problem with Command -
Grand_Micha - 24.06.2012
if(GmDuty[i] == 1)
You are checking if the player is on duty. You have to check if THE i IS ON DUTY, and not playerid.
Re: Problem with Command -
JaKe Elite - 24.06.2012
you are wrong at this part
pawn Код:
if(GmDuty[playerid] == 1)
else if(GmDuty[playerid] == 0)
it must be like this
pawn Код:
if(GmDuty[i] == 1)
else if(GmDuty[i] == 0)
Re: Problem with Command -
Dark Crow - 24.06.2012
tnx very much fixed it