OK I was able to get the set_task thing working properly and everything. People can rent a room for a certain amount of time and it will give them access to it in the property table (and update the "rentmod" table which holds how much time is left and who is in what room). Now I still need clarification on a couple things. I'm using a show_motd that people can view room availability (shows name, steamid, minutes left) but it doesn't seem to work right. Here is example code on one of my menu handles that does this show_motd operation:
Code:
new origin[3], query[256]
get_user_origin(id,origin)
if(get_distance(origin,hoteldesk) > 30.0) return PLUGIN_HANDLED
new name[33], steamid[32], minutes[32], type[33], authid[32], renter[33], time[32], 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)
{
renter[32] = dbi_field(result,1)
steamid[31] = dbi_field(result,2)
time[31] = dbi_field(result,3)
kind[32] = dbi_field(result,4)
dbi_free_result(result)
}
new roommotd[2000]
name[32] = renter[32]
authid[31] = steamid[31]
minutes[31] = time[31]
type[32] = kind[32]
new len = format(roommotd,511,"Name: %s^n^n",name)
len += format(roommotd[len],511-len,"SteamID: %s^n^n",authid)
len += format(roommotd[len],511-len,"Minutes Left: %i^n^n",minutes)
len += format(roommotd[len],511-len,"Type of rent: %s^n^n",type)
show_motd(id,roommotd,"Hotel A Status")
When you go to bring the motd up, however, there is nothing where the %s and %i values are supposed to be, even if the info exists in the property/rentmod tables.
Also I need to make it so that there is a check and balance system so that a person can only rent one room at a time, and people can't rent a room that is already rented. Maybe even an option where they can extend their rent time to a certain max?(optional)
If this coding looks very horrible/amateur to you then don't be surprised as I'm very new at scripting, I just make what I can with the knowledge I have. If you have suggestions on how to make the coding do the same thing with less lines, then be my guest.
Thx for the help.