21.02.2015, 15:28 
	(
 Последний раз редактировалось Larceny; 07.08.2017 в 20:40.
)
	
	
		
Introduзгo
Esta include eu jб havia feito a um tempo onde postei na бrea inglкs do fуrum, estou postando aqui para caso alguйm nгo conhecia possa ter acesso tambйm.
Uma include com o objetivo de criar mбquinas de venda automбtica (sprunks, etc) no lado do servidor, onde vocк pode ter total controle delas.
A include automaticamente substitui todas as mбquinas do jogo single-player. (desde 1.6)
Exemplo
Funзхes
Atualmente, hб 3 tipos de mбquinas.
Streamer plugin
Se o streamer plugin for incluнdo antes da vending.inc ela usarб CreateDynamicObject ao invйs de CreateObject.
Criando uma mбquina
Vocк pode usar o filterscript vendingcreator para criar mбquinas in-game e exporta-las.




Special action
Por padrгo, quando um jogador utilizar uma mбquina sprunk ele irб receber uma lata da mбquina onde ele pode beber dela. Vocк pode desabilitar isso adicionando NO_SPRUNK_ACTION antes da include.
Download
 Github.
	
	
	
	
Esta include eu jб havia feito a um tempo onde postei na бrea inglкs do fуrum, estou postando aqui para caso alguйm nгo conhecia possa ter acesso tambйm.
Uma include com o objetivo de criar mбquinas de venda automбtica (sprunks, etc) no lado do servidor, onde vocк pode ter total controle delas.
A include automaticamente substitui todas as mбquinas do jogo single-player. (desde 1.6)
Exemplo
Код:
new gVending;
main()
{
    gVending = CreateVendingMachine(MACHINE_SPRUNK, 1755.348144, -2113.468750, 12.692808, 0.000000, 0.000000, 180.000000);
}
public OnPlayerUseVendingMachine(playerid, machineid)
{ // Chamada quando um jogador usa uma mбquina.
    if(GetPlayerMoney(playerid) < 1)
    {// Caso o jogador nгo tenha dinheiro.
        SendClientMessage(playerid, COLOR_ERROR, "* Vocк nгo tem dinheiro suficiente.");
        return 0;
    }
    // Restaura 10% da vida do jogador e cobra 1$.
    new Float:health;
    GetPlayerHealth(playerid, health);
    // Evitando que um jogador possua mais que 100.0 de HP.
    if((health + 10.0) > 100.0) health = 100.0;
    else health += 10.0;
    // Definindo valores
    SetPlayerHealth(playerid, health);
    GivePlayerMoney(playerid, -1);
    return 1;
}
public OnPlayerDrinkSprunk(playerid)
{// Chamado quando um jogador bebe da lata de sprunk.
    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, "* Vocк bebeu da latinha. (+10HP)");
    return 1;
}
- Cria uma mбquina. retorna o ID da mбquina criada.pawn Код:CreateVendingMachine(objectid, Float:x, Float:y, Float:z, Float:rx, Float:ry, Float:rz);
 -  Obtйm as rotaзхes da mбquina, passada por referкncia.pawn Код:GetVendingMachineRot(machineid, &Float:rx, &Float:ry, &Float:rz);
 -  Define a rotaзгo da mбquina.pawn Код:SetVendingMachineRot(machineid, Float:rx, Float:ry, Float:rz);
 -  Obtйm a posiзгo da mбquina, passado por referкncia.pawn Код:GetVendingMachinePos(machineid, &Float:x, &Float:y, &Float:z);
 -  Define a posiзгo da mбquina.pawn Код:SetVendingMachinePos(machineid, Float:x, Float:y, Float:z);
 -  Destrуi a mбquina.pawn Код:DestroyVendingMachine(machineid);
 -  Obtйm o tipo da mбquina.pawn Код:GetVendingMachineType(machineid);
 -  Define a cor da mбquina. (ARGB)pawn Код:SetVendingMachineColor(machineid, color);
 -  Obtйm a cor da mбquina. (ARGB)pawn Код:GetVendingMachineColor(machineid);
 -  Verifica se a maquina existe.pawn Код:IsValidVendingMachine(machineid);
 -  Obtйm o ID do objeto da mбquina.pawn Код:GetVendingMachineObjectID(machineid);
 
Atualmente, hб 3 tipos de mбquinas.
Streamer plugin
Se o streamer plugin for incluнdo antes da vending.inc ela usarб CreateDynamicObject ao invйs de CreateObject.
Criando uma mбquina
Vocк pode usar o filterscript vendingcreator para criar mбquinas in-game e exporta-las.




Special action
Por padrгo, quando um jogador utilizar uma mбquina sprunk ele irб receber uma lata da mбquina onde ele pode beber dela. Vocк pode desabilitar isso adicionando NO_SPRUNK_ACTION antes da include.
Код:
#define NO_SPRUNK_ACTION #include <vending>
 Github.
	


	
