IRCCMD:setoffscore(botid, channel[], user[], host[], params[])
{
if(!IRC_IsAdmin(botid, channel, user)) return IRC_Notice(botid, user, "\x0204[ERROR]:\x02 You are don't have permission to use this command!");
if(!IsPlayerWhiteList(user)) return IRC_Notice(botid, user, "\x0204[ERROR]:\x02 You are don't have permission to use this command!");
new targetName[MAX_PLAYER_NAME], _query[150], score, Cache:results;
if(sscanf(params, "s[24]d", score)) return IRC_Notice(gGroupID, user,"\x0214[USAGE]:\x02 !setoffscore [username] [score]") && IRC_Notice(gGroupID, user,"\x0214[FUNCTION]:\x0F Set an offline player's score");
if(IsValidAccount(targetName) == 0) return IRC_Notice(botid, user, "\x0204[ERROR]:\x02 You have inputed an invalid account name!");
format(_query, sizeof(_query), "UPDATE `accounts` SET `Hours` = %d WHERE `Username` = '%e'", score, targetName);
mysql_tquery(handle, _query);
format(_query, sizeof(_query), "\x0203[INFO]:\x02 \x1D%s\x1D has set \x1D%s\x1D's score to \x1D%d\x1D", user, targetName, score);
IRC_GroupSay(gGroupID, channel, _query);
SendToLog("!setscore", user, targetName, score);
return 1;
}
IRCCMD:setoffscore(botid, channel[], user[], host[], params[])
{
if(!IRC_IsAdmin(botid, channel, user)) return IRC_Notice(botid, user, "\x0204[ERROR]:\x02 You are don't have permission to use this command!");
if(!IsPlayerWhiteList(user)) return IRC_Notice(botid, user, "\x0204[ERROR]:\x02 You are don't have permission to use this command!");
new targetName[MAX_PLAYER_NAME], _query[150], score, targetId, Cache:results;
if(sscanf(params, "s[24]d", targetName, score)) return IRC_Notice(gGroupID, user,"\x0214[USAGE]:\x02 !setoffscore [username] [score]") && IRC_Notice(gGroupID, user,"\x0214[FUNCTION]:\x0F Set an offline player's score");
if(IsValidAccount(targetName) == 0) return IRC_Notice(botid, user, "\x0204[ERROR]:\x02 You have inputed an invalid account name!");
mysql_format(handle, _query, sizeof(_query), "SELECT `AccountID` FROM `accounts` WHERE `Username` = '%e'", targetName);
results = mysql_query(handle, _query);
cache_get_value_name_int(0, "AccountID", targetId);
cache_delete(results);
format(_query, sizeof(_query), "UPDATE `accounts` SET `Hours` = %d WHERE `Username` = '%e'", score, targetName);
mysql_tquery(handle, _query);
format(_query, sizeof(_query), "UPDATE `stats` SET `Hours` = %d WHERE `AccountID` = '%d'", score, targetId);
mysql_tquery(handle, _query);
format(_query, sizeof(_query), "\x0203[INFO]:\x02 \x1D%s\x1D has set \x1D%s\x1D's score to \x1D%d\x1D", user, targetName, score);
IRC_GroupSay(gGroupID, channel, _query);
SendToLog("!setscore", user, targetName, score);
return 1;
}
Originally Posted by DarkMythHunter
( there's other purpose behind it )
|