Quantcast
Channel: SA-MP Forums
Viewing all articles
Browse latest Browse all 18226

Select Name from DB

$
0
0
Hi ! I want to make a command to uninvite some players from a faction in game.

I don't know how to select their names from database ( i can't use playerid because they could be offline ).

What i tried to do:

HTML Code:

CMD:fmembers(playerid, params[])
{
        if(PlayerData[playerid][pGroupRank] >= 6)
        {
            new idd;
            if(sscanf(params, "i", idd)) return SCM(playerid,COLOR_WHITE,"{FF9900}Scrie: {33CCFF}/afmembers <FactionID>");
                new aim[5000],
                        query[300],
                        test[300],
                        test1[300],
                        test2[300],
                        test3[300],
                        test4[300],
                        aimtotal[5000];
//                        result[300];
//da                        mysql_real_escape_string(idd, idd);
        if(idd< 1 || idd > 21) return SCM(playerid, COLOR_GREY, "Invalid group ID [1-21].");
                format(query, sizeof(query), "SELECT * FROM `playeraccounts` WHERE `playeraccounts`.`playerGroup` = '%d' ORDER BY `playeraccounts`.`playerGroupRank` DESC LIMIT 50", idd);
                new Cache: membresult = mysql_query(handle, query);
                for(new i, j = cache_get_row_count (); i != j; ++i)
                {
                        cache_get_field_content(i, "playerName", result); format(test, 300, result);
                        cache_get_field_content(i, "playerGroupRank", result); format(test1, 300, result);
                        cache_get_field_content(i, "playerLastLogin", result); format(test2, 300, result);
                        cache_get_field_content(i, "playerFW", result); format(test3, 300, result);
                        cache_get_field_content(i, "playerDays", result); format(test4, 300, result);
                        new id = GetPlayerID(test);
                        if(id != INVALID_PLAYER_ID)
                        {
                                format(aim, sizeof(aim), "%s%s - %s\tonline right now\t%s/3 fw\t%s days\n", aim, test1, test, test3, test4);
                        }
                        else
                        {
                                format(aim, sizeof(aim), "%s%s - %s\t%s\t%s/3 fw\t%s days\n", aim, test1, test, test2, test3, test4);
                        }
                }
                cache_delete(membresult);
                format(aimtotal, sizeof(aimtotal), "Rank - Name\tLast Login\tFW\tDays in faction\n%s",aim);
                ShowPlayerDialog(playerid,385,DIALOG_STYLE_LIST,"Faction members",aimtotal,"Exit","");
        }
        return 1;
}


How to detect what's the playerName in database for a player from that dialog?

I have no idea :
HTML Code:

mysql_format(handle, samp, sizeof(samp), "SELECT playerName FROM playeraccounts WHERE playeraccounts.WHAT??? = '%s' LIMIT 1",WHAT2???);
                                                                new Cache: result699 = mysql_query(handle, samp);

I don't know how the query must be if that player will be offline. How can I find him in database? Thanks

Viewing all articles
Browse latest Browse all 18226

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>