Command admins -
dEcooR - 12.08.2013
Hello, i found big bug in my gm when i was played,some guy joined and hes automaticaly owner level 5.So its an bug but i dont understand where is it.A few days ago i saw against the guys was owners lol,lets see code.
I hope you got any idea whats the problem.
Код:
CMD:admins(playerid,params[])
{
if(IsPlayerConnected(playerid))
{
new bool:IsAnyAdminConnected = false,bigstring[700];
for(new i; i<MAX_PLAYERS; i++)
{
if(ISP(i) && IsPlayerSpawned(i) && GetPVarInt(i, "Spawned") == 1)
{
if(!IsPlayerNPC(i))
{
if(IsPlayerAdmin(i) && pInfo[i][Admin] == 0)
{
format(g_string, sizeof(g_string), ""D"%s (%d) - "R"Owner\n",PlayerName(i),i);
strcat(bigstring, g_string);
SPD(playerid,D_ADMINS,0,"Administrators online",bigstring,"Close","");
IsAnyAdminConnected = true;
}
else if(pInfo[i][Admin] >= 1 && !IsPlayerAdmin(i))
{
format(g_string, sizeof(g_string), ""D"%s (%d) - %s\n",PlayerName(i),i,Level());
strcat(bigstring, g_string);
SPD(playerid,D_ADMINS,0,"Administrators online",bigstring,"Close","");
IsAnyAdminConnected = true;
}
else if(IsPlayerAdmin(i) && pInfo[i][Admin] >= 1)
{
format(g_string, sizeof(g_string), ""D"%s (%d) - "R"Owner\n",PlayerName(i),i);
strcat(bigstring, g_string);
SPD(playerid,D_ADMINS,0,"Administrators online",bigstring,"Close","");
IsAnyAdminConnected = true;
}
}
}
}
if(IsAnyAdminConnected == false) SPD(playerid,D_ADMINS,0,"Administrators",""D"No administrators online right.","Close","");
}
return 1;
}
Level()
{
new level[40];
for(new a; a<MAX_PLAYERS; a++)
{
if(ISP(a) && IsPlayerSpawned(a) && GetPVarInt(a, "Spawned") == 1)
{
if(!IsPlayerAdmin(a) && pInfo[a][Admin] >= 1)
{
switch(pInfo[a][Admin])
{
case 1: level = "{FFB500}Moderator Level 1";
case 2: level = ""B"Administrator Level 2";
case 3: level = ""G"Head Admin Level 3";
case 4: level = ""R"Co-Owner Level 4";
case 5: level = ""R"Owner Level 5";
}
}
}
}
return level;
}
Re: Command admins -
gtakillerIV - 12.08.2013
I guess you forgot to set the Admin level variable to 0 under OnPlayerDisconnect.
Without doing that what will happen is:
Player 1 joins ( Legit Admin ).
Player 1 leaves ( Without setting the Admin Variable to 0 ).
Player 2 Joins with the same id as Player 1. For ex: If Player 1 joined as ID 0, and then Player 2 joins and takes ID 0.
Player 2 will have the same ID as Player 1, thus the Admin Variable pFinfo had ID 0 set to Admin level 10 for example. So, Player 2 will have his Admin level set to 10 because he has the ID 0.
Re: Command admins -
dEcooR - 12.08.2013
Oh,it may to be ? i never used this onplayerconnect,so you got probably true lets try.
Ok dude lets say that you got my problem,can i ask how i should make an dialog when you click on player it will show next dialog..? do you understand me?
Re: Command admins -
gtakillerIV - 12.08.2013
Sorry, I meant OnPlayerDisconnect.
Re: Command admins -
dEcooR - 12.08.2013
Dude should i reset all that variables like money score etc? cuz i think money is bugged too lol .. i mean reset it after save to file..