open.mp forum
[Pawn] Sending message to all owner of key (from SQL) - Printable Version

+ open.mp forum (https://forum.open.mp)
-- Forum: SA-MP (https://forum.open.mp/forumdisplay.php?fid=3)
--- Forum: Pawn Scripting (https://forum.open.mp/forumdisplay.php?fid=10)
--- Thread: [Pawn] Sending message to all owner of key (from SQL) (/showthread.php?tid=1890)



Sending message to all owner of key (from SQL) - Axitz - 2021-04-16

Hi,



How do I make something like sending message to all key's holder from sql function?



example like :



PHP Code:
mysql_format(sqldatapQuerysizeof pQuery"SELECT doorkey FROM `bizkeys` WHERE bizid = %d;"bizid);

new 
Cache:result mysql_query(sqldatapQuery);



then?



sendclientmsg to all holder of "doorkey" from bizid = %d



or something.


RE: Sending message to all owner of key (from SQL) - Radical - 2021-04-17

Code:
mysql_format(sqldata, pQuery, sizeof pQuery, "SELECT holdername, doorkey FROM `bizkeys` WHERE bizid = %d;", bizid);
new Cache:result = mysql_query(sqldata, pQuery);
new rows = cache_num_rows();
if (rows) {
? ? new name[24];
? ? for (new i; i < rows; i) {
? ? ? ? cache_get_value_name(i, "holdername", name);
? ? ? ? foreach(new p : Player) if (!strcmp(GetName(p), name, true)) {
? ? ? ? ? ? SendClientMessage(p, ...);
? ? ? ? ? ? break;
? ? ? ? }
? ? }
    cache_delete(result);
}
You have to save the player name in the holdername field.