It don't change the data on database
#1

PHP код:
IRCCMD:setscore(botidchannel[], user[], host[], params[])
{
    if(!
IRC_IsAdmin(botidchanneluser)) return IRC_Notice(botiduser"\x0204[ERROR]:\x02 You are don't have permission to use this command!");
    if(!
IsPlayerWhiteList(user)) return IRC_Notice(botiduser"\x0204[ERROR]:\x02 You are don't have permission to use this command!");
    new 
targetidscorestring[144];
    if(
sscanf(params"ud"targetidscore)) return IRC_Notice(gGroupIDuser,"\x0214[USAGE]:\x02 !setscore [player id] [score]") && IRC_Notice(gGroupIDuser,"\x0214[FUNCTION]:\x02 Set a player's score");
    if(!
IsPlayerConnected(targetid)) return IRC_Notice(botiduser"\x0204[ERROR]:\x02 That player is not online!");
    if(
IsPlayerNPC(targetid)) return IRC_Notice(botiduser"\x0204[ERROR]:\x02 You cannot set an NPC's score!");
       if(
pInfo[targetid][pIsPlayerLogged] == falseIRC_Notice(botiduser"\x0204[ERROR]:\x02 This player hasn't logged-in yet!");
    if(
pInfo[targetid][pIsPlayerSpawned] == falseIRC_Notice(botiduser"\x0204[ERROR]:\x02 This player hasn't spawned yet!");
    
pInfo[targetid][pHours] = score;
    
SetPlayerScore(targetidscore);
    
format(stringsizeof(string), "*"COL_WHITE" %s "COL_ORANGE"has set your score to "COL_WHITE"%i"userscore);
    
SendClientMessage(targetid, -1string);
    
format(stringsizeof(string), "*"COL_WHITE" %s "COL_ORANGE"has set "COL_WHITE"%s"COL_ORANGE"'s score to "COL_WHITE"%i"userpInfo[targetid][pUsername], score);
    
SendMessageToAllAdmins(string, -1pInfo[targetid][pAdminLevel] > targetid INVALID_PLAYER_ID);
    
format(stringsizeof(string), "\x0203[INFO]:\x02 \x1D%s\x1D has set \x1D%s\x1D's score to \x1D%d\x1D"userpInfo[targetid][pUsername], score);
    
IRC_GroupSay(gGroupIDchannelstring);
    
SendToLog("/setscore"userpInfo[targetid][pUsername], score);
    return 
1;

This one don't work correctly, it do changes the online player score but it does not change the data in the database. So if the player logged off, and logged in the old score will still load.



This is the other one for /setoffscore, for offline players. This one works.

PHP код:
IRCCMD:setoffscore(botidchannel[], user[], host[], params[])
{
    if(!
IRC_IsAdmin(botidchanneluser)) return IRC_Notice(botiduser"\x0204[ERROR]:\x02 You are don't have permission to use this command!");
    if(!
IsPlayerWhiteList(user)) return IRC_Notice(botiduser"\x0204[ERROR]:\x02 You are don't have permission to use this command!");
    new 
targetName[MAX_PLAYER_NAME], score_query[120];
    if(
sscanf(params"s[24]d"targetNamescore)) return IRC_Notice(gGroupIDuser,"\x0214[USAGE]:\x02 !setoffscore [username] [score]") && IRC_Notice(gGroupIDuser,"\x0214[FUNCTION]:\x0F Set an offline player's score");
    if(
IsValidAccount(targetName) == 0) return IRC_Notice(botiduser"\x0204[ERROR]:\x02 You have inputed an invalid account name!");
    
format(_querysizeof(_query), "UPDATE `accounts` SET `Hours` = %d WHERE `Username` = '%s'"scoretargetName);
    
mysql_tquery(handle_query);
    
format(_querysizeof(_query), "\x0203[INFO]:\x02 \x1D%s\x1D has set \x1D%s\x1D's score to \x1D%d\x1D"usertargetNamescore);
    
IRC_GroupSay(gGroupIDchannel_query);
    
SendToLog("!setscore"usertargetNamescore);
    return 
1;

Reply


Messages In This Thread
It don't change the data on database - by DarkMythHunter - 12.09.2018, 09:52
Re: It don't change the data on database - by UFF - 12.09.2018, 10:07
Re: It don't change the data on database - by iLearner - 12.09.2018, 10:27

Forum Jump:


Users browsing this thread: 1 Guest(s)