11.11.2016, 05:51
Okay so I have new problem
I made another acc on localhost and it is created in DB. Problem is when I give myself an admin on one acc another acc is getting the same admin level. Before making second acc /setmoney worked fine. Now it won't add at all. I just have same ammout on both accs.. Here are /setmoney and /setadmin
I made another acc on localhost and it is created in DB. Problem is when I give myself an admin on one acc another acc is getting the same admin level. Before making second acc /setmoney worked fine. Now it won't add at all. I just have same ammout on both accs.. Here are /setmoney and /setadmin
PHP код:
CMD:setmoney(playerid, params[])
{
if(PlayerInfo[playerid][Admin] < 4)
{
ERROR(playerid, "You are not allowed to use this command");
return 1;
}
new target, ammount;
if(sscanf(params, "ui", target, ammount))
{
USAGE(playerid, "/setmoney [ID/Name] [Ammount]");
return 1;
}
if(!IsPlayerConnected(target))
{
ERROR(playerid, "That player is not connected");
return 1;
}
ResetPlayerMoney(target);
GivePlayerMoney(target, ammount);
PlayerInfo[target][Money] = ammount;
new string[128], string2[128], query[90];
format(string, sizeof(string), ""YELLOW"[INFO] "WHITE"Admin "SERVERBLUE"%s "WHITE"setted your money to "SERVERBLUE"%d", GetName(playerid), ammount);
SCM(target, -1, string);
format(string2, sizeof(string2), "[INFO] Admin %s setted %s %d$", GetName(playerid), GetName(target), ammount);
AdminMessage(-1, string2);
WriteLog(MONEY, string2);
mysql_format(g_SQL, query, sizeof(query), "UPDATE `players` SET `Money` = %d WHERE `ID` = %d LIMIT 1", ammount, PlayerInfo[target][ID]);
mysql_tquery(g_SQL, query);
return 1;
}
//=============================== Admin Level 5 ================================//
CMD:setadmin(playerid, params[])
{
if(PlayerInfo[playerid][Admin] < 5)
{
ERROR(playerid, "You are not allowed to use this command");
return 1;
}
new target, level;
if(sscanf(params, "ui", target, level))
{
USAGE(playerid, "/setadmin [ID/Name] [Level]");
return 1;
}
if(!IsPlayerConnected(target))
{
ERROR(playerid, "That player is not online");
return 1;
}
if(PlayerInfo[target][Admin] >= 1)
{
ERROR(playerid, "That player already has that admin level. Use /apromote or /ademote");
return 1;
}
PlayerInfo[target][Admin] = level;
new string[128], string2[128], query[128];
mysql_format(g_SQL, query, sizeof(query), "UPDATE `players` SET `Admin` = %d WHERE `ID` = %d LIMIT 1", level, PlayerInfo[playerid][ID]);
mysql_tquery(g_SQL, query);
format(string, sizeof(string), ""YELLOW"[INFO] "WHITE"Admin "SERVERBLUE"%s "WHITE" gave you Admin Level "SERVERBLUE"%d", GetName(playerid), level);
SCM(target, -1, string);
format(string2, sizeof(string2), "[INFO] Admin %s gave %s Admin Level %d", GetName(playerid), GetName(target), level);
AdminMessage(-1, string2);
WriteLog(SET, string2);
return 1;
}