1 function
#2

Quote:
Originally Posted by BaubaS
Посмотреть сообщение
Hi, I want to make function like "GetLeaderName(jobid)".

It should work something like this: If any player field "Direktorius" value is jobid in MySQL then it would return that player name. But, if there arent any player which field "Direktorius" value in MySQL isnt jobid - it will return {hex}Direktorius {hex}neiљrinktas

I tried to do something, but nah, it doesnt work :S:

pawn Код:
stock GetLeaderName(jobid)
{
    new Query[63];
    format(Query, 63, "SELECT Vardas FROM `zaidejudb` ORDER BY `Direktorius` = '%d'", jobid);
    mysql_query(Query);
    mysql_store_result();
    new Name[32];
    while(mysql_fetch_row(Name))
    {
        if(!mysql_num_rows()) Name = "Direktorius {FF0000}neiрrinktas";
    }
    return Name;
}
pawn Код:
stock GetLeaderName(jobid)
{
    new Query[63];
    format(Query, 63, "SELECT Vardas FROM `zaidejudb` ORDER BY `Direktorius` = '%d'", jobid);
    mysql_query(Query);
    mysql_store_result();
    new Name[32];
    while(mysql_fetch_row(Name))
    {
        if(!mysql_num_rows()) strmid(Name, "Direktorius {FF0000}neiрrinktas")); // Strcat, i prefer strmid.
    }
    return Name;
}
Reply


Messages In This Thread
1 function - by BaubaS - 11.07.2011, 22:26
Re: 1 function - by Cameltoe - 11.07.2011, 22:28
Re: 1 function - by BaubaS - 12.07.2011, 16:47
Re: 1 function - by BaubaS - 13.07.2011, 00:34
Re: 1 function - by Calgon - 13.07.2011, 00:38
Re: 1 function - by BaubaS - 13.07.2011, 01:35
Re: 1 function - by Cameltoe - 13.07.2011, 08:57
Re: 1 function - by Gh0sT_ - 15.07.2011, 15:01

Forum Jump:


Users browsing this thread: 1 Guest(s)