![]() |
#1 |
Huge Clucker
![]() ![]() ![]() Join Date: Apr 2006
Posts: 276
Reputation: 221
|
![]() Introduction An include to create server-side vending machines that gives you full control of the in-game vending machines. It automatically replaces the single-player machines. (since 1.6) Example Code:
new gVending; main() { gVending = CreateVendingMachine(MACHINE_SPRUNK, 1755.348144, -2113.468750, 12.692808, 0.000000, 0.000000, 180.000000); } public OnPlayerUseVendingMachine(playerid, machineid) { // Called when the player use the machine. if(GetPlayerMoney(playerid) < 1) {// If the player has no money. SendClientMessage(playerid, COLOR_ERROR, "* You don't have enough money."); return 0; } // Restore 10% of player's health and takes 1$. new Float:health; GetPlayerHealth(playerid, health); // Avoid player having more than 100.0 health. if((health + 10.0) > 100.0) health = 100.0; else health += 10.0; // Give player stats SetPlayerHealth(playerid, health); GivePlayerMoney(playerid, -1); return 1; } public OnPlayerDrinkSprunk(playerid) {// Called when the player drink from the can. new Float:health; GetPlayerHealth(playerid, health); if((health + 10.0) > 100.0) health = 100.0; else health += 10.0; SetPlayerHealth(playerid, health); SendClientMessage(playerid, COLOR_INFO, "* You drank the sprunk. (+10HP)"); return 1; }
Vending types Currently, there is 3 types of vending machines. Streamer plugin If streamer plugin is included before vending.inc it will use CreateDynamicObject instead of CreateObject. Creating a vending You can use the vendingcreator filterscript to help you creating vendings. ![]() ![]() ![]() ![]() Special action By default, when a player uses the sprunk machine they get a sprunk can and can drink from it. You can disable it by adding NO_SPRUNK_ACTION before the include. Code:
#define NO_SPRUNK_ACTION #include <vending> ![]() Last edited by Larceny; 07/08/2017 at 09:40 PM. |
![]() |
![]() |
![]() |
#2 |
Little Clucker
![]() Join Date: Nov 2014
Posts: 13
Reputation: 3
|
![]()
I'm surprised that no one has replied yet. This type of include could evolve into many other dynamic systems, and it would be great to see some more from you in the future. I'm going to replace the old vending machines with these so that they will support my anti-cheat.
Last edited by SydthTV; 02/01/2015 at 06:31 AM. |
![]() |
![]() |
![]() |
#3 |
High-roller
![]() ![]() ![]() ![]() ![]() Join Date: Mar 2012
Location: NetherRealm
Posts: 2,703
Reputation: 1176
|
![]()
This is nice, it could replace the client sided vending machines and support linking with anti-cheats.
|
![]() |
![]() |
![]() |
#4 |
Big Clucker
![]() ![]() Join Date: Jan 2010
Location: Malaga
Posts: 63
Reputation: 8
|
![]()
Realy good job, thanks alot.
Here you can see actual machines pos: http://gta.wikia.com/Vending_Machines Greetings Ranslsad |
![]() |
![]() |
![]() |
#5 |
Big Clucker
![]() ![]() Join Date: Feb 2011
Posts: 142
Reputation: 20
|
![]()
Thank you very much, this is pretty cool
![]() |
![]() |
![]() |
![]() |
#6 |
Huge Clucker
![]() ![]() ![]() Join Date: Dec 2011
Location: Castillo
Posts: 393
Reputation: 100
|
![]()
This is really amazing. SA-MP needed something like this.
|
![]() |
![]() |
![]() |
#7 |
Huge Clucker
![]() ![]() ![]() Join Date: Apr 2006
Posts: 276
Reputation: 221
|
![]()
Thanks.
I got the coordinates of the single-player machines. Now the include replaces the single-player machines automatically, so no need to remove them manually. |
![]() |
![]() |
![]() |
#8 |
High-roller
![]() ![]() ![]() ![]() ![]() Join Date: Dec 2013
Location: GetPlayerPos(playerid, pos); Scripter/Mapper.
Posts: 3,141
Reputation: 445
|
![]()
Awesome! I was thinking of making something like this; but never actually did anything more than think about it. Very well done from the looks of it.
|
![]() |
![]() |
![]() |
#9 |
Banned
![]() Join Date: Jun 2013
Location: Argentina.
Posts: 2,042
Reputation: 827
|
![]()
Thanks a lot, this is nice
![]() Btw, why you dont use y_iterate and dynamics areas (streamer) to optimize this? |
![]() |
![]() |
![]() |
#10 |
Huge Clucker
![]() ![]() ![]() Join Date: Apr 2006
Posts: 276
Reputation: 221
|
![]()
Thanks.
I didn't want the user needed to download other includes to be able to use the include. But i'm updating it to check if streamer is included, probably i'll do the same to y_iterate. |
![]() |
![]() |
![]() |
Thread Tools | |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
[FilterScript] Remove Vending Machines | AstonDA-G | Filterscripts | 22 | 11/10/2019 06:59 PM |
Please help me how to fix this vending machin | Lloyde | Scripting Help | 4 | 02/04/2014 12:14 AM |
[FilterScript] [FS] Sprunkin || Vending Machines! | Tr1viUm | Filterscripts | 20 | 29/12/2010 12:04 AM |
Disabling Vending Machines | MisterTickle | Help Archive | 2 | 25/07/2009 09:30 AM |