Code:
new origin[3], query[256]
get_user_origin(id,origin)
if(get_distance(origin,hoteldesk) > 30.0) return PLUGIN_HANDLED
new steamid[32], renter[33], time, kind[33]
switch(key){
case 0:{
format(query,255,"SELECT name,steamid,minutes,type FROM rentmod WHERE room='Hotel A'")
result = dbi_query(dbc,query)
if(dbi_nextrow(result) > 0)
{
dbi_field(result,1,renter,32) //stores first field in this renter variable.
dbi_field(result,2,steamid,31) //like above, but for the steamid
time = dbi_field(result,3) //just a normal variable, no need for a max
dbi_field(result,4,kind,32) //kind is a string or number ?
dbi_free_result(result)
}
new roommotd[2000]
new len = format(roommotd,511,"Name: %s^n^n",renter)
len += format(roommotd[len],511-len,"SteamID: %s^n^n",steamid)
len += format(roommotd[len],511-len,"Minutes Left: %i^n^n",time)
len += format(roommotd[len],511-len,"Type of rent: %s^n^n",kind)
show_motd(id,roommotd,"Hotel A Status")