public OnPlayerDisconnect(playerid, reason)
new INI:File = INI_Open(UserPath(playerid));
INI_SetTag(File, "PlayerData");
INI_WriteInt(File, "Password", PlayerInfo[playerid][Password]);
INI_WriteInt(File, "Admin", PlayerInfo[playerid][AdminLevel]);
INI_WriteInt(File, "Money", PlayerInfo[playerid][Money]);
INI_WriteInt(File, "Vip", PlayerInfo[playerid][VipLevel]);
INI_WriteInt(File, "Mechanic", PlayerInfo[playerid][Mechanic]);
INI_WriteInt(File, "SupportMember", PlayerInfo[playerid][SupportMember]);
INI_WriteInt(File, "Hitman", PlayerInfo[playerid][Hitman]);
INI_Close(File);
OnDialogResponse()
new INI:File = INI_Open(UserPath(playerid));
INI_SetTag(File, "PlayerData");
INI_WriteInt(File, "Password", udb_hash(inputtext));
INI_WriteInt(File, "Admin", 0);
INI_WriteInt(File, "Money", 0);
INI_WriteInt(File, "Vip", 0);
INI_WriteInt(File, "Mechanic", 0);
INI_WriteInt(File, "SupportMember", 0);
INI_WriteInt(File, "Hitman", 0);
INI_Close(File);
stock Register(name[])
{
new INI:File = INI_Open(name);
INI_SetTag(File, "PlayerData");
INI_WriteInt(File, "Password", 1);
INI_WriteInt(File, "Admin", 0);
INI_WriteInt(File, "Money", 0);
INI_WriteInt(File, "Vip", 0);
INI_WriteInt(File, "Mechanic", 0);
INI_WriteInt(File, "SupportMember", 0);
INI_WriteInt(File, "Hitman", 0);
INI_Close(File);
}
[PlayerData] Password = 1 Admin = 0 Money = 0 Vip = 0 Mechanic = 0 SupportMember = 0 Hitman = 0 |
stock Logout(name[])
{
new INI:File = INI_Open(name);
INI_SetTag(File, "PlayerData");
INI_WriteInt(File, "Password", 12);
INI_WriteInt(File, "Admin", 12);
INI_WriteInt(File, "Money", 12);
INI_WriteInt(File, "Vip", 12);
INI_WriteInt(File, "Mechanic", 12);
INI_WriteInt(File, "SupportMember", 23);
INI_WriteInt(File, "Hitman", 23);
INI_Close(File);
}
[PlayerData] Password = 12 Admin = 12 Money = 12 Vip = 12 Mechanic = 12 SupportMember = 23 Hitman = 23 |
stock SetAdmin(name[])
{
new INI:File = INI_Open(name);
//INI_SetTag(File, "PlayerData");
INI_WriteInt(File, "Password", 12);
INI_WriteInt(File, "Admin", 999);
INI_WriteInt(File, "Money", 12);
INI_WriteInt(File, "Vip", 12);
INI_WriteInt(File, "Mechanic", 12);
INI_WriteInt(File, "SupportMember", 23);
INI_WriteInt(File, "Hitman", 23);
INI_Close(File);
}
Password = 12 Admin = 999 Money = 12 Vip = 12 Mechanic = 12 SupportMember = 23 Hitman = 23 [PlayerData] Password = 12 Admin = 12 Money = 12 Vip = 12 Mechanic = 12 SupportMember = 23 Hitman = 23 |
CMD:setadmin(playerid, params[])
{
if(!IsPlayerAdmin(playerid)) return 0;
new targetplayer, string[150], Level;
if(sscanf(params, "ui", targetplayer, Level)) return SendClientMessage(playerid, COLOR_ORANGE, "Usage: /setadmin [ID] [Level 1-5]");
if(Level < 1 || Level > 5) return SendClientMessage(playerid, COLOR_RED, "Error: Available admin levels [1 - 5]");
if(!IsPlayerConnected(targetplayer)) return SendClientMessage(playerid, COLOR_RED, "Error: Player is not connected!");
if(PlayerInfo[targetplayer][AdminLevel] == Level) return SendClientMessage(playerid, COLOR_RED, "Error: The player is already this admin level.");
new INI:File = INI_Open(UserPath(targetplayer));
INI_WriteInt(File, "Admin", Level);
INI_Close(File);
if(Level == 1)
{
format(string, sizeof string, "You have been set to a Trial Moderator by %s.", PlayerName(playerid));
SendClientMessage(targetplayer, COLOR_LIGHTBLUE, string);
format(string, sizeof string, "You have set %s as a Trial Moderator.", PlayerName(targetplayer));
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
}
if(Level == 2)
{
format(string, sizeof string, "You have been set to a Moderator by %s.", PlayerName(playerid));
SendClientMessage(targetplayer, COLOR_YELLOW, string);
format(string, sizeof string, "You have set %s as a Moderator.", PlayerName(targetplayer));
SendClientMessage(playerid, COLOR_YELLOW, string);
}
if(Level == 3)
{
format(string, sizeof string, "You have been set to a General Administrator by %s.", PlayerName(playerid));
SendClientMessage(targetplayer, COLOR_GREEN, string);
format(string, sizeof string, "You have set %s as a General Administrator.", PlayerName(targetplayer));
SendClientMessage(playerid, COLOR_GREEN, string);
}
if(Level == 4)
{
format(string, sizeof string, "You have been set to a Co-Owner by %s.", PlayerName(playerid));
SendClientMessage(targetplayer, COLOR_ORANGE, string);
format(string, sizeof string, "You have set %s as a Co-Owner.", PlayerName(targetplayer));
SendClientMessage(playerid, COLOR_ORANGE, string);
}
if(Level == 5)
{
format(string, sizeof string, "You have been set to the server Owner by %s.", PlayerName(playerid));
SendClientMessage(targetplayer, COLOR_LEMON, string);
format(string, sizeof string, "You have set %s to the server Owner.", PlayerName(targetplayer));
SendClientMessage(playerid, COLOR_LEMON, string);
}
printf("[SETADMIN] %s has set %s as an admin ( %i )", PlayerName(playerid), PlayerName(targetplayer), Level);
PlayerInfo[targetplayer][AdminLevel] = Level;
return 1;
}
CMD:setadmin(playerid, params[])
{
if(!IsPlayerAdmin(playerid)) return 0;
new targetplayer, string[150], Level;
if(sscanf(params, "ui", targetplayer, Level)) return SendClientMessage(playerid, COLOR_ORANGE, "Usage: /setadmin [ID] [Level 1-5]");
if(Level < 1 || Level > 5) return SendClientMessage(playerid, COLOR_RED, "Error: Available admin levels [1 - 5]");
if(!IsPlayerConnected(targetplayer)) return SendClientMessage(playerid, COLOR_RED, "Error: Player is not connected!");
if(PlayerInfo[targetplayer][AdminLevel] == Level) return SendClientMessage(playerid, COLOR_RED, "Error: The player is already this admin level.");
new INI:File = INI_Open(UserPath(targetplayer));
INI_SetTag(File, "PlayerData"); //THIS IS THE FIX..
//You have forgotten this line in other commands too.. Like /setvip /setmechanic or w.e
INI_WriteInt(File, "Admin", Level);
INI_Close(File);
if(Level == 1)
{
format(string, sizeof string, "You have been set to a Trial Moderator by %s.", PlayerName(playerid));
SendClientMessage(targetplayer, COLOR_LIGHTBLUE, string);
format(string, sizeof string, "You have set %s as a Trial Moderator.", PlayerName(targetplayer));
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
}
if(Level == 2)
{
format(string, sizeof string, "You have been set to a Moderator by %s.", PlayerName(playerid));
SendClientMessage(targetplayer, COLOR_YELLOW, string);
format(string, sizeof string, "You have set %s as a Moderator.", PlayerName(targetplayer));
SendClientMessage(playerid, COLOR_YELLOW, string);
}
if(Level == 3)
{
format(string, sizeof string, "You have been set to a General Administrator by %s.", PlayerName(playerid));
SendClientMessage(targetplayer, COLOR_GREEN, string);
format(string, sizeof string, "You have set %s as a General Administrator.", PlayerName(targetplayer));
SendClientMessage(playerid, COLOR_GREEN, string);
}
if(Level == 4)
{
format(string, sizeof string, "You have been set to a Co-Owner by %s.", PlayerName(playerid));
SendClientMessage(targetplayer, COLOR_ORANGE, string);
format(string, sizeof string, "You have set %s as a Co-Owner.", PlayerName(targetplayer));
SendClientMessage(playerid, COLOR_ORANGE, string);
}
if(Level == 5)
{
format(string, sizeof string, "You have been set to the server Owner by %s.", PlayerName(playerid));
SendClientMessage(targetplayer, COLOR_LEMON, string);
format(string, sizeof string, "You have set %s to the server Owner.", PlayerName(targetplayer));
SendClientMessage(playerid, COLOR_LEMON, string);
}
printf("[SETADMIN] %s has set %s as an admin ( %i )", PlayerName(playerid), PlayerName(targetplayer), Level);
PlayerInfo[targetplayer][AdminLevel] = Level;
return 1;
}