[Mysql] Problem with a function
#10

Untested and im tired so it might not work

pawn Код:
CMD:changename(playerid, params[])
{
    if(pInfo[playerid][Admin] >= 70)
    {
        new
            query[128],
            id,
            nom[24];
           
            if(sscanf(params, "us[24]", id, nom)) return SendClientMessage(playerid, Rouge: "Usage: /changename [playerid][new name]");
            if(id == playerid) return SendClientMessage(playerid, Rouge, "Dont change your own name!");
            if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, Rouge, "Playerid not connected!");
           
            format(jouerdestinataire, sizeof(jouerdestinataire), "%s", nom);
           
            mysql_format(mysql, query, sizeof(query), "SELECT * FROM `joueurs` WHERE `Username` = '%s' LIMIT 1", nom);
            mysql_tquery(mysql, query, "OnJoueurRenommer", "dds", playerid, id, nom);
    }
}

public OnJoueurRenommer(playerid, id, nom)
{
    new
        rows,
        fields,
        query[128];
       
    cache_get_data(rows, fields, mysql);
   
    if(rows)
    {
        SendClientMessage(playerid, Rouge, "Nom is already in use!");
    }
    else if(!rows)
    {
        new
            v1 = pInfo[id][ClefVoiture1],
            v2 = pInfo[id][ClefVoiture2],
            v3 = pInfo[id][ClefVoiture3],
            v4 = pInfo[id][ClefVoiture4];
           
        if(v1 != 1)
        {
            format(vInfo[v1][vProprietaire], 24, "%s", joueurdestinataire);
           
            mysql_format(mysql, query, sizeof(query), "UPDATE `voitures` SET `Proprietaire` = '%s' WHERE `ID` = '%d'", joueurdestinataire, vInfo[v1]);
            mysql_query(mysql, query, sizeof(query), "", "");
        }
    }
}
Cannot be bothered finishing it, you get the drill with it though
Reply


Messages In This Thread
[Mysql] Problem with a function - by anou1 - 19.07.2014, 01:08
Re: [Mysql] Problem with a function - by sammp - 19.07.2014, 01:38
Re: [Mysql] Problem with a function - by anou1 - 19.07.2014, 01:48
Re: [Mysql] Problem with a function - by sammp - 19.07.2014, 02:38
Re: [Mysql] Problem with a function - by anou1 - 19.07.2014, 02:42
Re: [Mysql] Problem with a function - by sammp - 19.07.2014, 02:44
Re: [Mysql] Problem with a function - by anou1 - 19.07.2014, 02:47
Re: [Mysql] Problem with a function - by sammp - 19.07.2014, 02:51
Re: [Mysql] Problem with a function - by anou1 - 19.07.2014, 02:52
Re: [Mysql] Problem with a function - by sammp - 19.07.2014, 03:06

Forum Jump:


Users browsing this thread: 1 Guest(s)