SA-MP Forums Archive
Inserts name twice into "bans". - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Inserts name twice into "bans". (/showthread.php?tid=314380)



Inserts name twice into "bans". - Dokins - 29.01.2012

As it says, this should set the IP into bans, of which is in the variable but doesnt, it allows me to get the name and check that it exists etc but it won't get the IP from the result can someone tell me why?


pawn Код:
CMD:rban(playerid, params[])
{
    if(LoggedIn[playerid] == 0) return SendClientMessage(playerid, COLOUR_GREY, "You must be logged in to use this command.");

    new reason[128], query[256],player[24], playerip, string[128];
    if(AdminLevel[playerid] < 1) return SendClientMessage(playerid, COLOUR_GREY, "You are not authorized to use this command.");
    if(sscanf(params, "s[24]s[128]", player, reason)) return SendClientMessage(playerid, COLOUR_GREY, "Usage: /rban [player name] [reason]- Use an underscore or it will not work.");

    format(string, sizeof(string), "Admin %s Banned %s [Reason: %s]", GetNameEx(playerid), player, reason);
    SendClientMessageToAll(COLOUR_REALRED, string);
   
    format(query, sizeof(query), "SELECT `PlayerIP` FROM `accounts` WHERE `PlayerName` = '%s'", player);
    mysql_query(query); // No query line
    playerip = mysql_store_result(); // "Error nothing to store"
    new rows = mysql_num_rows();
    if(rows > 0)
    {
        format(query, sizeof(query), "INSERT INTO `bans` (`playername`, `IP`) VALUES ('%s', '%s')", player, playerip);
        mysql_query(query);
        format(string, sizeof(string), "You have banned account(Remote - Ban) %s", player);
        SendClientMessage(playerid, COLOUR_REALRED, string);
    }
    if(rows == 0)
    {
        SendClientMessage(playerid, COLOUR_GREY, "There are no accounts found with that name.");
    }
    mysql_free_result();
    return 1;
}



Re: Inserts name twice into "bans". - Dokins - 29.01.2012

bump - not resolved.


Re: Inserts name twice into "bans". - Dokins - 29.01.2012

Anyone?