06.07.2012, 11:36
Why not make it easier for yourself?
Create an enum:
Then set the level when the player connects (I created a stock in my script to do that)
Then whenever you check if the player is high enough level:
Create an enum:
pawn Код:
enum playerdata
{
adminlevel
}
new PlayerInfo[MAX_PLAYERS][playerdata];
pawn Код:
stock SetLevel(playerid)
{
new query[200], level;
format(query, sizeof(query), "SELECT adminlevel FROM `playerdata` WHERE user ='%s'", GetName(playerid));
mysql_query(query);
mysql_store_result();
level = mysql_fetch_int(); // This gets the adminlevel and sets it into the variable
mysql_free_result();
PlayerInfo[playerid][adminlevel] = level; // Set adminlevel to the level that was stored inside the variable
return 1;
}
pawn Код:
public OnPlayerConnect
{
SetLevel(playerid);
return 1;
}
pawn Код:
if(PlayerInfo[playerid][adminlevel] > 2)
{
// Add code here...
}