MySQL Problem.
#1

I want a command to show the name of a offline player.
EG. /mdcic 233332 .

When you type /mdcic 233332, to show the name of player which table XXXX in database `players` is 233332.
Reply
#2

UP .
Reply
#3

Do you actually need the code or did you try make this and it doesn't work?

If you want the code and haven't made it, post in the Script Requests Thread, otherwise post your code in this thread.
Reply
#4

I need just an idea. I tried to make, but i don't know how to get the name of that player, which table "XXXX" has value 233332 .
Reply
#5

Show us the code you have so far.
Reply
#6

pawn Код:
command(mdcic, playerid, params[])
{
    if(IsPlayerConnected(playerid))
    {
            new idx;
            new tmp[120];
            new query[120];
            new myvariable;
            tmp = strtok(params, idx);
            myvariable = strval(tmp);
            if(!strlen(tmp))
            {
                // you did not write the anumber eetc..
                return 1;
            }
            format(query, sizeof(query)," SELECT * FROM playerinfo WHERE yourid=%d",myvariable);
            mysql_query(query); // here you go this query will select whatever you write ingame from the tables where you have your playerinfo saved :P
    }
    return 1;
}
Reply
#7

Look, a better eg.

I write in game /search 1555 , and this command i want to show me which player has number 1555. I have in database players, number table.
Reply
#8

pawn Код:
if(strcmp(cmd, "/search", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            new query[120];
            new Number;
            tmp = strtok(cmdtext, idx);
            Number= strval(tmp);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /search [number]");
                return 1;
            }
            format(query, sizeof(query)," SELECT * FROM players WHERE Number=%d",Number);
            samp_mysql_query(query);
        }
        return 1;
    }
After.. ?
Reply
#9

Код:
command(mdcic, playerid, params[])
{
    if(IsPlayerConnected(playerid))
    {
ZCMD and this ... unbelievable ...
Reply
#10

Quote:
Originally Posted by GaB1TzZzu
Посмотреть сообщение
pawn Код:
if(strcmp(cmd, "/search", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            new query[120];
            new Number;
            tmp = strtok(cmdtext, idx);
            Number= strval(tmp);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /search [number]");
                return 1;
            }
            format(query, sizeof(query)," SELECT * FROM players WHERE Number=%d",Number);
            samp_mysql_query(query);
        }
        return 1;
    }
After.. ?
You sent the query, store the result, check if there are rows matching your query using mysql_num_rows and fetch the result with mysql_fetch_row_format.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)