Help with a custom mod
Hello I'm trying to make a custom rentmod for TSRP so you can rent hotel rooms. I've been able to get the menus working, in that they will update the mysql database so you have access to w/e room you rented. However, I'm not sure how I would make it so that it won't let you rent a room if that room is already rented or if you already have rented a room. Also, I'm confused on how I would make the set_task make the "minutes" column in the table to count down until zero, then upon zero taking away access from that hotel room.
Any help plz? |
Re: Help with a custom mod
Code:
|
Re: Help with a custom mod
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] 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. |
Re: Help with a custom mod
don't use variables that you don't need,
try this: Code:
|
Re: Help with a custom mod
It would be much better if you used a "timestamp" instead of a set_task for counting down the time.
Assign a variable (I'll use X in this example) X to get_systime()+(However many seconds you want the room to be rented for), and whenever someone tries to rent/use a rented room, it checks to see if the rent time is up. If the rent time is up, it won't let the previous renter use the room, or it will let another user rent the room from that point on. It's better to compare seconds than to use a set_task. |
Re: Help with a custom mod
Quote:
|
Re: Help with a custom mod
Quote:
Try reading what Hawk552 wrote about set_tasks, he's has more respect than I do, perhaps you'll listen to his words. Besides, storing the number is a more logical way to do it anyway. http://forums.alliedmods.net/showthread.php?t=43049 |
Re: Help with a custom mod
Well I've gotten the rentmod working, the only thing I've left out is making it so that people can't rent more than 1 room at a time. I'm still confused on how to do this, any help?
|
Re: Help with a custom mod
Quote:
|
Re: Help with a custom mod
Hey I just looked at Hawks tutorial on that. It doesn't seem very complicated, but I don't think it would matter here since the timer needs to be exactly 10 minutes in RL time, which the set_tasks seem to do very well.
But anyways, about what I said earlier: Quote:
|
| All times are GMT -4. The time now is 22:26. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.